Commit Graph

824 Commits

Author SHA1 Message Date
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
Andreas Kling
239520ae54 WindowServer: Remove redundant Window::set_visible() in Menu::do_popup()
We're already calling MenuManager::open_menu(), which will take care of
making the menu window visible if needed.
2021-11-05 01:37:00 +01:00
Andreas Kling
5f8c949ea1 WindowServer: Remove redundant check in MenuManager::open_menu()
We've already returned early if the menu is open, so there's no need to
verify that it isn't present in the stack of open menus before pushing
it onto said stack.
2021-11-05 01:37:00 +01:00
Aziz Berkay Yesilyurt
bfb36fec89 WindowServer: Return ShareableBitmap() on fail
WindowServer returns {} on non-existing screen index,
however shot program hangs instead of retriving an empty
ShareableBitmap. With this change, the function returns an empty
ShareableBitmap and shot exits gracefully.
2021-11-05 00:10:23 +01:00
Ben Wiederhake
2798a19c70 LibC+LookupServer: Use u32 for the endpoint magic
That's how LibIPC treats it, too.
2021-11-05 00:17:01 +03:30
Ben Wiederhake
34a8ee6da5 LibC+LookupServer: Compute magic number to avoid hardcoding 2021-11-05 00:17:01 +03:30
Ben Wiederhake
0d6c8afa4e SQLServer: Remove unnecessary magic number 2021-11-05 00:17:01 +03:30
Andreas Kling
f7f6526082 WindowServer: Reevaluate hover state after dismissing window switcher
This makes the cursor update properly if it was above the window
switcher while it was visible, and something underneath it wants to use
something other than the default arrow cursor.
2021-11-04 16:10:40 +01:00
Andreas Kling
6c64721955 WindowServer: Reevaluate hover state when switching highlight windows
This makes the mouse cursor update nicely when another window is brought
directly under it by using the window switcher. :^)
2021-11-04 16:10:40 +01:00
Andreas Kling
dd8a459a1f WindowServer: Rename reevaluate_hovered_window()
...to reevaluate_hover_state_for_window(). This name is not super great
either, but at least it doesn't sound like the window is necessarily
currently being hovered.
2021-11-04 16:10:40 +01:00
sin-ack
edb3e71c1b WindowServer: Add missing window_was_constructed call
In 2e6bb987a3 the "did_construct" API in
Core::Object was removed, since it had only one user. For a replacement,
the Window would manually call the frame's "frame_was_constructed"
method. However, WindowServer::Window has two constructors, and only one
of them called this method. This caused windows to spawn without
buttons and various other breakage that spawned from this.
2021-11-03 09:05:09 +01:00
Ben Wiederhake
0e3397aabe WindowServer: Fix visibility of WindowSwitcher constructor
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.

This commit is separate from the other Servives changes because it
required additional adaption of the code. Note that the old code did
precisely what these changes try to prevent: Create and handle a
ref-counted object with a refcount of zero.
2021-11-02 22:56:53 +01:00
Ben Wiederhake
25032a02aa AudioServer: Fix visibility of Object-derivative constructors
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.

This commit is separate from the other Servives changes because it
required additional adaption of the code. Note that the old code did
precisely what these changes try to prevent: Create and handle a
ref-counted object with a refcount of zero.
2021-11-02 22:56:53 +01:00
Ben Wiederhake
4e55d649d7 Services: Fix visibility of Object-derivative constructors
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.
2021-11-02 22:56:53 +01:00
Ben Wiederhake
6b75a4dfc3 Everywhere: Mark overridden methods 'override'
This is good practice, and fixes some IDE warnings.
2021-11-02 22:56:53 +01:00
Ben Wiederhake
2e6bb987a3 AK+WindowServer: Remove did_construct() framework used only once
There is also make_ref_counted(), which does not call did_construct(),
so the method was not guaranteed to be run. Since there is only a single
user, and `WindowServer::Window` is a final class anyway (so there is no
need to separate the constructor and post-constructor phases), let's get
rid of this concept.

(The following commits reduce the opportunities to call
make_ref_counted, but still.)
2021-11-02 22:56:53 +01:00
Ben Wiederhake
59619572d6 LibThreading: Remove redundant method 2021-11-02 11:07:26 +01:00
Sam Atkins
53edaa3b26 LibWeb+WebContent: Add set_preferred_color_scheme IPC call
This allows the owner of a WebView to override whether to use a dark
theme or not, instead of just using the system theme's IsDark property.
2021-10-31 18:39:13 +01:00
Idan Horowitz
9d1fb85f93 WebContent: Convert ConsoleGlobalObject functions to ThrowCompletionOr 2021-10-31 18:20:37 +02:00
Marco Cutecchia
7653be6062 WindowServer: Remove some commented code in WindowManager.cpp 2021-10-31 12:37:49 +01:00
Tetsui Ohkubo
4bfe060336 FileOperation: Deduplicate file names on move
For file copying, when there is a file with the same name in the
destination directory, the file will be automatically renamed to
"file-2.txt", for example. This change expands that special-case
handling to file moving.
2021-10-31 12:36:35 +01:00
Andreas Kling
03c3b3b7e5 LibWeb: Null-check document before doing layout in PageHost::paint() 2021-10-28 18:29:49 +02:00
Andreas Kling
23561133aa LibWeb: Always update layout (if needed) before painting 2021-10-28 18:14:38 +02:00
Sam Atkins
885ca2f968 LibGfx+WindowServer: Move shadow-painting code to StylePainter
Specifically, this is to make it accessible to ThemeEditor, but there's
nothing about it that is especially window-specific.
2021-10-28 11:23:44 +02:00
Filiph Sandström
c6247fe414 Everywhere: Rename back-click to backward-click
This matches the current forward-click terminology.
2021-10-27 22:05:58 +03:00
Filiph Sandström
d6a0726302 Everywhere: Rename left/right-click to primary/secondary
This resolves #10641.
2021-10-27 22:05:58 +03:00
Liav A
8554952690 Kernel + WindowServer: Re-define the interface to framebuffer devices
We create a base class called GenericFramebufferDevice, which defines
all the virtual functions that must be implemented by a
FramebufferDevice. Then, we make the VirtIO FramebufferDevice and other
FramebufferDevice implementations inherit from it.
The most important consequence of rearranging the classes is that we now
have one IOCTL method, so all drivers should be committed to not
override the IOCTL method or make their own IOCTLs of FramebufferDevice.
All graphical IOCTLs are known to all FramebufferDevices, and it's up to
the specific implementation whether to support them or discard them (so
we require extensive usage of KResult and KResultOr, together with
virtual characteristic functions).
As a result, the interface is much cleaner and understandable to read.
2021-10-27 07:57:44 +03:00
Andreas Kling
fac6d220c3 WindowServer: Don't re-open screen device immediately after opening it
The Screen constructor already calls open_device(), so there's no need
to call it again right after creating a new Screen in apply_layout().

This makes the first screen compose happen ~50ms earlier on my machine.
2021-10-26 01:00:54 +02:00
Andreas Kling
693423bbe8 WindowServer: Remove Screen::init()
This function only did one thing: call Screen::set_resolution().
We always call that function when opening the underlying device anyway,
so this was completely redundant.

This makes the first screen compose happen ~60ms earlier on my machine.
2021-10-26 01:00:54 +02:00
Ben Wiederhake
3d855a801b SystemServer: Rename 'BootModes' config option to 'SystemModes' 2021-10-25 23:38:28 +02:00
Ben Wiederhake
8d13f6ddce Kernel+SystemServer: Change bootmode to system_mode
'bootmode' now only controls which set of services are started by
SystemServer, so it is more appropriate to rename it to system_mode, and
no longer validate it in the Kernel.
2021-10-25 23:38:28 +02:00
Andrew Pardoe
0e68550c05 MouseSettings: Add option to reverse buttons
Add option to reverse primary and secondary buttons in Mouse Settings.
- WindowServer.ini: add default entry
- switch-mouse-buttons.png: new icon for settings entry
- Mouse.gml/MouseWidget.*: new settings dialog
- ClientConnection/WindowManager/Server: window message for settings
- EventLoop.cpp: swap buttons 1 and 2 if settings are on
2021-10-25 19:20:33 +03:00
Andreas Kling
765ed9677b DHCPClient: Simplify DHCPv4PacketBuilder
Instead of creating a temporary ByteBuffer to hold the packet while
building it, we can just create the DHCPv4Packet struct directly.
2021-10-25 14:31:11 +02:00
Jelle Raaijmakers
40a0a995af WindowServer: Prevent sending duplicate MousePackets when clicking
If a mouse button was clicked, `EventLoop::drain_mouse()` would always
send the last MousePacket state to the screen input - even if that
state is equivalent to the last state sent as part of the button logic.

By remembering if the state was already sent, we prevent sending that
state a second time saving some resources in the process.
2021-10-24 22:00:34 +02:00
Jelle Raaijmakers
38b09ba133 WindowServer: Deduplicate code for mouse Z state in EventLoop 2021-10-24 22:00:34 +02:00
Jelle Raaijmakers
bbaf8e3b70 WindowServer: Simplify mouse button handling logic in EventLoop
The `buttons` variable is a bit superfluous here.
2021-10-24 22:00:34 +02:00
Andreas Kling
398c181c79 LibJS: Rename PropertyName to PropertyKey
Let's use the same name as the spec. :^)
2021-10-24 17:18:07 +02:00
Andreas Kling
561c18726f LibIPC: Add missing <signal.h> include 2021-10-24 01:01:01 +02:00
Brendan Coles
1d03f62444 EchoServer: Defer removal of client from clients HashMap
This is necessary to avoid trying to destruct the on_ready_to_read
function from inside the function.
2021-10-23 13:57:42 +02:00
Brendan Coles
f4c181da9d TelnetServer: Defer removal of client from clients HashMap
This is necessary to avoid trying to destruct the on_ready_to_read
function from inside the function.
2021-10-23 13:57:36 +02:00
Timothy Flynn
857cac6d1d WindowServer: Support displaying window titles when there are no buttons
Currently, if there are not titlebar buttons, we fail to paint the title
because we treat the leftmost titlebar button as the empty rect. We will
now use the rightmost edge of the titlebar when there are no buttons.
2021-10-22 14:46:08 +01:00
Andreas Kling
09b08d8e35 WindowServer: Re-evaluate hover state when active window changes
This effectively makes us send a "mouse move" event to windows when they
become active, even if the mouse didn't actually move. By doing this, we
trigger hover/tooltip/etc logic immediately, instead of doing it on the
next 1px mouse movement.

It's a small detail but my goodness does it feel better this way. :^)
2021-10-22 13:22:09 +02:00
xSlendiX
bf80dea39c LoginServer: Capitalize username and password fields
This commit changes the TextBox's placeholders for the username and
password fields to be capitalized.
2021-10-21 16:08:13 +01:00
Timothy Flynn
6d6cd87b7b LoginServer: Mark the login window as non-closeable and non-minimizable
Previously, you could close the window and be permanently logged out.
2021-10-21 14:45:30 +01:00
Timothy Flynn
176155c695 LibGUI+WindowServer: Add option to hide a widow's close button
This allows windows to be closed only programatically, and not from e.g.
the user clicking the X button on the window frame.
2021-10-21 14:45:30 +01:00
Karol Kosek
a36d13e36c LoginServer: Mark this component as REQUIRED
Prior to this change, there was no requirement to build this server.

If you build serenity without -DBUILD_EVERYTHING flag, or just play
around with your build configuration[1], it left you with a blank
screen and this debug line:

  SystemServer(6:6): LoginServer: binary "/bin/LoginServer" does not
  exist, skipping service.

[1]: Documentation/AdvancedBuildInstructions.md#component-configuration
2021-10-21 00:25:21 +02:00