1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-08 17:37:35 +00:00
Commit graph

367 commits

Author SHA1 Message Date
Andreas Kling
6f89557ffc WindowServer: Add "thread" pledge since we need it for wallpapers
Longer-term we should come up with a design where WindowServer doesn't
have to decode untrusted image files.
2020-01-13 14:41:15 +01:00
Shannon Booth
c66a6f131e WindowServer: Send key events to menu manager is there is a current menu
If there is a current menu, we now redirect all key events from window
manager to the menu manager. This allows us to properly navigate a menu
even when there is a current menu open.

Menu key navigation is now a lot more pleasant to use :^)

The action of pressing escape to close a menu has also been moved to its
proper home in menu manager in this commit.
2020-01-12 09:52:40 +01:00
Shannon Booth
e6c826ffc3 WindowServer: Fix non-submenus being closed when set as current menu
set_current_menu() was indiscriminately closing all menus when the
current menu is not a submenu. We should only close menus not in lineage
to the one being closed.
2020-01-12 09:52:40 +01:00
Shannon Booth
4f6b9b64c3 WindowServer: Fix incorrect current menu when switching to new item
We were forgetting to update the current menu when switching to a new
item.

We also rename the function from implying that only a redraw is
happening, as is actually not the case. It is now more correctly named:
update_for_new_hovered_item()
2020-01-12 09:52:40 +01:00
Andreas Kling
0d2bfc4ea0 WindowServer: Actually don't bring up system menu during move/resize
It was still possible to pop up the system menu by letting go of the
mouse button before letting go of the Logo key. This patch fixes that.
2020-01-12 02:33:24 +01:00
Andreas Kling
017b34e1ad Kernel: Add "video" pledge for accessing framebuffer devices
WindowServer becomes the only user.
2020-01-12 02:18:30 +01:00
Andreas Kling
ef05bb61a0 WindowServer: Don't show system menu on Logo KeyUp during move/resize 2020-01-12 01:46:41 +01:00
Andreas Kling
f187374c1b Kernel: fork()ed children should inherit pledge promises :^)
Update various places that now need wider promises as they are not
reset by fork() anymore.
2020-01-11 23:28:41 +01:00
Andreas Kling
d2e49719c4 WindowServer: Use pledge() 2020-01-11 21:35:01 +01:00
Shannon Booth
529a65c283 WSWindowManager: Improve opening and closing the system menu
The system menu can now be opened by pressing the window key even while
in a focused window. The current menu can also now be closed by pressing
escape.

We still cannot navigate a menu using arrow keys while there is an
active window, but this is another step towards that.
2020-01-11 18:58:59 +01:00
Shannon Booth
2f0eb3e28e WSMenuManager: Fix set_current_menu() not setting the current menu
m_current_menu was being set and then immediately cleared by
close_everyone(). Furthermore, since the menu being set can be a
nullptr, we now also make sure to handle that.

Finally, the logic can be simplified. close on the current menu is not
required, as that is also done by close_everyone().
2020-01-11 18:58:59 +01:00
Andreas Kling
4d77cdf9a8 WindowServer: If a menu can't fit on screen, at least put it at y=0
We're gonna need to handle overflow better than this, but at least this
way we can see the top of the menu, even if we can't scroll down to see
the rest of it.

For #1043.
2020-01-11 14:39:39 +01:00
Andreas Kling
463ed77024 WindowServer+LibGUI: Paint exclusive actions as radio buttons in menus
Actions that are checkable and members of a GActionGroup will now be
painted with a radio button appearance in menus.
2020-01-08 21:12:40 +01:00
Andreas Kling
8ddd053c2a WindowServer: Detach WSMenuManager from WSWindowManager
You can now get to the WSMenuManager via WSMenuManager::the().
Also note that it's initialized after WSWindowManager.
2020-01-08 13:26:19 +01:00
Andreas Kling
50fa759806 Revert "WSWindowServer: Remove uneccessary special casing"
This reverts commit 0c1bc91e88.

It turns out this is what made it possible to hover "between" different
menus after opening one of them with a click.
2020-01-08 13:13:36 +01:00
Shannon Booth
3f35cd2f7d WSWindowServer: Only close menubar on a mouse down
This allows you to click on the menu, then use the menu keys to browse
the menu. Beforehand, you would click the window, release the button,
and the menu would close :(
2020-01-08 11:36:49 +01:00
Shannon Booth
7fb7b399a3 WSWindowManager: Use early return to limit nesting
Let's be a little nicer on the eyes :^)
2020-01-08 11:36:49 +01:00
Shannon Booth
4683424e7a WSMenu: Support menu navigation through key presses
Add event handling for key presses for navigating a menu. The currently
hovered menu item is tracked through an index which is either
incremented or decremented on up or down arrow key presses, changing the
hovered item.

Whenever there is a mouse move event, we ensure that the current index
matches the currently hovered item so that the mouse and keyboard do not
get out of sync.

If the right key is pressed, and we are on a submenu menu item, we
'enter' that submenu. While we are currently in a submenu, we forward
all keypress events to that submenu for handling. This allows us to
traverse the heirachy of a menu. While in a submenu, if the left key is
pressed, we leave that submenu and start handling the keypresses
ourselves again.

There is currently a small issue where the mouse hover and key hover can
get out of sync. The mouse can be traversing a submenu, but the parent
menu has no idea that the mouse has 'entered' a submenu, so will handle
the key presses itself, instead of forwarding them to the submenu. One
potential fix for this is for a menu to tell its menu parent that the
submenu is being traversed.
2020-01-08 11:36:49 +01:00
Shannon Booth
27cb91e3e0 WSMenuManager: On menu close, close the currently hovered menu item
Ensure that the current hover is not still hovered when the menu is
opened again.
2020-01-08 11:36:49 +01:00
Shannon Booth
0c1bc91e88 WSWindowServer: Remove uneccessary special casing
From my testing I could not see this code doing anything. Listen the
FIXME, and remove this.
2020-01-08 11:36:49 +01:00
Andreas Kling
c410644c90 WindowServer: Stop menu applets from blocking wallpaper updates
The clock menu applet was causing pixel ghosting at some seemingly
arbitrary location on the desktop because the background paint logic
tries to avoid painting any part of the background that's covered by
an opaque window.

Since the code was using any_opaque_window_contains_rect() to check
this, we were not considering the window's *type*. (Menu applets are
still windows, but they are of the special type "MenuApplet" and do
not participate in normal compositing.)

The fix is to use for_each_visible_window_from_back_to_front() instead
of for_each_window() :^)

Fixes #1022.
2020-01-05 13:41:02 +01:00
Shannon Booth
7557251fac WindowServer: Move menu related code from WindowManager to MenuManager
Menus are now owned by menu manager instead of being split between the
window manager and menu manager. If the window server wants to change
a menu, or call menu related functionality, this will need to be done
through the menu manager.

Further refactoring is likely needed, but this seems like a good start
for seperating menu logic from window logic.
2020-01-05 09:02:24 +01:00
Jami Kettunen
874a6c4039 WindowServer: Introduce keyboard shortcuts for fast window management 2020-01-04 14:58:50 +01:00
Jami Kettunen
6c2fa0ee0a WindowServer: Maximize a window if it is dragged to top of the screen 2020-01-04 14:58:50 +01:00
Jami Kettunen
74ae6ac94b WindowServer: Various window pop-up menu fixes & QoL tweaks 2020-01-04 14:58:50 +01:00
Jami Kettunen
eab34a7de3 WindowServer+LibGUI: Implement minimizable property to windows 2020-01-04 14:58:50 +01:00
Jami Kettunen
a641f4d213 WindowServer: Set no active window if no new candidates are available 2020-01-04 14:58:50 +01:00
Andreas Kling
2d244a70a1 WindowServer+LibGUI: Simplify handling of paint event rects
Now that Vector<T> is convertible to Vector<T, n>, we don't have to
manually copy the paint event rectangles.
2020-01-04 11:03:37 +01:00
Andreas Kling
4f11528a65 WindowServer: Remove some unused WSClientConnection functions 2020-01-04 10:41:42 +01:00
Chyza
51a9e31fb2 WindowServer: Make tiled windows actually centered.
The right window had a few pixels on the right cut off, i don't know how
i didn't notice this earlier.
2020-01-02 20:40:07 +01:00
Andreas Kling
0ac95ec510 WindowServer: Close all menus belonging to a client when it disconnects
Previously we would be left with a menu stack containing nulled-out
WeakPtr's to menus in the now-disconnected clients.

This was tripping up an assertion when clicking anywhere after shutting
down a program while it had a menu open.
2020-01-02 20:03:32 +01:00
Andreas Kling
93e1728818 WindowServer: Remove unused WSEvent::WM_DeferredCompose
This was an old event type in the early days of userspace WindowServer.
2020-01-02 03:35:48 +01:00
Andreas Kling
8c8118fbf8 WindowServer+LibGUI: Taskbar should show all windows from each process
We were not sending the ID of the window that was listening for window
management (WM) events along with the WM messages. They only included
the "target" window's ID.

Since the taskbar's single window had the first window ID for its own
connection to the WindowServer, it meant that it would only receive
WM events for the first window ID in other processes as well.

This broke when I ported WindowServer to LibIPC.

Fix this by including the WM listener ID in all WM messages, and since
we're here anyway, get rid of a bunch of unnecessary indirection where
we were passing WM events through the WindowServer event loop before
sending them to the listener.
2020-01-02 03:29:21 +01:00
Andreas Kling
a005f14a73 WindowServer: Don't tile non-resizable windows
Thanks Tibor for pointing this out. :^)
2020-01-01 21:11:27 +01:00
Chyza
93ce1bb4a1 WindowServer: Windows tile when moved onto the edge of the screen 2020-01-01 19:46:37 +01:00
Andreas Kling
fc86460134 AK: Move the userspace SharedBuffer from LibC to AK
This always felt out-of-place in LibC.
2020-01-01 18:53:34 +01:00
Jami Kettunen
dfd759f75a WindowServer: Implement switching windows in reverse order 2020-01-01 18:10:50 +01:00
joshua stein
5b1f8ce220 WindowServer: set no menu bar when last window is removed
This is done here rather than pick_new_active_window() so that when
there are no other windows to focus but the previous window hasn't
been removed (just minimized), the menu bar remains on that client.
2019-12-31 04:23:08 +01:00
Andreas Kling
f908ee3496 WindowServer: Don't deactivate windows after moving them
Also make sure we send out the WM event for window deactivations.
This fixes an issue where the taskbar button for a window would appear
depressed, even after the window was deactivated.
2019-12-31 03:45:54 +01:00
Shannon Booth
8dc6fc9aca WindowServer: Set no active windows on a click outside of any window 2019-12-31 02:34:33 +01:00
Andreas Kling
25d7a7efa6 WindowServer: Let's boost all threads in the active client process
Instead of just boosting the main thread, let's boost all threads in
the currently active client process.

This avoids creating internal priority inversion problems in clients.
2019-12-30 20:10:49 +01:00
Andreas Kling
0dea0fd06f WindowServer: Give a thread boost to the currently active window
When the currently active (foreground) window is owned by a client,
we now apply a +10 priority boost to the client's main thread.

You normally want the window you're interacting with to be responsive,
so this little boost allows it to run a bit sooner and more often. :^)
2019-12-30 19:33:24 +01:00
Andreas Kling
00d26457c5 WindowServer: Don't repaint entire menubar on applet update 2019-12-30 01:18:38 +01:00
Shannon Booth
d1d7db2745 WindowServer: Include minimised windows for switching 2019-12-29 22:07:46 +01:00
Andreas Kling
27df4eb43d WindowServer: Always fill the menubar with color behind applets
Otherwise, menu applets with an alpha channel may leave behind ghost
pixels when updating.

Fixes #949.
2019-12-29 21:18:38 +01:00
Andreas Kling
7b2dd7e116 LibDraw+LibGUI: Allow changing individual colors in a Palette
Palette is now a value wrapper around a NonnullRefPtr<PaletteImpl>.
A new function, set_color(ColorRole, Color) implements a simple
copy-on-write mechanism so that we're sharing the PaletteImpl in the
common case, but allowing you to create custom palettes if you like,
by getting a GWidget's palette, modifying it, and then assigning the
modified palette to the widget via GWidget::set_palette().

Use this to make PaintBrush show its palette colors once again.

Fixes #943.
2019-12-29 00:47:49 +01:00
joshua stein
b624eaaf78 Build: consider IPCCOMPILER and FORMCOMPILER just for ordering
Build them if they don't exist, but don't care about them being
newer or older than the target.

I believe this is what was causing build loops where IPCCompiler was
being run a second time, rebuilding its .h file, then a library
would depend on that .h file and get re-archived, then an
application would need relinking, and something in that whole
process would trigger IPCCompiler running again touching its .h
file.
2019-12-28 21:09:33 +01:00
Hüseyin ASLITÜRK
e50deb55d3 WindowServer: Remove Clock from server.
We have clock applet.
2019-12-27 22:47:31 +01:00
Andreas Kling
159289af03 WindowServer: Use the system theme for the fallback window background
When filling in some missing part of a window (typically happens during
interactive window resize) we now use the ColorRole::Background from
the system theme palette instead of expecting the clients to send us
the same information when creating windows.
2019-12-27 13:28:55 +01:00
Andreas Kling
fd06164fa0 WindowServer: Recompute window occlusions on window stack changes
When adding/removing windows, or moving a window from the front to the
back, we have to recompute everyone's occlusion states.
2019-12-27 11:44:37 +01:00