Commit Graph

1360 Commits

Author SHA1 Message Date
asynts
01879d27c2 Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
2021-01-16 11:54:35 +01:00
Andreas Kling
971425d7b1 ProtocolServer: Fix null dereference in HTTP/HTTPS job finish callback
The consolidation of the initialization code between HTTP and HTTPS
downloads was capturing the "job" local by reference, which was not safe
after we left the init() scope.

Fix this by getting the HTTP::Job from the Download object instead.
2021-01-16 11:50:48 +01:00
Andreas Kling
e8512b8cd7 LibC: Bump FD_SETSIZE to 1024
64 was cutting it pretty close, especially now as we start using file
descriptor passing more and more.

This (1024) matches many other systems, and if we need more there's
always sys$poll().
2021-01-16 11:26:53 +01:00
Andreas Kling
58b435f49e LibGfx: Short-circuit ShareableBitmap construction in IPC decoder
When decoding a ShareableBitmap that came over IPC, it's safe to assume
that it's backed by an anonymous file (since we just decoded it.)
2021-01-16 11:26:53 +01:00
Andreas Kling
f18d89b36d LibGfx: Make sure Bitmap::create_with_anon_fd() always closes if needed
If this is called with ShouldCloseAnonymousFile::Yes, it's entrusted
with closing the anon_fd and nobody else will take care of it.
2021-01-16 11:26:53 +01:00
Andreas Kling
1a157d3f50 LibGfx: Don't expose anon_fd inside Gfx::ShareableBitmap
Nobody outside needs to see this, so let's just hide it.
2021-01-16 11:26:53 +01:00
Andreas Kling
4277be356a WindowServer+LibGUI: Send menu item icons as Gfx::ShareableBitmap 2021-01-16 11:26:53 +01:00
Andreas Kling
7c1df68be3 LibGfx: Don't encode invalid Gfx::ShareableBitmap as IPC::File
IPC::File should only be used when there's an actual file to pass.
Invalid ShareableBitmaps don't have a backing file, so fix this by
first encoding a "valid" flag.
2021-01-16 11:26:53 +01:00
Andreas Kling
64610ca80e Everywhere: Remove a bunch of <AK/SharedBuffer.h> includes 2021-01-16 11:26:53 +01:00
Andreas Kling
ab0dad5ea2 WindowServer+LibGUI: Pass drag&drop bitmaps via Gfx::ShareableBitmap
This makes them backed by anonymous files instead of shbufs and also
simplifies the code significantly on both client and server side.
2021-01-16 11:26:53 +01:00
Nick Vella
60e580fa3e ShutdownDialog: refresh system theme on instantiation.
Whilst SystemMenu maintains a constant WindowServer connection, there
isn't always a Window active on that connection to listen for theme
changes - this causes the current theme in this process to fall out of
sync with the rest of the system. This fixes this problem by
re-requesting an UpdateSystemTheme message when the dialog is
instantiated.
2021-01-16 09:09:04 +01:00
Nick Vella
fcf50af53d WindowServer, LibGUI: RefreshSystemTheme implementation
Adds a mechanism through which windowing clients can re-request an
UpdateSystemTheme message. This is currently used in SystemMenu's
ShutdownDialog to refresh it's theme when the dialog is instantiated.
2021-01-16 09:09:04 +01:00
Nick Vella
fdc9b3c5a0 Shell: use exit code 127 on command not found 2021-01-16 09:05:01 +01:00
Nick Vella
1d11b62ca4 Shell: return the exit code of a '-c' command execution 2021-01-16 09:05:01 +01:00
Nick Vella
d1e3193339 SystemMenu: add Run to system menu above About 2021-01-16 09:05:01 +01:00
Nick Vella
40083444a0 Run: initial implementation of Run app 2021-01-16 09:05:01 +01:00
Andreas Kling
6536a9c79a LibGfx: Fix fuzzer build (put anon_create() behind __serenity__) 2021-01-16 09:02:17 +01:00
Linus Groh
6f666c20f5 CrashReporter: Show CPU register state for all threads
Closes #4777 .
2021-01-15 23:26:47 +01:00
Linus Groh
33c31e2198 CrashReporter: Show arguments and environment
Arguments as a simple label, environment in a new tab. :^)

Closes #4779.
2021-01-15 23:26:47 +01:00
Linus Groh
0187fd4fdd LibCoreDump: Expose arguments and environment
We can pull those from the coredump's ProcessInfo JSON, do some basic
sanity checks and expose them as ready-to-use Vector<String>s.
2021-01-15 23:26:47 +01:00
Linus Groh
7668e968af LibCoreDump+Crash{Daemon,Reporter}: Make backtraces thread-specific
We want to show an individual backtrace for each thread, not one
containing backtrace entries from all threads.

Fixes #4778.
2021-01-15 23:26:47 +01:00
Linus Groh
3718a16f59 CrashReporter: Put backtrace TextEditor in a TabWidget
Since CrashReporter will be showing more info from coredumps soon, we
need tabs to put those things somewhere! :^)
2021-01-15 23:26:47 +01:00
Linus Groh
568cde5e23 Kernel+LibELF+LibCoreDump+CrashReporter: Use JSON for ProcessInfo
This is in preparation of adding (much) more process information to
coredumps. As we can only have one null-terminated char[] of arbitrary
length in each struct it's now a single JSON blob, which is a great fit:
easily extensible in the future and allows for key/value pairs and even
nested objects, which will be used e.g. for the process environment, for
example.
2021-01-15 23:26:47 +01:00
Andreas Kling
4839f36f5e LibGUI: Fix OpacitySlider hairline disappearing towards the left
Whoops, we were scaling the alpha channel of the hairline color along
with the RGB channels.
2021-01-15 23:24:07 +01:00
Andreas Kling
71f50b6e94 LibGUI: Window icons no longer need to be backed by shbufs
This allows us to remove Window::create_shared_bitmap() entirely.
2021-01-15 23:24:07 +01:00
Andreas Kling
333366a99d WindowServer+Taskbar: Send WM icon updates as Gfx::ShareableBitmap
Window icons in Taskbar were previously received in WM events with
shbuf ID's. Now that Gfx::ShareableBitmap is backed by anonymous files,
we can easily switch to using those.
2021-01-15 23:24:07 +01:00
Andreas Kling
633915e792 LibGfx: Make Gfx::ShareableBitmap use anonymous files instead of shbufs 2021-01-15 23:24:07 +01:00
Nico Weber
adb9ade88d LibGfxScaleDemo: Add Emoji to window title bar
I thought this wouldn't work yet, but it already does.
2021-01-15 22:11:51 +01:00
Nico Weber
63ac9462ad WindowServer: Add a "scale" parameter to the SetResolution message and plumb it through
Now, `chres 640 480 2` can set the UI to HighDPI 640x480 at runtime. A
real GUI for changing the display factor will come later.

(`chres 640 480 2` followed by `chres 1280 960` is very fast since
we don't have to re-allocate the framebuffer since both modes use
the exact same number of physical pixels.)
2021-01-15 22:05:08 +01:00
Nico Weber
248d75e13b WindowServer: Don't reallocate the cursor back bitmap all the time in HighDPI mode
It's in efficient, and it also meant we wouldn't reallocate a bigger
backing bitmap in a lowdpi->highdpi transition, leading to minor drawing
glitches after such a transition.

(Whoops!)
2021-01-15 22:05:08 +01:00
Nico Weber
476a3acfb2 Utilities: Add "chres", a way to change the screen resolution from the command line 2021-01-15 22:05:08 +01:00
Lenny Maiorani
9f64424661 Http[s]Download: Make the constructor's initialization DRY
Problem:
- `HttpDownload()` and `HttpsDownload()` implementations are the same
  except for types and certificates.

Solution:
- Follow the "Don't Repeat Yourself" mantra and de-duplicate the code
  using templates.
2021-01-15 21:50:49 +01:00
Cypher87
0f7efd5bf1
FileManager: Added label "Location" to BreadcrumbBar (#4924) 2021-01-15 19:37:27 +01:00
Nico Weber
9abcc2fb6c DisplaySettings: Fix a comment typo 2021-01-15 19:13:46 +01:00
Nico Weber
699ba84bea DisplaySettings: Rename wallpaper setting "scaled" to "stretch"
I want to add a scale factor for picking pixel density, and using
the same terminology for wallpaper handling would be confusing.
2021-01-15 19:13:46 +01:00
Nico Weber
56cad36ef2 LibGfx: Make Painter::draw_rect() scale-aware
Needed for the window server minimize animation.

draw_rect() can't just call draw_line() because that isn't
draw_op()-aware. The draw_op()-awareness in Painter looks a bit ad-hoc,
but that's for another day.
2021-01-15 19:13:29 +01:00
AnotherTest
c1b4e86004 Shell: Add formatter for history events 2021-01-15 19:13:03 +01:00
AnotherTest
239472ba69 Shell: Add (basic) support for history event designators
Closes #4888
2021-01-15 19:13:03 +01:00
Brendan Coles
15fde85b21 Tests: Move test-gfx-font to /usr/Tests/LibGfx/font and add new tests 2021-01-15 19:11:35 +01:00
Nico Weber
e87b8a79ed WindowServer: Make HighDPI aware
Almost all logic stays in "logical" (unscaled coordinates), which
means the patch is small and things like DnD, window moving and
resizing, menu handling, menuapplets, etc all work without changes.

Screen knows about phyiscal coordinates and mouse handling internally is
in physical coordinates (so that two 1 pixel movements in succession can
translate to one 1 logical coordinate mouse movement -- only a single
event is sent in this case, on the 2nd moved pixel).

Compositor also knows about physical pixels for its backbuffers. This is
a temporary state -- in a follow-up, I'll try to let Bitmaps know about
their intrinsic scale, then Compositor won't have to know about pixels
any longer. Most of Compositor's logic stays in view units, just
blitting to and from back buffers and the cursor save buffer has to be
done in pixels. The back buffer Painter gets a scale applied which
transparently handles all drawing. (But since the backbuffer and cursor
save buffer are also HighDPI, they currently need to be drawn using a
hack temporary unscaled Painter object. This will also go away once
Bitmaps know about their intrinsic scale.)

With this, editing WindowServer.ini to say

  Width=800
  Height=600
  ScaleFactor=2

and booting brings up a fully-functional HighDPI UI.
(Except for minimizing windows, which will crash the window server
until #4932 is merged. And I didn't test the window switcher since the
win-tab shortcut doesn't work on my system.) It's all pixel-scaled,
but it looks pretty decent :^)
2021-01-15 19:10:16 +01:00
Nico Weber
867807fb2b WindowServer: Delete dead set_screen parameter 2021-01-15 19:09:10 +01:00
TheMorc
b2086c8d77 Demos+Games: Pledge "sendfd" in demos and games 2021-01-15 18:47:07 +01:00
Andreas Kling
12879184ce UserspaceEmulator: Support the anon_create, sendfd and recvfd syscalls 2021-01-15 14:17:19 +01:00
Andreas Kling
20915795a8 Everywhere: Pledge "sendfd" in WindowServer client programs
This is needed for the new way we transfer window backing stores.
2021-01-15 14:10:32 +01:00
Andreas Kling
0b0514d46b LibGUI+WindowServer: Use anonymous files for window backing stores :^)
This patch replaces the use of shbufs for GUI::Window backing stores
with the new anonymous files mechanism.

Backing bitmaps are now built on memory allocated with anon_create().
They are passed across the IPC socket as IPC::File. This means that
WindowServer now pledges "recvfd" and graphical clients need to pledge
"sendfd" to work.

To support the cached bitmap swapping optimization on the WindowServer
side, each backing store is assigned an incrementing serial number on
the client side. (This allows us to re-use an already mapped file.)
2021-01-15 13:57:00 +01:00
Andreas Kling
4d97b955e6 LibGfx: Allow creating a Gfx::Bitmap backed by an anonymous file
Gfx::Bitmap::create_with_anon_fd() creates such a Bitmap, and also
optionally takes ownership of the file, making sure to close() it
on destruction.
2021-01-15 13:56:54 +01:00
Andreas Kling
fb4993f067 Kernel: Add anonymous files, created with sys$anon_create()
This patch adds a new AnonymousFile class which is a File backed by
an AnonymousVMObject that can only be mmap'ed and nothing else, really.

I'm hoping that this can become a replacement for shbufs. :^)
2021-01-15 13:56:47 +01:00
Andreas Kling
96f8fcdcba LibGUI: Add a WindowBackingStore class
Instead of storing the back/front buffers of a GUI::Window as just
Gfx::Bitmap, wrap them in a WindowBackingStore class.

This will allow us to add more information alongside the bitmaps while
keeping the back/front swapping logic simple.
2021-01-15 10:54:19 +01:00
Lenny Maiorani
7e71de8f1f Http[s]Protocol: Make the code start_download DRY
Problem:
- `HttpProtocol::start_download` and `HttpsProtocol::start_download`
  implementations are the same except for a few types.

Solution:
- Follow the "Don't Repeat Yourself" mantra and de-duplicate the code
  using templates.
2021-01-15 09:44:21 +01:00
Brendan Coles
a44739473b Tests: Test set uid/gid not dropped upon file rename 2021-01-15 08:24:43 +01:00