Commit graph

448 commits

Author SHA1 Message Date
thankyouverycool
96895cd22c Everywhere: Fully qualify font names by including their slope
Fixes typefaces of the same weight but different slopes being
incorrectly returned for each other by FontDatabase.
2022-02-01 10:06:26 +01:00
networkException
e2df145e14 WindowServer: Allow checking checkable entries in a menu using space 2022-01-29 11:22:02 +01:00
Valtteri Koskivuori
7a537ad08f WindowServer: Rename default_positioned() -> is_default_positioned()
Tiny change, but it really bothered me that this was the only function
not named like the rest.
2022-01-25 23:22:10 +00:00
thankyouverycool
918dfa51a2 WindowServer: Paint menu checkboxes as such instead of as frames
Fixes disabled checkboxes appearing enabled in menus.
2022-01-23 00:30:00 +00:00
Dmitry Petrov
1662213737 Userland: Add horizontal mouse scroll support 2022-01-20 10:37:52 +01:00
Dmitry Petrov
d61cc47055 Kernel: Add horizontal mouse scroll support 2022-01-20 10:37:52 +01:00
Tom
a9ec0c30eb WindowServer: Pick font with glyphs for digits for ScreenNumberOverlay
We want to make sure we pick a font that has at least glyphs defined
for all the digits that we may need to display.
2022-01-17 02:10:09 +01:00
creator1creeper1
19d9d5bfe1 Everywhere: Mark Vector of mutable references as mutable
The point of a reference type is to behave just like the referred-to
type. So, a Foo& should behave just like a Foo.

In these cases, we had a const Vector. If it was a const Vector of Foo,
iterating over the Vector would only permit taking const references to
the individual Foos.

However, we had a const Vector of Foo&. The behavior should not
change. We should still only be permitted to take const references to
the individual Foos. Otherwise, we would be allowed to mutate the
individual Foos, which would mutate the elements of the const Vector.
This wouldn't modify the stored pointers, but it would modify the
objects that the references refer to. Since references should be
transparent, this should not be legal.

So it should be impossible to get mutable references into a const
Vector. Since we need mutable references in these cases to call the
mutating member functions, we need to mark the Vector as mutable as
well.
2022-01-16 00:38:21 +03:30
sin-ack
2e1bbcb0fa LibCore+LibIPC+Everywhere: Return Stream::LocalSocket from LocalServer
This change unfortunately cannot be atomically made without a single
commit changing everything.

Most of the important changes are in LibIPC/Connection.cpp,
LibIPC/ServerConnection.cpp and LibCore/LocalServer.cpp.

The notable changes are:
- IPCCompiler now generates the decode and decode_message functions such
  that they take a Core::Stream::LocalSocket instead of the socket fd.
- IPC::Decoder now uses the receive_fd method of LocalSocket instead of
  doing system calls directly on the fd.
- IPC::ConnectionBase and related classes now use the Stream API
  functions.
- IPC::ServerConnection no longer constructs the socket itself; instead,
  a convenience macro, IPC_CLIENT_CONNECTION, is used in place of
  C_OBJECT and will generate a static try_create factory function for
  the ServerConnection subclass. The subclass is now responsible for
  passing the socket constructed in this function to its
  ServerConnection base; the socket is passed as the first argument to
  the constructor (as a NonnullOwnPtr<Core::Stream::LocalServer>) before
  any other arguments.
- The functionality regarding taking over sockets from SystemServer has
  been moved to LibIPC/SystemServerTakeover.cpp. The Core::LocalSocket
  implementation of this functionality hasn't been deleted due to my
  intention of removing this class in the near future and to reduce
  noise on this (already quite noisy) PR.
2022-01-15 13:29:48 +03:30
Andreas Kling
611733af0d WindowServer: Don't try to flash menubar in deleted windows
Capture the window weakly when setting up the menubar flash timer.
2022-01-13 16:15:37 +01:00
electrikmilk
983c784a80 Base+WindowServer: Add icon to window menu move action 2022-01-12 10:55:04 +01:00
bugreport0
6c049ea4c4 LibGUI+WindowServer: Flash menubar menu when using a keyboard shortcut
Briefly flash the menubar menu containing the keyboard shortcut action
to give the user immediate visual feedback on their interaction with the
system.
2022-01-09 00:54:46 +01:00
mjz19910
3102d8e160 Everywhere: Fix many spelling errors 2022-01-07 10:56:59 +01:00
Tom
857c8850f3 WindowServer: Fix loading MainScreen setting from configuration 2022-01-04 06:31:59 +00:00
bugreport0
99e0b69c0c WindowServer: Tighten pledged promises 2022-01-03 15:56:41 +01:00
networkException
b46ea5158d WindowsServer+LibGUI: Avoid getting color under cursor outside screen
This patch fixes a crash in ColorPicker caused by the ColorSelectOverlay
trying to request the color for a pixel outside the screen rect.
2022-01-01 14:32:11 +01:00
Sam Atkins
fd7163b125 WindowServer: Stop trying to close windows that are already destroyed 2021-12-27 21:27:16 +01:00
Sam Atkins
a330a070d4 WindowServer: Use is_internal() instead of checking if the client exists 2021-12-27 21:27:16 +01:00
Andreas Kling
50e090071c WindowServer: Skip over destroyed windows in WindowSwitcher::draw()
I encountered a WindowServer crash due to null-pointer dereference in
this function, so let's protect against it by simply skipping over
nulled-out WeakPtrs.

I added a FIXME about how we ideally wouldn't be in this situation in
the first place, but that will require some more investigation.
2021-12-25 10:41:06 +01:00
Andreas Kling
6d0f504822 LibIPC: Add IPC::MultiServer convenience class
This encapsulates what our multi-client IPC servers typically do on
startup:

    1. Create a Core::LocalServer
    2. Take over a listening socket file descriptor from SystemServer
    3. Set up an accept handler for incoming connections

IPC::MultiServer does all this for you! All you have to do is provide
the relevant client connection type as a template argument.
2021-12-06 19:22:16 +01:00
Andreas Kling
81047d8f9c LibCore: Make LocalServer::take_over_from_system_server() return ErrorOr
This allows us to use TRY() or MUST() when calling it.
2021-12-06 19:22:16 +01:00
Sam Atkins
d2024f04bd Userland: Cast unused BackgroundAction::construct() results to void
User code does not need to keep this alive, so casting to void is safe.
But maybe a bit weird.
2021-12-05 15:31:03 +01:00
Sam Atkins
92f8514a85 Services: Cast unused IPC::new_client_connection() results to void
These ones all manage their storage internally, whereas the WebContent
and ImageDecoder ones require the caller to manage their lifetime. This
distinction is not obvious to the user without looking through the code,
so an API that makes this clearer would be nice.
2021-12-05 15:31:03 +01:00
Andreas Kling
fe00393941 LibCore: Change Core::LocalServer::on_ready_to_accept => on_accept
Everyone used this hook in the same way: immediately accept() on the
socket and then do something with the newly accepted fd.

This patch simplifies the hook by having LocalServer do the accepting
automatically.
2021-11-30 23:34:40 +01:00
Andreas Kling
cb9cac4e40 LibIPC+IPCCompiler+AK: Make IPC value decoders return ErrorOr<void>
This allows us to use TRY() in decoding helpers, leading to a nice
reduction in line count.
2021-11-28 23:14:19 +01:00
Andreas Kling
8d76eb773f LibIPC: Make IPC::Connection::post_message() return ErrorOr 2021-11-28 23:14:18 +01:00
Brian Gianforcaro
cf4fa936be Everywhere: Use default execpromises argument for Core::System::pledge 2021-11-28 08:04:57 +01:00
Karol Kosek
65f3a259d2 WindowServer: Clear wallpaper if the requested path is empty
235f39e449 secretly added an if check that ignores all the files that
couldn't be loaded into bitmaps.  Unfortunately, we send an empty path
as a way to unset the wallpaper, which meant that we couldn't go back
to the default background color anymore.
2021-11-26 11:30:55 -08:00
Andreas Kling
21a5fb0fa2 LibCore+LibSystem: Move syscall wrappers from LibSystem to LibCore
With this change, System::foo() becomes Core::System::foo().

Since LibCore builds on other systems than SerenityOS, we now have to
make sure that wrappers work with just a standard C library underneath.
2021-11-23 11:33:36 +01:00
Andreas Kling
9cf874ef9a WindowServer: Port to LibMain :^)
This simplifies some pledge(), unveil() and sigaction() calls.
2021-11-22 23:52:47 +01:00
Andreas Kling
9387271049 Everywhere: Fix spelling of "offsetted"
This word is actually pretty awkward in context, but this patch merely
fixes the spelling instead of finding a better word.
2021-11-21 20:22:48 +01:00
Andreas Kling
7e5b22333e WindowServer: Make window switcher look more like other overlays
Render the window switcher with the same background and shadow as other
WindowServer overlays.

Note that we don't actually render it as a WindowServer::Overlay, as the
window switcher uses mouse and keyboard events, and there's currently
no way for an overlay to receive events.
2021-11-14 12:23:04 +01:00
Andreas Kling
7fb2540ffe WindowServer: Clear window switcher's hovered item when cursor leaves
When the mouse cursor leaves the switcher window, we'll want to clear
the hovered item index so it stops showing as hovered. :^)
2021-11-14 12:23:04 +01:00
Andreas Kling
6f80d91850 WindowServer: Reset the window switcher's hovered item between uses
Before this, the last hovered item would still appear hovered when
bringing up the window switcher after having dismissed it.
2021-11-14 12:23:04 +01:00
Andreas Kling
9f7f7e69bb WindowServer: Allow server-internal windows with alpha channel
We were not creating backing stores with alpha for server-internal
windows. There was no reason for this limitation.
2021-11-14 12:23:04 +01:00
Andreas Kling
583fbf7111 WindowServer: Make WindowFrame::shadow_bitmap() const
There is no reason for callers to mutate the shadow bitmaps returned by
this function.
2021-11-14 12:23:04 +01:00
Andreas Kling
a8fed919e7 WindowServer: Clear active input tracking window on menu popup
This fixes an issue with menus not being immediately "usable" with the
the right mouse button after opening a context menu.

The bug was that we were clearing a local pointer to the active input
tracking window instead of the pointer in WindowStack.
2021-11-13 12:48:43 +01:00
Andreas Kling
68dc2e62fb WindowServer: Replace "Pin/Unpin Window" => "Always on Top" 2021-11-13 12:48:43 +01:00
Andreas Kling
d21dc1f451 Everywhere: Replace "virtual desktop" => "workspace" 2021-11-13 12:48:43 +01:00
Tom
32d59257d6 WindowServer: Ensure menu visibility after pushing menu to the stack
We need to make sure the menu was pushed to the open menu stack before
calling set_visible, as this may trigger cursor re-evaluation, which
in turn expects the menu to be considered open.

Fixes #10836
2021-11-13 00:38:36 +01:00
Andreas Kling
8b1108e485 Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Andreas Kling
a7f1f1c34b LibCore: Use ErrorOr<T> for Core::File::open() 2021-11-08 00:35:27 +01:00
Andreas Kling
0de33b3d6c LibGfx: Use ErrorOr<T> for Bitmap::try_create()
Another one that was used in a fajillion places.
2021-11-08 00:35:27 +01:00
Andreas Kling
235f39e449 LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()
This was used in a lot of places, so this patch makes liberal use of
ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
2021-11-08 00:35:27 +01:00
Andreas Kling
8262bbf624 LibGfx: Use ErrorOr<T> for Bitmap::cropped() 2021-11-08 00:35:27 +01:00
Andreas Kling
83d1460ee8 LibGfx: Use ErrorOr<T> for Bitmap::try_create_wrapper() 2021-11-08 00:35:27 +01:00
Andreas Kling
f23f99d51b LibGfx: Use ErrorOr<T> for Bitmap::try_create_with_anonymous_buffer() 2021-11-08 00:35:27 +01:00
Andreas Kling
e2eabb4132 LibCore: Use ErrorOr<T> in Core::AnonymousBuffer 2021-11-08 00:35:27 +01:00
Simon Woertz
727cdcf82c Revert "WindowServer: Remove redundant Window::set_visible()..."
This reverts commit 239520ae54.

The call to set_visible() is not redundant. Removing the call leads
to the "start" button in the taskbar not being painted as "pressed" even
when it is.
2021-11-07 00:49:48 +01:00
Andreas Kling
7a1a8d267d WindowServer: Add menus to open menu stack before making them visible
This prevents an issue where the first mouse event in a newly opened
would not get handled because we didn't think the menu was open yet.
2021-11-05 01:37:00 +01:00