Commit Graph

16104 Commits

Author SHA1 Message Date
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
1ccc2e6482 Kernel: Store process arguments and environment in coredumps
Currently they're only pushed onto the stack but not easily accessible
from the Process class, so this adds a Vector<String> for both.
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
057ae36e32 Kernel: Prevent threads from being destructed between die() and finalize()
Killing remaining threads already happens in Process::die(), but
coredumps are only written in Process::finalize(). We need to keep a
reference to each of those threads to prevent them from being destructed
between those two functions, otherwise coredumps will only ever contain
information about the last remaining thread.

Fixes the underlying problem of #4778, though the UI will need
refinements to not show every thread's backtrace mashed together.
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
Linus Groh
7ad9b116f7 AK: Add String::join() helper function
This is a simple wrapper around StringBuilder::join().
2021-01-15 23:26:47 +01:00
Linus Groh
e83799dc02 AK: Add JsonArray(const Vector<T>) constructor
This simplifies creating a JsonArray from a Vector<T> (when there's a
JsonValue(T) constructor overload for T, that is).
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
Ben Wiederhake
b3d04b3a3c Documentation: Make serenity.includes more easily copyable 2021-01-15 21:51:19 +01:00
Ben Wiederhake
7562cf5157 Documentation: Recommend ninja by default 2021-01-15 21:51:19 +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
ddd0c1dd8b Base: Add manpage entry for history events 2021-01-15 19:13:03 +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
Andreas Kling
64b0d89335 Kernel: Make Process::allocate_region*() return KResultOr<Region*>
This allows region allocation to return specific errors and we don't
have to assume every failure is an ENOMEM.
2021-01-15 19:10:30 +01:00
Andreas Kling
7899e14e72 Kernel: Make sys$anon_create() require the "stdio" promise if pledged 2021-01-15 19:10:30 +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
a525d0271c Kernel: Fix bogus negation of alloc_fd() error in sys$anon_create()
Thanks to Idan for spotting this!
2021-01-15 15:13:48 +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
Lenny Maiorani
6d6b3f9523 Badge: Access to underlying type
Problem:
- Access to the underlying type is not provided. This limits
  metaprogramming and usage in function templates.

Solution:
- Provide public access to the underlying type.
- Add test to ensure the underlying type is accessible.
2021-01-15 09:44:21 +01:00