Commit Graph

779 Commits

Author SHA1 Message Date
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
Gunnar Beutner
7aca2d181a WebServer: Don't read until EOF
There's no guarantee that the client has closed the socket for
writing. Instead we should just read until the first empty line.

Fixes #7064.
2021-05-17 21:28:34 +02:00
Andreas Kling
7e799529b9 WindowServer+LibGUI: Make menubar allocation asynchronous
Same as with menu allocation, move menubar ID management to the client
side, removing more IPC stalls during application startup.
2021-05-17 13:33:41 +02:00
Andreas Kling
baab0a5bef WindowServer+LibGUI: Make menu allocation asynchronous
This was only synchronous since WindowServer managed the ID allocation.
Doing this on the client side instead allows us to make create_menu()
an asynchronous IPC call, removing a bunch of IPC stalls during
application startup.
2021-05-17 13:33:41 +02:00
Andreas Kling
2083d1a3d6 WindowServer: Ignore window base size in aspect ratio enforcement
This makes windows with an aspect ratio behave more naturally if they
also have a base size (e.g from the main widget being a GUI::Frame.)
2021-05-17 12:01:17 +02:00
Andreas Kling
00fa5dc53e Taskbar: Make shutdown dialog non-resizable and tweak button spacing 2021-05-16 21:23:31 +02:00
Andreas Kling
f34a3b9521 Taskbar: Give the shutdown dialog a UI facelift :^) 2021-05-16 20:57:45 +02:00
Liav A
20743e8aed Kernel/Graphics + SystemServer: Support text mode properly
As we removed the support of VBE modesetting that was done by GRUB early
on boot, we need to determine if we can modeset the resolution with our
drivers, and if not, we should enable text mode and ensure that
SystemServer knows about it too.

Also, SystemServer should first check if there's a framebuffer device
node, which is an indication that text mode was not even if it was
requested. Then, if it doesn't find it, it should check what boot_mode
argument the user specified (in case it's self-test). This way if we
try to use bochs-display device (which is not VGA compatible) and
request a text mode, it will not honor the request and will continue
with graphical mode.

Also try to print critical messages with mininum memory allocations
possible.

In LibVT, We make the implementation flexible for kernel-specific
methods that are implemented in ConsoleImpl class.
2021-05-16 19:58:33 +02:00
Gunnar Beutner
53d0150827 AK+Userland: Remove nullability feature for the ByteBuffer type
Nobody seems to use this particular feature, in fact there were some
bugs which were uncovered by removing operator bool.
2021-05-16 17:49:42 +02:00
Gunnar Beutner
f0fa51773a AK+Userland: Fix some compiler warnings and make variables const-ref
This fixes a few compiler warnings and makes some variables const-ref
in preparation for the next commit which changes how ByteBuffer works.
2021-05-16 17:49:42 +02:00
Jean-Baptiste Boric
e16894af5a LibC: Do not include errno.h inside unistd.h
POSIX does not mandate this, therefore let's not do it.
2021-05-14 22:24:02 +02:00
Jean-Baptiste Boric
090936e424 Userland: Replace arc4random() with get_random<u32>() 2021-05-14 22:24:02 +02:00
Jean-Baptiste Boric
5a0468c21f Userland: Migrate from arc4random_uniform() to get_random_uniform() 2021-05-14 22:24:02 +02:00
Andreas Kling
339b368308 InspectorServer: Add another missing <AK/JsonObject.h> include 2021-05-13 23:56:25 +02:00
Andreas Kling
9b765b42e4 InspectorServer: Add missing <AK/JsonObject.h> include 2021-05-13 23:44:48 +02:00
Andreas Kling
31d4bcf5bf Userland: Tighten a *lot* of pledges! :^)
Since applications using Core::EventLoop no longer need to create a
socket in /tmp/rpc/, and also don't need to listen for incoming
connections on this socket, we can remove a whole bunch of pledges!
2021-05-13 23:28:40 +02:00
Andreas Kling
04d78adaf7 Userland: Remove no-longer-needed unveil()'s of /tmp/rpc 2021-05-13 23:28:40 +02:00
Andreas Kling
a03879f8dd SystemServer: Stop creating the /tmp/rpc directory
This is no longer needed.
2021-05-13 23:28:40 +02:00
Andreas Kling
3d3a5b431f Services: Add InspectorServer to reverse the direction of Inspector
This service daemon will act as an intermediary between the Inspector
program and the inspectable programs it wants to inspect.

Programs can make themselves available for inspection by connecting
to /tmp/portal/inspectables using the Core::EventLoop RPC protocol.
2021-05-13 23:28:40 +02:00
Andreas Kling
c784413cd9 SymbolServer: Remove two unnecessary #include statements 2021-05-13 23:28:40 +02:00
Linus Groh
9a27ef6523 WindowServer: Re-render window frame when setting unresponsive status
Otherwise "(not responding)" would not appear in the window title until
the window is moved/resized.
2021-05-12 22:51:56 +01:00
sin-ack
2159f90e00 Userland+LibCore: Update FileWatcher + its users for InodeWatcher 2.0
With the new InodeWatcher API, the old style of creating a watcher per
inode will no longer work.  Therefore the FileWatcher API has been
updated to support multiple watches, and its users have also been
refactored to the new style.  At the moment, all operations done on a
(Blocking)FileWatcher return Result objects, however, this may be
changed in the future if it becomes too obnoxious. :^)

Co-authored-by: Gunnar Beutner <gunnar@beutner.name>
2021-05-12 22:38:20 +02:00
Ali Mohammad Pur
a91a49337c LibCore+Everywhere: Move OpenMode out of IODevice
...and make it an enum class so people don't omit "OpenMode".
2021-05-12 11:00:45 +01:00
Valtteri Koskivuori
4864ef9440 WindowServer: Add Optional<Gfx::IntRect> argument to get_screen_bitmap()
This way, we can optionally specify a region of the display to capture.
Defaults to entire screen if no rectangle is given.
2021-05-11 10:18:29 +01:00
Gunnar Beutner
212cd9d8ac LookupServer: Do cache eviction when mDNS cache flush bit is set 2021-05-10 17:26:17 +02:00
Gunnar Beutner
edb21e02ea LookupServer: Track the receive timestamp for DNS answers 2021-05-10 17:26:17 +02:00
Gunnar Beutner
3304d675e1 LookupServer: Correct some flags for DNS packets
This corrects some of the flags in the DNS packets to match
what I saw on my local network.
2021-05-10 17:26:17 +02:00
Gunnar Beutner
a569381037 LookupServer: Handle DNS record types TXT, AAAA, SRV and CNAME
They're not being used elsewhere at the moment but this gets
rid of the debug message for incoming mDNS response packets.
2021-05-10 17:26:17 +02:00
Gunnar Beutner
7b3bed7910 LookupServer: Turn #defines into enum classes and add formatter 2021-05-10 17:26:17 +02:00
Gunnar Beutner
6e70888315 LookupServer: Split mDNS flags into separate field 2021-05-10 17:26:17 +02:00
Andreas Kling
29fe4a5de5 RequestServer: Make the certificate_requested IPC call asynchronous
It was already being used asynchronously inside RequestServer anyway.
2021-05-10 12:38:23 +02:00
Andreas Kling
455afd32f2 Clipboard+LibGUI: Make set_clipboard_data asynchronous
There's no need for GUI applications to block after the clipping is
already in flight.
2021-05-10 12:30:41 +02:00
Andreas Kling
bfeacb5728 WindowServer+Taskbar: Make all the IPC used by Taskbar asynchronous 2021-05-10 12:26:35 +02:00
Andreas Kling
11dc790d69 WindowServer: Make set_background_color and set_wallpaper_mode async
Both of these were already used asynchonrously by GUI::Desktop.
2021-05-10 12:21:42 +02:00
Andreas Kling
b8411d1ef6 WindowServer: Make dismiss_menu() an asynchronous IPC call
This was already being used asynchronously by LibGUI, which meant that
WindowServer would generate a response, and the client would ignore it.
2021-05-10 12:20:28 +02:00
Andreas Kling
f556bd1045 WindowServer: Make popup_menu() an asynchronous IPC call
This was already being used asynchronously by LibGUI, which meant that
WindowServer would generate a response, and the client would ignore it.

This patch simplifies the WindowServer side so it no longer generates
the unnecessary response.
2021-05-10 12:20:28 +02:00
Andreas Kling
8684fca9df WindowServer+LibGUI: Make "move window to front" asynchronous 2021-05-10 12:20:28 +02:00
Andreas Kling
fb93535419 WindowServer+LibGUI: Make menu and menubar teardown asynchronous
Clients don't need to wait for WindowServer to tear down a menu or
menubar before continuing.
2021-05-10 11:53:26 +02:00
Andreas Kling
634e652b6c WindowServer: Add "Move" action to window menus
This can be used to initiate a window move. It's only enabled while
the window is normal (not minimized, maximized or fullscreen.)
2021-05-10 09:06:37 +02:00
Andreas Kling
2bc3cc4cab WindowServer: Add separator above "Close" in window menus 2021-05-10 08:43:44 +02:00
Andreas Kling
353a831c8c WindowServer: Compute final window title before passing to WM clients
We were not substituting the window modified marker ("[*]") in the
title strings we were sending to WM clients. This caused the Taskbar
to show pre-substitution window titles for the Text Editor application.

This patch moves the window title resolution to Window::compute_title()
which is then used throughout.
2021-05-10 00:02:05 +02:00
Andreas Kling
1f24ab91f2 WindowServer: Notify WM clients when a window's modified state changes
Also update the window switcher for good measure. The window switcher
doesn't visualize this information at the moment, but we generally do
this when any window state changes.
2021-05-09 23:59:35 +02:00
Andreas Kling
a47d576e94 WindowServer: Tweak width/height of automatic window tile rects
The resulting window rects when snapping to some edges/corners were
a bit lopsided. This patch makes them symmetrical. :^)
2021-05-09 21:48:38 +02:00
Andreas Kling
5497b7a718 WindowServer: Tweak spacing above maximized windows
Nudge maximized windows 1px upwards. This prevents the outer window
border from showing up above the title bar.
2021-05-09 21:48:38 +02:00
Andreas Kling
5aa9f128fc WindowServer: Simplify the way we update items in the window menu
Instead of trying to update only the little bit that changes, let's
have a function that updates all the window menu items in one go.

It's just a couple of string and boolean assignment, and the real
cost is performing the subsequent menu redraw, which remains the same.
2021-05-09 21:48:38 +02:00
Ömer Kurttekin
d922c2f5f3
Userland: Preserve keyboard mapping preference on reboot (#6955) 2021-05-09 15:56:03 +02:00
Andreas Kling
c53e937014 WindowServer: Constrain popup menu Y position within screen rect
This fixes an issue where large popup menus would open upwards despite
there not being enough space for that.
2021-05-09 15:47:21 +02:00
Andreas Kling
4c6e3d0c59 WindowServer: Fix a handful of clang-tidy warnings in the menu code
Some avoidable signed/unsigned mismatch, String move construction,
and functions that can be static constexpr.
2021-05-09 15:47:21 +02:00
Eric Butler
5d14636b95 WindowServer: Open window menu on Alt+Space
Adds a keyboard shortcut Alt+Space that opens the window menu.
2021-05-09 15:38:32 +02:00
Eric Butler
967cd6afd2 WindowServer: Select last menu item when up key pressed if no selection
When a menu is first opened and has no selected item, pressing the "up"
key now selects the last menu item instead of the first.
2021-05-09 15:38:32 +02:00
Andreas Kling
5007d7bb38 WindowServer: Don't ignore MouseMove events for pressed window buttons
Without this change, window buttons would get stuck in the "pressed"
state as long as the left mouse button was pressed, even if you moved
the mouse cursor out of the button rect.
2021-05-09 10:34:40 +02:00
Andreas Kling
9d8aa2a57a Taskbar+LibGUI+WindowServer: Shrink taskbar by one pixel
Make the taskbar 27 pixels tall instead of 28. This makes the button
icons and applets vertically centered.

On a related note, this required touching *way* too many places..
2021-05-09 00:11:37 +02:00
Itamar
8a01167c7d AK: Add missing GenericTraits<NonnullRefPtr>
This enables us to use keys of type NonnullRefPtr in HashMaps and
HashTables.

This commit also includes fixes in various places that used
HashMap<T, NonnullRefPtr<U>>::get() and expected to get an
Optional<NonnullRefPtr<U>> and now get an Optional<U*>.
2021-05-08 18:10:56 +02:00
Andreas Kling
f0687dbbb7 Services: Convert StringBuilder::appendf() => AK::Format 2021-05-07 21:12:09 +02:00
Andreas Kling
6024617df3 LookupServer: Remove some unnecessary "rc" temporaries 2021-05-06 13:37:46 +02:00
Andreas Kling
f0629e29c9 LookupServer: Check the return value after calling unveil() 2021-05-06 13:34:36 +02:00
Andreas Kling
f3091d89aa WindowServer: Don't let clients start resize of non-resizable windows
This came up in #6886. If resizing has been disabled for a window,
we shouldn't let clients bypass this via start_window_resize().
2021-05-06 12:09:03 +02:00
Gunnar Beutner
6e101adc28 DHCPClient: Handle invalid DHCP responses more gracefully 2021-05-06 08:49:35 +02:00
Sergey Bugaev
bb06e720de LookupServer: Implement basic mDNS support :^)
The implementation is extremely basic, and is far from fully conforming
to the spec. Among other things, it does not really work in case there
are multiple network adapters.

Nevertheless, it works quite well for the simple case! You can now do
this on your host machine:

$ ping courage.local

and same on your Serenity box:

$ ping host-machine-name.local
2021-05-05 21:16:17 +02:00
Sergey Bugaev
fd76e07399 LookupServer: Implement DNSName::operator==() 2021-05-05 21:16:17 +02:00
Gunnar Beutner
a3baf06549 WindowServer: Ignore mouse clicks we're not handling
This ignores unhandled mouse clicks for the window buttons. Right now
right-clicking on the window buttons animates them as if some action
were to occur when the mouse button is released.
2021-05-04 08:40:00 +02:00
Andreas Kling
1ee31981da WindowServer: Close any open menus when starting window move/resize 2021-05-03 23:13:02 +02:00
Andreas Kling
1aa56f0129 WindowServer+LibGUI: Make much of window construction asynchronous
Most of the IPC that happens between clients and WindowServer when
creating and configuring windows can be asynchronous. This further
reduces the amount of ping-ponging played during application startup.
2021-05-03 21:56:19 +02:00
Andreas Kling
a8a899adbf WindowServer+LibGUI: Make much of menu construction asynchronous
Creating a menu/menubar needs to be synchronous because we need the
ID from the response, but adding stuff *to* menus (and adding menus
to menubars, and menubars to windows) can all be asynchronous.

This dramatically reduces the amount of IPC ping-pong played by
each GUI application during startup.

I measured how long it takes TextEditor to enter the main event loop
and it's over 10% faster here. (Down from ~86ms to ~74ms)
2021-05-03 21:56:13 +02:00
Gunnar Beutner
9e22e9ce88 Userland: Use snake case names in .ipc files
This updates all .ipc files to have snake case names for IPC methods.
2021-05-03 21:14:40 +02:00
Gunnar Beutner
eb21aa65d1 Userland: Make IPC results with one return value available directly
This changes client methods so that they return the IPC response's
return value directly - instead of the response struct - for IPC
methods which only have a single return value.
2021-05-03 21:14:40 +02:00
Gunnar Beutner
5bb79ea0a7 Userland: Update IPC calls to use proxies
This updates all existing code to use the auto-generated client
methods instead of post_message/send_sync.
2021-05-03 21:14:40 +02:00
Gunnar Beutner
78803ce384 Userland: Split IPC endpoints into proxies and stubs
This enables support for automatically generating client methods.
With this added the user gets code completion support for all
IPC methods which are available on a connection object.
2021-05-03 21:14:06 +02:00
Gunnar Beutner
065040872f Userland: Change IPC funcs to use plain arguments instead of a struct
Instead of having a single overloaded handle method each method gets
its own unique method name now.
2021-05-03 21:14:06 +02:00
Gunnar Beutner
b613817bca Userland: Fix 64-bit portability issues 2021-05-03 08:42:39 +02:00
Matthew Olsson
88cfaf7bf0 LibGfx: Unify Rect, Point, and Size
This commit unifies methods and method/param names between the above
classes, as well as adds [[nodiscard]] and ALWAYS_INLINE where
appropriate. It also renamed the various move_by methods to
translate_by, as that more closely matches the transformation
terminology.
2021-05-02 22:48:06 +02:00
Valtteri Koskivuori
5b6f36dfea LaunchServer: Only consider path in OpenURL
This resolves the crash in #6812 where the browser was trying to open a
file in the Download directory, but the check against allowed paths was
also trying to match the URL fragment.

Resolves #6812
2021-05-02 19:47:28 +02:00
Andreas Kling
f052a66c5d WindowServer+Base: Show alternate close button for "modified" windows
Windows that are marked as modified will now have another (themable)
close button. This gives an additional visual clue that some action
will be required by the user before the window gets closed.

The default window-close-modified icon is an "X" with "..." underneath,
building on the established use of "..." in menus to signify that
additional user input will be required before an action is completed.
2021-05-02 14:17:49 +02:00
Andreas Kling
819325892a WindowServer: Minor tweaks to Window.h 2021-05-02 13:35:46 +02:00
Andreas Kling
cc6db526a6 WindowServer+LibGUI+Taskbar: Store window progress as Optional<int>
We were previously using the magical constant -1 to signify that a
window had no progress state. Be more explicit an use an Optional. :^)
2021-05-02 10:43:39 +02:00
Andreas Kling
68a542623f LaunchServer: Actually seal the allow-list on SealAllowList
Fixes #6804.
2021-05-02 08:17:31 +02:00
Gunnar Beutner
889359b6f9 Userland: Make IPC handlers return void if they don't have any outputs 2021-05-02 08:11:38 +02:00
Gunnar Beutner
7cf2839a26 Userland: Get rid of the OwnPtr<...> boilerplate code for IPC handlers 2021-05-02 08:11:38 +02:00
Gunnar Beutner
6cf59b6ae9 Everywhere: Turn #if *_DEBUG into dbgln_if/if constexpr 2021-05-01 21:25:06 +02:00
Valtteri Koskivuori
370231c05c Kernel: Expose minor device numbers for keyboard and mouse
A fix for two FIXMEs, and paving the way for multi-keyboard/mouse
support, I guess.
2021-05-01 20:07:11 +02:00
Andreas Kling
20dd5735ce WindowServer+LibGfx: Automatic "modified" markers in window titles
You can now add the string "[*]" to a window title and it will be
replaced with " (*)" if the window is modified, and with "" otherwise.
2021-05-01 19:42:29 +02:00
Andreas Kling
492464f4c1 WindowServer: Add Window "modified" state
This will be used to track which windows contain some kind of unsaved
data that the user may want some help remembering to save. :^)
2021-05-01 19:42:29 +02:00
Andreas Kling
3d4afe7614 Everywhere: "indexes" => "indices"
I've wasted a silly amount of time in the past fretting over which
of these words to use. Let's just choose one and use it everywhere. :^)
2021-04-29 22:23:52 +02:00
Andreas Kling
7ae7170d61 Everywhere: "file name" => "filename" 2021-04-29 22:16:18 +02:00
Andreas Kling
def1f1444a WindowServer: Move configuration file to /etc/WindowServer.ini
This was in the /etc/WindowServer/ directory which had nothing else in
it, so let's just get rid of the directory and move this up one step.
2021-04-29 22:16:18 +02:00
Tom
b88b19272e WindowServer: Fix alpha hit-test accessing out-of-bounds pixels
It's possible that the backing store hasn't been updated yet, so
when performing an alpha hit-test make sure the bitmap actually
contains it.

Fixes #6731
2021-04-29 21:51:41 +02:00
Linus Groh
649d2faeab Everywhere: Use "the SerenityOS developers." in copyright headers
We had some inconsistencies before:

- Sometimes "The", sometimes "the"
- Sometimes trailing ".", sometimes no trailing "."

I picked the most common one (lowecase "the", trailing ".") and applied
it to all copyright headers.

By using the exact same string everywhere we can ensure nothing gets
missed during a global search (and replace), and that these
inconsistencies are not spread any further (as copyright headers are
commonly copied to new files).
2021-04-29 00:59:26 +02:00
Tom
31c3382577 WindowServer: Use window menu actions when clicking frame buttons
This keeps the minimize/maximize/restore/close implementation
consistent with the window menu actions.
2021-04-28 09:40:34 +02:00
Tom
7345b502ab WindowServer: Don't restore active window if it is minimized
When closing a menu, don't restore the active input to a window that
is now minimized or invisible.

Fixes #6690
2021-04-28 09:40:34 +02:00
Jelle Raaijmakers
2e1320f264 WindowServer: Reevaluate hovered window on window rect change
When a new Window instance is added to the WindowManager, it does not
yet have an updated value for `m_frame->rect()` and we're not checking
if there is a new candidate for the hovered window, which we need to do
since the mouse cursor might hover above the newly opened window.

This fixes both issues: as soon as a Window frame's rect is changed,
ask the WindowManager to reevaluate its hovered window. This takes care
of newly opened windows _and_ windows that are programmatically changed
in size.

This works because when a Window becomes hovered, the WindowManager
sends out an enter event. This event in turn triggers the Window to
evaluate the cursor type under the mouse position and to update it when
necessary.

Fixes #4809.
2021-04-27 08:58:13 +02:00
DexesTTP
71d27abb97 Services: Rename ProtocolServer to RequestServer
The current ProtocolServer was really only used for requests, and with
the recent introduction of the WebSocket service, long-lasting
connections with another server are not part of it. To better reflect
this, this commit renames it to RequestServer.

This commit also changes the existing 'protocol' portal to 'request',
the existing 'protocol' user and group to 'request', and most mentions
of the 'download' aspect of the request to 'request' when relevant, to
make everything consistent across the system.

Note that LibProtocol still exists as-is, but the more generic Client
class and the more specific Download class have both been renamed to a
more accurate RequestClient and Request to match the new names.

This commit only change names, not behaviors.
2021-04-25 19:04:34 +02:00
DexesTTP
22413ef729 LibWeb: Add WebSocket bindings
The WebSocket bindings match the original specification from the
WHATWG living standard, but do not match the later update of the
standard that involves FETCH. The FETCH update will be handled later
since the changes would also affect XMLHttpRequest.
2021-04-25 19:04:34 +02:00
DexesTTP
62ed26164b Services: Add a WebSocket service
The WebSocket service isolates communication with a WebSocket to its
own isolated process. Similar to other isolating services, it has its
own user and group.
2021-04-25 19:04:34 +02:00
Andreas Kling
6c2ec4c1a4 Userland+Base: Add "ladyball" logo for the system :^)
Thanks to Katalin Kult for the artwork!
2021-04-25 18:57:10 +02:00
sin-ack
62af6cd4f9 IPCCompiler: Remove hardcoded endpoint magic, attempt deux
This patch removes the IPC endpoint numbers that needed to be specified
in the IPC files.  Since the string hash is a (hopefully) collision free
number that depends on the name of the endpoint, we now use that
instead. :^)

Additionally, endpoint magic is now treated as a u32, because endpoint
numbers were never negative anyway.

For cases where the endpoint number does have to be hardcoded (a current
case is LookupServer because the endpoint number must be known in LibC),
the syntax has been made more explicit to avoid confusing those
unfamiliar.  To hardcode the endpoint magic, the following syntax is now
used:

endpoint EndpointName [magic=1234]
2021-04-25 14:06:56 +02:00
Andreas Kling
418bc484e4 Revert "IPCCompiler: Use string hashes for IPC endpoint magic"
This reverts commit 59218007a3.
2021-04-25 11:24:12 +02:00
sin-ack
59218007a3 IPCCompiler: Use string hashes for IPC endpoint magic
This patch removes the IPC endpoint numbers that needed to be specified
in the IPC files.  Since the string hash is a (hopefully) collision free
number that depends on the name of the endpoint, we now use that
instead. :^)
2021-04-25 09:29:49 +02:00
Albert S
89a9d8f45c LaunchServer: Fix argument order to FileManager
Correct the order we pass the arguments to the FileManager so
opening file:// URLs works.

The path is a positional argument that was passed after the flags.
We need to make sure the flags are passed before positional arguments.
2021-04-24 17:55:04 +02:00
Brendan Coles
ac98dc4f7c AudioServer: Mixer: limit max volume to 200% 2021-04-24 01:30:10 +02:00
Andreas Kling
b91c49364d AK: Rename adopt() to adopt_ref()
This makes it more symmetrical with adopt_own() (which is used to
create a NonnullOwnPtr from the result of a naked new.)
2021-04-23 16:46:57 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Andreas Kling
e924da6c73 TelnetServer: Convert String::format() => String::formatted() 2021-04-21 23:49:02 +02:00
Andreas Kling
d342e9608c WindowServer: Add missing <AK/Debug.h> include and use dbgln_if() 2021-04-21 23:49:01 +02:00
Andreas Kling
2e6de99f1e ImageDecoder: Add missing <AK/Debug.h> include and use dbgln_if() 2021-04-21 23:49:01 +02:00
Ali Mohammad Pur
c4f682606a LookupServer: Use dbgln_if instead of #if
Also adds a missing AK::Formatter specialisation for DNSName, required
for the debug calls to actually work (!)
2021-04-21 14:29:46 +02:00
Tobias Christiansen
a8915ecd61 FileManager+FileOperation: Report Errors when doing an file operation
Report back errors from the FileOperation to the FileManager and
display them in the MessageBox
2021-04-20 12:02:01 +02:00
Conor Byrne
68d1469aea Taskbar: Show start menu when super key is pressed
This commit re-adds the functionality of the start menu appearing when
the super key is pressed
2021-04-19 20:03:25 +02:00
Conor Byrne
88ecfa164a LibGUI+WindowServer: Add WM_SuperKeyPressed event
This commit adds an event called WM_SuperKeyPressed which is sent to all
windows via WindowManagerServerConnection.
The event is fired from WindowManager when the super key is pressed,
which is the windows key on most keyboards :)
2021-04-19 20:03:25 +02:00
Maciej Zygmanowski
136f6fb7c8 WindowServer: Use VERIFY instead of assert in scale factor check 2021-04-19 17:30:07 +02:00
Linus Groh
8d490aba76 LibJS: Implement console.assert() 2021-04-18 18:28:17 +02:00
Linus Groh
e37421bddc Browser+WebContent: Fix HTML injection in console functions output 2021-04-18 18:28:17 +02:00
Andreas Kling
12546259ff Everywhere: Rename title_bar => titlebar 2021-04-18 16:35:18 +02:00
Andreas Kling
b937ebd121 WindowServer: Make MenuItemActivated IPC message pass identifier as u32
This is consistent with the actual storage type.
2021-04-17 22:26:58 +02:00
Andreas Kling
ec6debb46f WindowServer: Don't "enter" menu item when hovering over a separator
Since menu separator items don't have an associated identifier,
make sure we don't falsely report that we've enter item 0.

This fixes an issue where hovering over a separator would behave
as if we'd hovered over the first item in the menu wrt sending
MenuItemEntered.
2021-04-17 20:49:53 +02:00
Andreas Kling
ba7e1ca2fb WindowServer+LibGUI: Notify GUI clients about menu item enter/leave
We now send out MenuItemEntered and MenuItemLeft messages to the client
when the user hovers/unhovers menu items.

On the client side, these become GUI::ActionEvent, with one of two
types: ActionEnter or ActionLeave. They are sent to the Application.

This will allow GUI applications to react to these events.
2021-04-17 20:49:53 +02:00
Georgiy Komarov
f8c2beec7c
DHCPClient: Fix undefined behaviour when calling memcpy() (#6416)
Calling memcpy with null pointers results in undefined behaviour, even
if count is zero.

This in turns is exploited by GCC. For example, the following code:
    memcpy (dst, src, n);
    if (!src)
      return;
    src[0] = 0xcafe;
will be optimized as:
    memcpy (dst, src, n);
    src[0] = 0xcafe;
IOW the test for NULL is gone.
2021-04-17 20:49:22 +02:00
sin-ack
c8ef8d2db5 Taskbar: Use WM connection for window management operations
Since WM operations are moved to a separate endpoint pair, Taskbar now
uses those to perform window management related operations.
Additionally, it now explicitly declares to WindowServer that it is a
window manager.
2021-04-17 13:06:25 +02:00
sin-ack
aa56f9a1e0 LibGUI+WindowServer: Separate window manager IPC from regular IPC
With this patch the window manager related functionality is split out
onto a new endpoint pair named WindowManagerServer/Client.  This allows
window manager functionality to be potentially privilege separated in
the future.  To this end, a new client named WMConnectionClient
is used to maintain a window manager connection.  When a process
connects to the endpoint and greets the WindowServer as a window manager
(via Window::make_window_manager(int)), they're subscribed to the events
they requested via the WM event mask.

This patch also removes the hardcoding of the Taskbar WindowType to
receive WM events automatically.  However, being a window manager still
requires having an active window, at the moment.
2021-04-17 13:06:25 +02:00
Linus Groh
ba3bc6fef2 LibGUI+WindowServer: Fix some misaligned CMakeLists.txt SOURCES entries 2021-04-16 21:30:53 +02:00
Timothy Flynn
2381b19719 Browser+LibWeb+WebContent: Parse cookies in the OOP tab
To protect the main Browser process against nefarious cookies, parse the
cookies out-of-process and then send the parsed result over IPC to the
main process. This way, if the cookie parser blows up, only that tab
will be affected.
2021-04-16 19:19:31 +02:00
Nicholas-Baron
73dd293ec4 Everywhere: Add -Wdouble-promotion warning
This warning informs of float-to-double conversions. The best solution
seems to be to do math *either* in 32-bit *or* in 64-bit, and only to
cross over when absolutely necessary.
2021-04-16 19:01:54 +02:00
Linus Groh
e632186c17 WindowServer: Recalculate window rect when toggling menubar
This is important when the window is maximized or tiled (which
recalculate_rect() will both check), as we otherwise create a gap above
the window frame (when hiding the menubar) or push the frame off the
screen (when showing the menubar).
2021-04-16 17:28:05 +02:00
Linus Groh
0aebb9ec62 WindowServer: Replace window menu action magic numbers with enum
This makes it a lot easier to find where the action handling is
happening, just 1, 2, 3, 4 isn't very discoverable. :^)
2021-04-16 17:27:54 +02:00
sin-ack
5b95850e28 SystemServer+LibCore: Allow service to request multiple sockets
SystemServer only allowed a single socket to be created for a service
before this.  Now, SystemServer will allow any amount of sockets.  The
sockets can be defined like so:

[SomeService]
Socket=/tmp/portal/socket1,/tmp/portal/socket2,/tmp/portal/socket3
SocketPermissions=660,600

The last item in SocketPermissions is applied to the remainder of the
sockets in the Socket= line, so multiple sockets can have the same
permissions without having to repeat them.

Defining multiple sockets is not allowed for socket-activated services
at the moment, and wouldn't make much sense anyway.

This patch also makes socket takeovers more robust by removing the
assumption that the socket will always be passed in fd 3.  Now, the
SOCKET_TAKEOVER environment variable carries information about which
endpoint corresponds to which socket, like so:

SOCKET_TAKEOVER=/tmp/portal/socket1:3 /tmp/portal/socket2:4

and LocalServer/LocalService will parse this automatically and select
the correct one.  The old behavior of getting the default socket is
preserved so long as the service only requests a single socket in
SystemServer.ini.
2021-04-15 21:04:49 +02:00
Andreas Kling
b75d2d36e1 WindowServer: Clean up some of the code around menu item hovering
We were writing to the currently hovered menu item index in a bunch
of places, which made it very confusing to follow how it changes.

Rename Menu::set_hovered_item() to set_hovered_index() and use it
in more places instead of manipulating m_hovered_item_index.
2021-04-15 20:50:24 +02:00
Tom
d10b95622b WindowServer: Fix window shadow rendering glitch
Some small window shadows were missing a small section of the top/bottom
and/or left/right center shadow.
2021-04-15 10:22:04 +02:00
Idan Horowitz
bc9cd55da4 Browser+LibWeb: Add support for spoofing the browser user agent
This is helpful when testing certain sites like twitter.com which
display differently based on the user agent.
2021-04-14 23:06:32 +02:00
Timothy Flynn
c00760c5f9 Browser+LibWeb+WebContent: Track the source of document.cookie requests
To implement the HttpOnly attribute, the CookieJar needs to know where a
request originated from. Namely, it needs to distinguish between HTTP /
non-HTTP (i.e. JavaScript) requests. When the HttpOnly attribute is set,
requests from JavaScript are to be blocked.
2021-04-14 16:07:46 +02:00
Andreas Kling
a2baab38fd Everywhere: It's now "Foobar", not "FooBar", and not "foo bar"
I hereby declare these to be full nouns that we don't split,
neither by space, nor by underscore:

- Breadcrumbbar
- Coolbar
- Menubar
- Progressbar
- Scrollbar
- Statusbar
- Taskbar
- Toolbar

This patch makes everything consistent by replacing every other variant
of these with the proper one. :^)
2021-04-13 16:58:15 +02:00
Andreas Kling
bf1ef6533c FileManager+FileOperation: Show byte progress of current file
What I meant for the GUI progress bars to show:

- Bytes copied of the current file
- Files copied of the total set

What it actually showed:

- Bytes copied of the total bytes
- Files copied of the total set

This patch fixes it by showing byte progress of the current file
instead of byte progress of total bytes.
2021-04-13 10:12:50 +02:00
Andreas Kling
4205038c45 FileOperation: Add a new helper program for out-of-process file ops
This is a helper program for FileManager that performs a file operation
in a separate process and reports progress on standard out.

This initial implementation only supports the "Copy" operation and does
not do any detailed error handling.
2021-04-13 10:12:50 +02:00
Valtteri Koskivuori
d5e1250061 WindowServer: Fix notification placement
No more top bar, no more extra padding. Spacing is equal on the top and
on the left, so it looks pretty tidy.
2021-04-12 18:11:43 +02:00
Andreas Kling
767bd8cc88 WindowServer: Strip Alt-shortcut marker ('&') when measuring menu texts
We were including these markers when computing the sizes of menus,
causing them to get a little too much padding.
2021-04-12 15:24:17 +02:00
Linus Groh
da177c6517 LibJS: Make Errors fully spec compliant
The previous handling of the name and message properties specifically
was breaking websites that created their own error types and relied on
the error prototype working correctly - not assuming an JS::Error this
object, that is.

The way it works now, and it is supposed to work, is:

- Error.prototype.name and Error.prototype.message just have initial
  string values and are no longer getters/setters
- When constructing an error with a message, we create a regular
  property on the newly created object, so a lookup of the message
  property will either get it from the object directly or go though the
  prototype chain
- Internal m_name/m_message properties are no longer needed and removed

This makes printing errors slightly more complicated, as we can no
longer rely on the (safe) internal properties, and cannot trust a
property lookup either - get_without_side_effects() is used to solve
this, it's not perfect but something we can revisit later.

I did some refactoring along the way, there was some really old stuff in
there - accessing vm.call_frame().arguments[0] is not something we (have
to) do anymore :^)

Fixes #6245.
2021-04-12 09:38:57 +02:00
Timothy Flynn
1ef48d50ff LibWeb+WebContent: Hook document.cookie to the backend cookie storage 2021-04-11 18:24:34 +02:00
Andreas Kling
54cd8dfc4d LibWeb+WebContent: Support image context menus in OOPWV
You can now right-click images in web content and get a context menu.
2021-04-11 16:49:25 +02:00
Gunnar Beutner
8ca5b8c065 LibC: Move S_* defines into <fcntl.h>
According to the Single UNIX Specification, Version 2 that's where
those macros should be defined. This fixes the libiconv port.

This also fixes some (but not all) build errors for the diffutils and nano ports.
2021-04-11 09:51:20 +02:00
Andreas Kling
19fb62dd15 WindowServer: Alt shortcuts and book title capitalization in menus
Specifically, in window menus. :^)
2021-04-10 10:29:42 +02:00
Andreas Kling
2bac9eb79d WindowServer: Cache internal Alt shortcuts on the Menu object
This way we don't have to recompute the set of shortcut keys every
time we're handling an in-menu keydown event.
2021-04-09 17:08:49 +02:00
Andreas Kling
0fc2651303 WindowServer: Support Alt shortcuts inside menus as well
Menu items can now also have Alt shortcut, and they work the same way
top-level menu Alt shortcuts do. This replaces the previous "type to
search" mechanism we had in menus.
2021-04-09 17:08:49 +02:00
Andreas Kling
2b9bc605d2 LibGfx: Add a Gfx::TextAlignment parameter to Painter::draw_ui_text() 2021-04-09 17:08:49 +02:00
Andreas Kling
b7a25bfaac LibGfx: Adjust parameter order for Painter::draw_ui_text()
Let's put the rect first so it's the same as draw_text().
2021-04-09 17:08:49 +02:00
AnotherTest
c6607719d2 DHCPClient: Retry DISCOVER for interfaces that fail
Attempts are spaced out with exponential backoff, cut at 10 minutes per
attempt.
Also avoid trying to acquire an IP on interfaces that aren't up.
Fixes #6126.
Fixes #6125.
2021-04-06 08:38:44 +02:00
Andreas Kling
1f4dc670d4 WindowServer: Select first item when opening a menu via Alt shortcut
To make keyboard navigation a little nicer, select the first/top menu
item right away.
2021-04-05 23:15:43 +02:00
Andreas Kling
d80fb6d9c0 WindowServer: Support Alt+Character menu shortcuts :^)
This patch adds support for opening menus via keyboard shortcuts.
Use an ampersand in a menu name to automatically create a keyboard
shortcut (Alt + the character following the ampersand.)

Menus with an Alt shortcut have a small underline under the shortcut
character for discoverability.
2021-04-05 23:15:43 +02:00
Andreas Kling
1c57bf9094 Taskbar: Use GUI::Button::set_menu() for the start menu button :^) 2021-04-05 18:09:04 +02:00
Andreas Kling
9b740f218b WindowServer+LibGUI: Notify clients when menus become visible/hidden
This will allow clients to react to these events.
2021-04-05 18:09:04 +02:00
Linus Groh
23b659e9c3 WindowServer: Exclude WindowType::Desktop windows from Super key actions
The desktop window is (and must be) considered resizable by
WindowServer, but none of the Super+<something> key actions should apply
to it (window minimizing/maximizing/tiling).

Fixes #5363.
2021-04-05 17:06:58 +02:00
Dawid Wolosowicz
f7184e967e WindowServer: Make applet area use the same color role as the taskbar
So far the taskbar has been using the "Button" as a color role, despite
rest of the applet area using "Window" color role. Although it all
looked alright on most system themes, it broke for the Nord theme.
2021-04-05 14:30:35 +02:00
Idan Horowitz
e8d2d73d55 DHCPClient: Store current IP address instead of relaying on the yiaddr
Real DHCP servers might decide to send the DHCPAck directly to the
specified ciaddr instead of as a unicast or multicast, resulting in
the ack being ignored by the network adapter when we are requesting
a new IPv4 address instead of renewing an existing lease, as the
yiaddr (and as a result the ciaddr) is set to the offered address in
that case instead of the current ip address.
2021-04-04 22:38:27 +02:00
Idan Horowitz
6b360834f2 DHCPClient: Dont set DHCPOption::ServerIdentifier on DHCPRequest
Some real DHCP servers dont set the siaddr field in the DHCPOffer to
their IPv4 (and instead leave it blank - 0.0.0.0), which results in
the server assuming the DHCPRequest is not directed at him when it
has the ServerIdentifier option attached that specifies 0.0.0.0 as
the targeted server. So instead we just omit the option and let the
DHCP servers decipher the target themselves based on the requested IP.
2021-04-04 22:38:27 +02:00
Idan Horowitz
47fa8d83bb DHCPClient: Parse MacAddress parts using StringUtils
The current parsing code assumed the ascii lowercase letters came after
the ascii numbers, which is not the case, and as such corrupted any mac
address that included hex letters (a-f). We likely did not notice this
as QEMU's emulated MAC is made up of only hex digits.
2021-04-04 21:22:25 +02:00
Dawid Wolosowicz
863bc35399 WindowServer: Propagate theme change to the applet area
Fixes: #6056
2021-04-04 20:52:39 +02:00
Dawid Wolosowicz
182f9582d2 WindowServer: Use non-translated rect to fill the applet area's store
Fixes #6061
2021-04-04 20:52:39 +02:00
Andreas Kling
0069020e6c WindowServer+LibGUI: Rename WindowType::MenuApplet => Applet 2021-04-04 17:55:50 +02:00
Linus Groh
e8739ddab7 LibWeb+WebContent: Keep track of screen rect
It is now possible to get the up-to-date screen rect from a Web::Page.
2021-04-04 00:37:54 +02:00
Linus Groh
96b26ec125 Everywhere: Replace uses of GUI::Desktop's on_rect_change and remove it 2021-04-04 00:37:54 +02:00
Andreas Kling
22d13d8b1a Taskbar: Tweak taskbar widget margins
Basically, nudge everything down 1 pixel.
2021-04-02 23:33:17 +02:00
thankyouverycool
14e074cd24 LibGUI+Calendar: Inherit from Frame class
Fixes incorrect painting with variable thickness and cuts down
on some layout boilerplate.
2021-04-02 22:23:21 +02:00