Commit Graph

637 Commits

Author SHA1 Message Date
Max Wipfli
9b8f35259c AK: Remove the LexicalPath::is_valid() API
Since this is always set to true on the non-default constructor and
subsequently never modified, it is somewhat pointless. Furthermore,
there are arguably no invalid relative paths.
2021-06-30 11:13:54 +02:00
Adam Hodgen
cd6b9613c5 LibWeb+WebContent: Add IPC flow for Inspect DOM Tree
Add `inspect_dom_tree` to WebContentServer and 'did_get_dom_tree' to
WebContentClient.

These two async methods form a request & response for requesting a JSON
representation of the Content's DOM tree.
2021-06-29 23:06:48 +02:00
Liav A
3d89938c4a SystemServer+Meta: Use the new SysFS
We make SystemServer to mount the new SysFS in /sys.
2021-06-29 20:53:59 +02:00
Tom
85bb13e081 WindowServer: Fix animations not triggering rendering
When starting the first animation and while animations are ongoing we
need to make sure we trigger rendering.
2021-06-29 10:03:53 +02:00
Erik Sommer
b12e5de047 WindowServer: Change animation time to duration
The time interval for animations is most often described as `duration`
in animation contexts and the `WindowServer::Animation` class
should reflect that.
2021-06-28 22:29:39 +02:00
Tom
30f531a55f WindowServer: Fix menu location on screens other than main screen
The menus always thought they were being outside of the main screen,
which caused them to be left and/or top aligned. This also fixes the
calculation of the available space by using the screen rectangle where
it will be displayed.
2021-06-28 17:02:37 +02:00
Tom
a55cf08ef9 WindowServer: Fix regression flushing scaled displays
This accidentally was broken by 38af4c29e
2021-06-28 16:40:15 +02:00
Tom
4c8f7113ff WindowServer: Make vertical maximize work on other screens
This doesn't yet restrict rendering to the screen it's being maximized
on.
2021-06-28 16:40:04 +02:00
Spencer Dixon
cef2f55a8b Taskbar: Move 'Assistant' Desktop::AppFile to member for quicker access
We care about showing 'Assistant' app as fast as possible when the
hotkey is pressed. In order to do that, we can parse the `.af` file
ahead of time and have it ready to use.
2021-06-28 16:29:02 +02:00
Spencer Dixon
b9d1ef99de Assistant+Taskbar: Use AppFile::spawn() utility 2021-06-28 16:29:02 +02:00
Spencer Dixon
cbe67ed665 Taskbar: Open 'Assistant' with Super+Space 2021-06-28 16:29:02 +02:00
Spencer Dixon
4f11138e8e LibGUI+WindowServer: Add new WMEvent Super+Space
To make Assistant useful we need a way to quickly trigger it. I've
added a new specialized event coming from the window server for when a
user is holding down 'Super' and hits 'Space'.

The Taskbar will be able to listen for this event and spawn a new
instance of the Assistant if it's not already running.
2021-06-28 16:29:02 +02:00
Tom
091628202f WindowServer: Un-tile window if resizing warrants it
Since being tiled means we restrict rendering a window to the screen it
is on (so that we don't "bleed" into an adjacent screen), we need to
untile it if the window either can't fit into the screen, or it is
detached from the screen edges.
2021-06-27 22:35:12 +02:00
Andreas Kling
6a132d8672 WindowServer+LibGUI: Allow specifying a "launch origin" for new windows
The launch_origin_rect parameter to create_window() specifies where on
screen the window was launched from. It's optional, but if you provide
it, the new window will have a short wireframe animation from the origin
to the initial window frame rect.

GUI::Window looks for the "__libgui_launch_origin_rect" environment
variable. Put your launch origin rect in there with the format
"<x>,<y>,<width>,<height>" and the first GUI::Window shown by the app
will use that as the launch origin rect.

Also it looks pretty neat, although I'm sure we can improve it. :^)
2021-06-27 19:38:11 +02:00
Andreas Kling
75f870a93f WindowServer: Add a more generic mechanism for animations
This patch adds the WindowServer::Animation class, which represents
a simple animation driven by the compositor.

An animation has a length (in milliseconds) and two hooks:

- on_update: called whenever the animation should render something.
- on_stop: called when the animation is finished and/or stopped.

This patch also ports the window minimization animation to this new
mechanism. :^)
2021-06-27 19:38:11 +02:00
Tom
a9906cfcd1 WindowServer: Try to auto-add unconfigured framebuffer devices
This will try to auto-add framebuffer devices that haven't been
explicitly configured to the right-hand side.
2021-06-27 09:46:27 +02:00
Tom
38af4c29e6 WindowServer: Coalesce flushing buffers into one ioctl() call
We regularily need to flush many rectangles, so instead of making many
expensive ioctl() calls to the framebuffer driver, collect the
rectangles and only make one call. And if we have too many rectangles
then it may be cheaper to just update the entire region, in which case
we simply convert them all into a union and just flush that one
rectangle instead.
2021-06-27 09:46:27 +02:00
Tom
708f27ca0e WindowServer: Use relative coordinates when flushing screen dirty rects
The framebuffer device expects coordinates relative to itself.
2021-06-27 09:46:27 +02:00
Tom
c12cbb96ce WindowServer: Fix geometry label not updating if it isn't moving
This fixes a regression where the geometry label isn't updating even
though the window geometry had changed because the geometry label's
location isn't changing.
2021-06-27 09:37:07 +02:00
Tom
8cfb4c82f0 WindowServer: Change rendering drag&drop to use the Overlay class
This enables flicker-free rendering.
2021-06-25 20:38:13 +02:00
Tom
84cab29c59 WindowServer: Change window geometry label to use the Overlay class
This enables flicker-free rendering.
2021-06-25 20:38:13 +02:00
Tom
41859ad3fe WindowServer: Add an Overlay class for flicker-free overlay rendering
An Overlay is similar to a transparent window, but has less overhead
and does not get rendered within the window stack. Basically, the area
that an Overlay occupies forces transparency rendering for any window
underneath, which allows us to render them flicker-free.

This also adds a new API that allows displaying the screen numbers,
e.g. while the user configures the screen layout in DisplaySettings

Because other things like drag&drop or the window-size label are not
yet converted to use this new mechanism, they will be drawn over the
screen-number currently.
2021-06-25 20:38:13 +02:00
Tom
42cb38b71a WindowServer: Enhance simple shadow function to include optional frame
If the shadow bitmap contains portions of the frame then we need to
slightly tweak the logic dealing with very small width and/or height.
2021-06-25 20:38:13 +02:00
Sahan Fernando
bab6fb76b7 WindowServer: Redraw screen when switching back from tty 2021-06-25 19:26:30 +02:00
Sahan Fernando
974e996d33 Userland: Add FB_FLUSH ioctl for fbdev 2021-06-25 19:26:30 +02:00
Alexander
a2a3f5228a WindowServer: Scale Mouse movements
This fixes a bug where if the current screen was using scaling, the
mouse would be twice as fast as normal.
2021-06-25 01:49:07 +04:30
Daniel Bertalan
f28f00c654 Userland: Disambiguate dependent types
Clang produced an error on these pieces of code without the `typename`
keyword.
2021-06-24 17:35:49 +04:30
Gunnar Beutner
ac650d2362 Userland: Remove dummy IPC methods
They're not used anywhere and are unnecessary boilerplate code. So let's
remove them and update IPCCompiler to allow for empty endpoint
declarations.
2021-06-24 00:38:58 +02:00
Peter Elliott
49539abee0 ChessEngine: don't store board in non-leaf nodes in MCTS
Also make parameters static so they aren't in every node of the tree
this saves a substantial amount of memory.
2021-06-22 23:09:42 +02:00
PAUL007
3d42297ecd Taskbar: Check if executable in .af exist in filesystem
This adds access X_OK check in discover_apps_and_categories()
to see executable specified in .af files exist before
registering them for start menu.
2021-06-22 22:48:32 +02:00
Gunnar Beutner
f1ac0b6a5a WindowServer: Send events once when global cursor tracking is enabled
Previously we'd send mouse events twice if the target window had
global cursor tracking enabled.
2021-06-22 11:00:44 +02:00
bitwitch
7181943d8d LaunchServer: Fix regression in opening files with TextEditor
My previous PR had a small error in rebasing and removed a line in
open_file_url. This caused opening text files from the terminal to
always open with an empty TextEditor.

This commit fixes that problem!
2021-06-22 00:05:51 +02:00
bitwitch
5ac9494483 LaunchServer: Make all file handlers configurable including directories
This commit gets rid of hard coded file handlers in Launcher.cpp in
favor of using values in the LaunchServer.ini config file.

The previous commit adds checks for the existence of handler programs
while registering handlers. This commit takes advantage of that and
ensures that LaunchServer will not attempt to open a file with a
nonexistent program and can properly report failure before spawning a
new child process.

Resolves #8120
2021-06-21 22:30:41 +02:00
bitwitch
f29980a15b LaunchServer: Check if handler programs exist when registering them
This adds checks in load_handlers() and load_config() to see if the
programs specified in the config files exist before registering them as
handlers.

Resolves #8121
2021-06-21 22:30:41 +02:00
Tom
08e2dc22be WindowServer: Fix animated cursor regression 2021-06-21 16:52:29 +02:00
Max Wipfli
ac9003bb70 WindowServer: Focus windows blocked by a modal window
If a window which has an active modal window is focused, the modal
window starts blinking. In this case, the window (and modal) should
still be focused. For this, the order of the checks in
process_mouse_event_for_window has to be changed.

This fixes #8183.
2021-06-21 16:46:01 +02:00
Tom
75dc94064d WindowServer: Reload icons on scale changes
Since MultiScaleBitmaps only loads icons for the scales in use, we need
to unconditionally reload them so that we pick up the correct bitmaps
for a scale that hasn't been previously used.
2021-06-20 14:57:26 +02:00
Tom
14fe7283e1 WindowServer: Update compositor reference to cursor on reload
When we reload a cursor we should make sure the compositor has a
valid reference to the updated cursor.
2021-06-20 14:57:26 +02:00
Tom
f232cb8efe WindowServer: Enable screen capture to span multiple screens
This enables the shot utility to capture all screens or just one, and
enables the Magnifier application to track the mouse cursor across
multiple screens.
2021-06-20 14:57:26 +02:00
Tom
61af9d882e WindowServer: Load multiple scaled versions of Bitmaps and Cursors
This enables rendering of mixed-scale screen layouts with e.g. high
resolution cursors and window button icons on high-dpi screens while
using lower resolution bitmaps on regular screens.
2021-06-20 14:57:26 +02:00
Tom
aa15bf81e4 WindowServer: Add API to set/get screen layouts
This sets the stage so that DisplaySettings can configure the screen
layout and set various screen resolutions in one go. It also allows
for an easy "atomic" revert of the previous settings.
2021-06-20 14:57:26 +02:00
Tom
34394044b3 WindowServer: Validate that all screens can be reached
If there are any screens that are detached from other screens it would
not be possible to get to them using the mouse pointer. Also make sure
that none of the screens are overlapping.
2021-06-20 14:57:26 +02:00
Tom
0547e0329a WindowServer: Fix artifacts after window resize in some cases
We were calculating the old window rectangle after changing window
states that may affect these calculations, which sometimes resulted
in artifacts left on the screen, particularily when tiling a window
as this now also constrains rendering to one screen.

Instead, just calculate the new rectangle and use the window's
occlusion information to figure out what areas need to be invalidated.
2021-06-20 14:57:26 +02:00
Tom
229b541e5d WindowServer: Constrain rendering windows to one screen in some cases
When a window is maximized or tiled then we want to constrain rendering
that window to the screen it's on. This prevents "bleeding" of the
window frame and shadow onto the adjacent screen(s).
2021-06-20 14:57:26 +02:00
Tom
4392da970a WindowServer: Add initial support for rendering on multiple screens
This allows WindowServer to use multiple framebuffer devices and
compose the desktop with any arbitrary layout. Currently, it is assumed
that it is configured contiguous and non-overlapping, but this should
eventually be enforced.

To make rendering efficient, each window now also tracks on which
screens it needs to be rendered. This way we don't have to iterate all
the windows for each screen but instead use the same rendering loop and
then only render to the screen (or screens) that the window actually
uses.
2021-06-20 14:57:26 +02:00
Adam Hodgen
c03a3dc5b7 LaunchServer: Correctly open file URLs with line numbers
PR #5665 updated TextEditor to open files at a specific line/column
location using the file:line:col argument, rather than the -l flag.

This change updates LaunchServer to use that convention, though note it
does only pass the line number and not a column number, as per all
previous behaviour.
2021-06-20 12:07:55 +02:00
Itamar
03ef2a479a LibCoreDump: Include source locations of inlined functions in backtrace 2021-06-19 14:51:18 +02:00
Andreas Kling
de8aa1b17d WindowServer: Move key event handling to its own function
Instead of making WindowManager::event() all about key events.
2021-06-18 18:00:08 +02:00
Andreas Kling
4895f46d8c WindowServer: Make various functions take MouseEvent by const reference
Some paths of the mouse event processing code will upgrade the event
from a regular MouseDown to a MouseDoubleClick. That's why we were
passing `MouseEvent&` everywhere.

For the paths that don't need to do this, passing `MouseEvent const&`
reduces the cognitive burden a bit, so let's do that.
2021-06-18 17:55:41 +02:00
Andreas Kling
82f1ac7390 WindowServer: Don't include frame when determining hovered window
We only consider a window "hovered" if its *content area* is hovered.
2021-06-18 17:40:05 +02:00
Andreas Kling
1537172a6b WindowServer: Simplify handling of the window resize candidate
Always clear the current resize candidate when starting new mouse
event processing (instead of trying to be smart about it.)
2021-06-18 17:40:05 +02:00
Andreas Kling
b5251a70c6 WindowServer: Reorder and annotate the mouse event processing code
Hopefully people can now follow and understand how this works. :^)
2021-06-18 17:40:05 +02:00
Andreas Kling
fa9846ec6f WindowServer: Simplify how we determine the hovered window
Instead of plumbing a Window* through the entire mouse event processing
logic, just do a hit test and say that the window under the cursor is
the hovered window.

It's funny how much easier this is now that we have a way to hit test
the entire window stack with one call.
2021-06-18 17:40:05 +02:00
Andreas Kling
7b3fdd178e WindowServer: Simplify processing of window-specific mouse events
Move the logic for processing a mouse event that hits a specific window
into its own function.

If the window is blocked by a modal child, we now get that out of the
way first, so we don't have to think about it later.
2021-06-18 17:40:05 +02:00
Andreas Kling
2f9e8a982c WindowServer: Unify hit testing between fullscreen/regular windows
Even if a window is in fullscreen mode, we still want hit testing to
walk the window stack. Otherwise child windows of the fullscreen
window will not receive mouse events.
2021-06-18 17:40:05 +02:00
Andreas Kling
09dacf4cd1 WindowServer: Move titlebar button mouse event handling to a function
The button widgets internally rendered by WindowServer are only used
in titlebars, and require a bit of mouse event handling. Instead of
mixing it with the window-oriented mouse event handling, get the
button event stuff out of the way first.
2021-06-18 17:40:05 +02:00
Andreas Kling
5d73e16edf WindowServer: Make deliver_mouse_event() perform coordinate translation
Instead of expecting callers to provide a window-relative position,
just take care of it inside deliver_mouse_event() instead.
2021-06-18 17:40:05 +02:00
Andreas Kling
300711d013 WindowServer: Preserve all members in MouseEvent::translated()
We were forgetting to preserve the m_drag and m_mime_data members of
WindowServer::MouseEvent when making a translated copy.

This didn't affect any reachable code paths before this change.
2021-06-18 17:40:05 +02:00
Andreas Kling
58823c474e WindowServer: Don't let super key open system menu while tracking input
Previously it was possible to open the system menu while tracking mouse
input after a mousedown event.
2021-06-18 17:40:05 +02:00
Andreas Kling
82a945fa7e WindowServer: Always send mouse events to active input tracker first
If a window is currently actively tracking input events (because
sent it a MouseDown and haven't sent it a MouseUp yet), we now simply
send mouse events to that window right away before doing any other
event processing.

This makes it much easier to reason about mouse events.
2021-06-18 17:40:05 +02:00
Andreas Kling
69dad3b996 WindowServer: Remove an unnecessary temporary variable 2021-06-18 17:40:05 +02:00
Andreas Kling
ad828b3cfc WindowServer: Split up WindowFrame::handle_mouse_event()
Break this function into a couple of smaller functions, one for each
of these areas:

- The titlebar
- The titlebar icon
- The menubar
- The border
2021-06-18 17:40:05 +02:00
Andreas Kling
f88361fc28 WindowServer: Add WindowStack::window_at() and use it a bunch
This performs a hit test on the window stack to find the window under
a given cursor position.
2021-06-18 17:40:05 +02:00
Andreas Kling
4133caba78 WindowServer: Make hit test results richer
Instead of just answering hit/no-hit when hit testing windows, we now
return a HitTestResult object which tells you which window was hit,
where it was hit, and whether you hit the frame or the content.
2021-06-18 17:40:05 +02:00
Andreas Kling
370d3749e5 WindowServer: Remove weird feature where Ctrl+Wheel changed opacity
This feature had been there since early on and was not actually useful
for anything. I just added it because it was fun. In retrospect, it's
not a very good feature and I only ever activated it by accident.
2021-06-18 17:40:05 +02:00
Andreas Kling
e4e94cd43d WindowServer: Allow each WindowStack to have an active window
A window with an inner stack needs to keep track of which inner window
is active.
2021-06-18 17:40:05 +02:00
Andreas Kling
2b0e0b602c WindowServer: Keep track of which WindowStack a Window is part of
Each Window now knows which WindowStack it's part of. We call this the
Window::outer_stack(), in preparation for supporting inner stacks. :^)
2021-06-18 17:40:05 +02:00
Andreas Kling
d0bc3d6002 WindowServer: Convert WindowManager to east-const style 2021-06-18 17:40:05 +02:00
Andreas Kling
d257f58306 WindowServer: Add WindowStack concept
This patch moves the window stack out of WindowManager and into its own
WindowStack class.

A WindowStack is an ordered list of windows with an optional highlight
window. The highlight window mechanism is used during Super+Tab window
switching to temporarily bring a window to the front.

This is mostly mechanical, just moving the code to its own class.
2021-06-18 17:40:05 +02:00
Gunnar Beutner
631d36fd98 Everywhere: Add component declarations
This adds component declarations so that users can select to not build
certain parts of the OS.
2021-06-17 11:03:51 +02:00
Gunnar Beutner
0ca5a393d1 SystemServer: Improve error message when execv() fails
Previously perror() would just tell us that the file specified
for execv() doesn't exist.
2021-06-17 11:03:51 +02:00
Andreas Kling
88b168ff16 WindowServer: Simplify WindowFrame shadow logic a little bit
Remove the confusingly-named inflate_for_shadow() function and inline
its logic into render_to_cache(). And remove the m_shadow_offset
member variable since it was only needed locally in one place.

Also improve some variable names to make it more understandable what
is going on.
2021-06-16 21:53:10 +02:00
Andreas Kling
d924d93fa2 WindowServer: Fix unnecessary local variable shadowing in WindowFrame 2021-06-16 21:53:10 +02:00
Gunnar Beutner
f589acaac9 AudioServer: Put the m_zero_filled_buffer variable into the .bss segment
This way we don't have to allocate this at runtime. I'm intentionally
not using static constexpr here because that would put the variable
into the .rodata segment and would therefore increase the binary by
4kB.

The old code also failed to free() the buffer in the destructor, however
that wasn't much of an issue because the Mixer object exists throughout
the program's entire lifetime.
2021-06-16 20:07:37 +02:00
Brian Gianforcaro
8f1e7c5a72 WindowServer: Remove unused AK::InlineLinkedList header includes 2021-06-16 10:40:01 +02:00
Sreelakshmi
aa68c12cfc WindowManager: Close tooltip child_windows of previously active window
This closes the autocomplete_box used in applications like GML
Playground and HackStudio when the user switches focus to a new window.
2021-06-12 23:54:08 +04:30
Andreas Kling
dc65f54c06 AK: Rename Vector::append(Vector) => Vector::extend(Vector)
Let's make it a bit more clear when we're appending the elements from
one vector to the end of another vector.
2021-06-12 13:24:45 +02:00
Andreas Kling
0a98964600 WindowServer+LibGUI: Make window creation asynchronous :^)
Let clients manage their own window ID's. If you try to create a new
window with an existing ID, WindowServer will simply disconnect you
for misbehaving.

This removes the need for window creation to be synchronous, which
means that most GUI applications can now batch their entire GUI
initialization sequence without having to block waiting for responses.
2021-06-12 12:01:54 +02:00
Max Wipfli
79a47d9bd3 WebServer: Add support for HTTP basic authentication
This enables the WebServer to run protected by a username and password.
While it isn't possible to access such a protected server from inside
Serenity as of now (because neither the Browser nor pro(1) support
this), this may very well be the case in the future. :^)
2021-06-11 11:37:15 +02:00
Max Wipfli
e77ca79897 WebServer: Move server configuration into WebServer::Configuration
This moves the configuration of the web server, which currently only
consists of the root path, into a new class, Configuration. Since the
configuration is global and not per client, it is accessed by a
singleton getter.

This change simplifies future extensions of the configurable parameters.
2021-06-11 11:37:15 +02:00
Max Wipfli
2d18d3f329 WebServer: Use canonical reasons phrases for error responses
This changes the Client::set_error_response() to not take a "message"
anymore. It now uses the canonical reason phrase which is derived from
the response code.
2021-06-11 11:37:15 +02:00
Max Wipfli
977b3509f2 WebServer: Sort entries in directory listing 2021-06-11 11:37:15 +02:00
Max Wipfli
2c5a8462ec WebServer: Append trailing slash for directory links
This adds trailing slashes to all links to directories (when listing the
directory contents). This avoids the redirect that would otherwise
happen when browsing to those directories.
2021-06-11 11:37:15 +02:00
Max Wipfli
e4f3a5fe37 WebServer: Make ".." equal to "." in server root directory
In the web server root directory, ".." has to be handled specially,
since everything above it does not exist from the point of view of the
user. The most sensible thing to do is to make ".." equal to ".". This
is also what ls(1) does for "/" and what "http://localhost/../"
evaluates to.

This also fixes a bug where stat() would fail on the directory above the
root directory, since it hasn't been unveiled for the process.
2021-06-11 11:37:15 +02:00
Max Wipfli
450a24c8c9 WebServer: Refuse to respond to requests for device files
Responding with some device files such as /dev/random never terminates,
so let's just refuse that.
2021-06-11 11:37:15 +02:00
Max Wipfli
eb6adbabef WebServer: Use outln() instead of printf() 2021-06-11 11:37:15 +02:00
Max Wipfli
6e6ff844d3 WebServer: Defer invocation of Client::remove_from_parent()
This is necessary to avoid trying to destruct the on_ready_to_read
function from inside the function. This fixes #7810.
2021-06-11 11:37:15 +02:00
Max Wipfli
5408111aff WebServer: Use east const style in Client.{cpp,h}
This also removes two unused headers.
2021-06-11 11:37:15 +02:00
Marcus Nilsson
2f7dc29ab7 LibGUI/WindowServer: Add set_maximized IPC call
Add an IPC call to enable the client to manually maximize it's own
window.
2021-06-09 22:58:10 +02:00
Max Wipfli
4efccbd030 LookupServer: Watch /etc/hosts for changes during runtime
This adds a FileWatcher to the LookupServer which watches '/etc/hosts'
for changes during runtime and reloads its contents. If the file is
deleted, m_etc_hosts will be cleared.

Since we now need to access '/etc/hosts' later during runtime, it needs
to be unveiled with read permissions.
2021-06-09 17:43:32 +04:30
Max Wipfli
7b39db3bf4 LookupServer: Check for hostname after /etc/hosts
If the hostname is not in /etc/hosts, looking it up should return
127.0.0.1.
2021-06-09 17:43:32 +04:30
Max Wipfli
12feb79cef LookupServer: Make DNSName::operator== ignore case 2021-06-09 17:43:32 +04:30
Max Wipfli
95d4d36b5c LookupServer: Modernize load_etc_hosts()
This reworks the LookupServer::load_etc_hosts() method to use the
IPv4Address APIs instead of trying to parse an IPv4 address itself.

It also adds a few error checks for invalid entries in /etc/hosts,
trims away leading and trailing whitespace from lines and tries to use
StringView over String.
2021-06-09 17:43:32 +04:30
Ali Mohammad Pur
7ac196974d Everywhere: Replace Vector<T*> with nonnull entries with Vector<T&> 2021-06-08 19:14:24 +02:00
Andreas Kling
cb295ab644 WindowServer+Magnifier: Make Magnifier buttery smooth :^)
This patch moves the magnifier rect computation over to the server side
to ensure that the mouse cursor position and the screen image never get
out of sync.
2021-06-07 10:22:25 +02:00
Andreas Kling
4c47b3951d Clipboard: Tighten pledge promises a bit earlier :^) 2021-06-06 17:56:34 +02:00
Eugene Barnett
4ef85de9dc WindowServer: Add a GetDesktopDisplayScale IPC request
Tells you which scale factor is configured in window manager.
2021-06-06 15:56:43 +02:00
Tom
2c8309c841 WindowServer: Simplify determining transparent/opaque occlusions
By moving the logic to determine what window areas (shadow, frame,
content) into WindowFrame::opaque/transparent_render_rects we can
simplify the occlusion calculation and properly handle more
arbitrary opaque/transparent areas.

This also solves the problem where we would render the entire
window frame as transparency only because the frame had a window
shadow.
2021-06-06 09:37:27 +01:00
Ali Mohammad Pur
51c2c69357 AK+Everywhere: Disallow constructing Functions from incompatible types
Previously, AK::Function would accept _any_ callable type, and try to
call it when called, first with the given set of arguments, then with
zero arguments, and if all of those failed, it would simply not call the
function and **return a value-constructed Out type**.
This lead to many, many, many hard to debug situations when someone
forgot a `const` in their lambda argument types, and many cases of
people taking zero arguments in their lambdas to ignore them.
This commit reworks the Function interface to not include any such
surprising behaviour, if your function instance is not callable with
the declared argument set of the Function, it can simply not be
assigned to that Function instance, end of story.
2021-06-06 00:27:30 +04:30
Gunnar Beutner
d840608a51 Taskbar: Make sure LibGUI/Desktop.h is usable in ports
Now that Desktop.h includes Services/Taskbar/TaskbarWindow.h we have
to install Taskbar's header files so that Desktop.h can be used in
ports or when building software in-target.
2021-06-04 19:11:13 +02:00
Gunnar Beutner
19c4e74f70 Taskbar: Allow creating menus for sub-categories
This change allows creating sub-categories in app files, e.g. with
Category=Games/Puzzles.
2021-06-04 09:38:25 +02:00
Max Wipfli
bc8d16ad28 Everywhere: Replace ctype.h to avoid narrowing conversions
This replaces ctype.h with CharacterType.h everywhere I could find
issues with narrowing conversions. While using it will probably make
sense almost everywhere in the future, the most critical places should
have been addressed.
2021-06-03 13:31:46 +02:00
Brian Gianforcaro
d0dbb014a0 WindowServer: Switch Window to IntrusiveList from InlineLinkedList
Another small step towards unifying IntrusiveList / InlineLinkedList.
2021-06-03 13:27:40 +02:00
Matthew Jones
0ff09d4f74 WindowServer: Add sanity checks to create_window IPC 2021-06-03 08:27:57 +02:00
Matthew Jones
b0682a73ee WindowServer: Position popup menu with offset of 1 pixel 2021-06-03 08:21:01 +02:00
Matthew Jones
ea4116f5bd LibGUI+LibGfx+WindowServer: Sanity check window size dimensions
Previous to this commit, if a `Window` wanted to set its width or height
greater than `INT16_MAX` (32768), both the application owning the Window
and the WindowServer would crash.

The root of this issue is that `size_would_overflow` check in `Bitmap`
has checks for `INT16_MAX`, and `Window.cpp:786` that is called by
`Gfx::Bitmap::create_with_anonymous_buffer` would get null back, then
causing a chain of events resulting in crashes.

Crashes can still occur but with `VERIFY` and `did_misbehave` the
causes of the crash can be more readily identified.
2021-06-02 23:59:57 +01:00
Gunnar Beutner
b5778675a5 WindowServer: Use RefPtr instead of raw pointers
Now that we have static initializers and destructors we can use
RefPtr here.
2021-06-02 18:08:11 +02:00
Matthew Jones
00c8b74ab4 InspectorServer: Add is_inspectable IPC 2021-06-02 11:19:04 +02:00
Gunnar Beutner
cdb070cdfb WindowServer: Don't crash when we can't allocate a bitmap
When the client specifies an absurdly large window size
render_to_cache() fails to allocate a bitmap and crashes.

Refs #7688.
2021-06-02 10:17:42 +01:00
Matthew Jones
33eb9a6ddc WindowServer: Use user-defined background color, if defined
Use the configured desktop background color, if defined, otherwise
default to the current theme's background color. If a user chooses
a background color via "desktop settings", then this new color
will always be used.

Switching themes will delete the user-defined background color, so
the background color resets to the theme's defined color.
2021-06-02 09:40:53 +02:00
Gunnar Beutner
5b86a8bad1 InspectorServer: Remove extraneous curly brackets 2021-06-01 23:36:44 +04:30
Max Wipfli
a603e69599 AK+Everywhere: Replace usages of URLParser::urlencode() and urldecode()
This replaces all occurrences of those functions with the newly
implemented functions URL::percent_encode() and URL::percent_decode().
The old functions will be removed in a further commit.
2021-06-01 09:28:05 +02:00
Edwin Hoksberg
e68780e1ad WebServer: Put dbgln's behind WEBSERVER_DEBUG
These dbgln's caused excessive load in the WebServer process,
accounting for ~67% of the processing time when serving a webpage
with a bunch of resources like serenityos.org/happy/2nd/.
2021-05-30 17:41:56 +01:00
Linus Groh
75ea1bd346 WebServer: Exit when the given port is invalid
Similar to an invalid listen address, we should not fallback to the
default port (8000) but instead exit with an error.
2021-05-30 14:11:53 +01:00
Linus Groh
7fa3033ca8 WebServer: Replace printf()/fprintf(stderr) with outln()/warnln() 2021-05-30 14:07:58 +01:00
Edwin Hoksberg
2deffeb74d WebServer: Add optional listen address argument
With this we can make the Webserver listen on
another address than the default of "0.0.0.0".
2021-05-30 13:03:59 +01:00
Andreas Kling
4190fd2199 LibWeb: Rename Web::Frame to Web::BrowsingContext
Our "frame" concept very closely matches what the web specs call a
"browsing context", so let's rename it to that. :^)

The "main frame" becomes the "top-level browsing context",
and "sub-frames" are now "nested browsing contexts".
2021-05-30 12:39:53 +02:00
Andrew Kaster
1a0eed705c DHCPClient: Avoid unaligned access when parsing options
Just casting a void* to a T* and dereferencing it is not particularly
safe. Also UBSAN was complaining. Use memcpy into a default constructed
T instead and require that the T be trivially copyable.
2021-05-27 15:18:03 +02:00
Gunnar Beutner
e17a5dc2b9 DHCPClient: Rename struct members for InterfaceDescriptor
Public members shouldn't have an "m_" prefix.
2021-05-27 15:53:49 +04:30
Gunnar Beutner
106def9de7 DHCPClient: Remove unused #includes 2021-05-27 15:53:49 +04:30
Gunnar Beutner
c73116b2e2 DHCPClient: Resend DHCP packets when we don't receive an answer
Previously we'd only only send one DHCP request for network interfaces
which were up when DHCPClient started. If that packet was lost we'd
never send another request for those interfaces.

Also, if an interface were to appear after DHCPClient started (not
that that is possible at the moment) we wouldn't send requests for
that interface either.
2021-05-27 15:53:49 +04:30
Jean-Baptiste Boric
e4394b1605 LibGfx: Use anonymous buffer instead of raw anon_fd for Gfx::Bitmap
Instead of using a low-level, proprietary API inside LibGfx, let's use
Core::AnonymousBuffer which already abstracts anon_fd and offers a
higher-level API too.
2021-05-24 13:31:01 +02:00
Jean-Baptiste Boric
8e6241b78b LookupServer: Fix missing POSIX includes 2021-05-23 18:10:29 +02:00
Jean-Baptiste Boric
5ced9a3dfb ImageDecoder: Fix narrowing cast of loop count 2021-05-23 18:10:29 +02:00
Andreas Kling
67b47d62f3 WebContent: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
6b2f24018d RequestServer: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
bf33b5df6e WebSocket: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
03df8882df InspectorServer: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
78b57fcea3 NotificationServer: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
5424372d50 AudioServer: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
e7fc46879e LaunchServer: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
de07dab184 ImageDecoder: Remove unnecessary greet() message
This didn't do anything except induce an IPC stall during startup.
2021-05-23 09:53:55 +02:00
Andreas Kling
c9e849a968 LibCore: Make all processes opt out of InspectorServer by default
This functionality, while neat, isn't really something you need enabled
all the time. Let's make it opt-in instead. Pass MakeInspectable::Yes
to the Core::EventLoop constructor if you want your program to become
inspectable.
2021-05-22 23:30:40 +02:00
Andreas Kling
b5d73c834f Userland: Rename LibThread => LibThreading
Also rename the "LibThread" namespace to "Threading"
2021-05-22 18:54:22 +02:00
Andreas Kling
9c2786b872 Userland: Remove SymbolServer and the "symbol" user+group 2021-05-22 18:54:22 +02:00
Andreas Kling
636c43db6c WindowServer: Notify window-less clients about theme/font changes 2021-05-22 10:21:52 +02:00
Andreas Kling
59fd1f40ce WindowServer: Store system font queries in WindowServer.ini :^)
Changes to the system font settings are now persisted in /etc.
Note that you still need to restart the system for changes to fully
apply in all programs.
2021-05-21 20:15:51 +02:00
Andreas Kling
c778130d63 WindowServer+LibGUI: Add an IPC API to change the current system fonts
This patch adds a set_system_fonts() IPC API that takes the two main
font queries as parameters. We'll probably expand this with additional
queries when we figure out what they should be.

Note that changing the system fonts on a live system mostly takes
effect in newly launched programs. This is because GUI::Widget will
currently cache a pointer to the Gfx::FontDatabase::default_font()
when first constructed. This is something we'll have to fix somehow.

Also note that the settings are not yet persisted.
2021-05-21 20:15:51 +02:00
Andreas Kling
bb23e61fbf LibGfx+WindowServer: Have WindowServer broadcast system font settings
Instead of everybody getting their system fonts from Gfx::FontDatabase
(where it's all hardcoded), they now get it from WindowServer.

These are then plumbed into the usual Gfx::FontDatabase places so that
the old default_font() and default_fixed_width_font() APIs keep working.
2021-05-21 20:15:51 +02:00
Linus Groh
d60ebbbba6 Revert "Userland: static vs non-static constexpr variables"
This reverts commit 800ea8ea96.

Booting the system no longer worked after these changes.
2021-05-21 10:30:52 +01:00
Lenny Maiorani
800ea8ea96 Userland: static vs non-static constexpr variables
Problem:
- `static` variables consume memory and sometimes are less
  optimizable.
- `static const` variables can be `constexpr`, usually.
- `static` function-local variables require an initialization check
  every time the function is run.

Solution:
- If a global `static` variable is only used in a single function then
  move it into the function and make it non-`static` and `constexpr`.
- Make all global `static` variables `constexpr` instead of `const`.
- Change function-local `static const[expr]` variables to be just
  `constexpr`.
2021-05-21 10:07:06 +01:00
Andreas Kling
e95e64972c Clipboard+LibGUI: Remove unnecessary client/server greeting message 2021-05-20 22:12:42 +02:00
Andreas Kling
ec8363aec3 WindowServer+LibGUI: Make client/server greeting faster
Instead of doing a full IPC round-trip for the client and server to
greet each other upon connecting, the server now automatically sends
a "fast_greet" message when a client connects.

The client simply waits for that message to arrive before proceeding.
(Waiting is necessary since LibGUI relies on the palette information
included in the greeting.)
2021-05-20 22:12:42 +02:00
Andreas Kling
6a012ad79f LibGfx: Remove Gfx::FontDatabase::default_bold_font()
Instead use default_font().bold_variant() in cases where we want a bold
variant of the default font. :^)
2021-05-20 20:55:29 +02:00
Andreas Kling
93ef661914 WindowServer+DisplaySettings: Remove the weird "simple" wallpaper mode
Painting the wallpaper at 100% scale in the top left corner is a weird
mode and I don't think we need it. :^)
2021-05-20 17:52:38 +02:00
Linus Groh
36e7733dec CrashDaemon: Fix CrashReporter argument order
For compressed coredumps, CrashReporter's argv were in this order:

    CrashReporter path --unlink

Core::ArgsParser doesn't like that at all and would immediately exit
from main(), causing the crash reporter to never display.
2021-05-18 23:42:02 +01:00
DexesTTP
9f42ccd639 WebServer: Fix jailbreaking of server via .. relative paths
The recent patch to LexicalPath allowed relative paths like ../ to work
in requests to WebServer. This wasn't too dangerous because of unveil,
but let's still fix this :^)
2021-05-18 09:32:10 +02:00
Andreas Kling
5f342c41b9 WindowServer: Don't attempt to make WindowServer inspectable 2021-05-17 23:32:37 +02:00
Andreas Kling
5d0c3bd564 WindowServer: Add Menu::is_open() to improve readability
"menu.is_open()" instead of "MenuManager::the().is_open(menu)"
2021-05-17 23:28:15 +02:00
Gunnar Beutner
8c96640157 WebServer: Set no-cache header for responses
This sets the Pragma: no-cache header. Using Cache-Control would be
preferable but that's not part of the HTTP/1.0 standard.
2021-05-17 21:28:34 +02:00