Commit Graph

98 Commits

Author SHA1 Message Date
Linus Groh
ec5845212d WindowServer: Apply the "wait" cursor to unresponsive windows 2020-07-07 23:11:39 +02:00
Linus Groh
899dcba158 WindowServer+LibGUI: Add "wait" cursor 2020-07-07 23:11:39 +02:00
Linus Groh
b8a8e417f1 WindowServer+LibGUI: Add "help" cursor 2020-07-07 23:11:39 +02:00
Linus Groh
62866208ee WindowServer+LibGUI: Add "resize row/column" cursors 2020-07-07 23:11:39 +02:00
Andreas Kling
787673b743 WindowServer: Turn an assertion that happens sometimes into a dbg()
It's very annoying to crash the WindowServer when something harmless
is a little weird.
2020-07-07 17:10:12 +02:00
Andreas Kling
7527b9ee72 WindowServer: set_active_window() should not assume window has a client
I saw this assertion fire once and I don't know how I made it happen,
but it seems fine for client-less windows to become active, they just
don't have a menubar to install.
2020-07-07 17:10:12 +02:00
Andreas Kling
94ddb07e58 LibIPC+Services: Make ClientConnection take socket as NonnullRefPtr
This avoids getting into the awkward situation where the socket is
still part-owned by main() in multi-instance service. Also it just
reads nicer.
2020-07-06 13:30:11 +02:00
Andreas Kling
b85a57ead7 WindowServer: Move window titles 1px to the right
This makes it look nicer with wide window icons.
2020-07-04 19:21:57 +02:00
Andreas Kling
d851863704 Userspace: Remove a bunch of unnecessary Kernel/API/KeyCode.h includes 2020-07-04 17:25:31 +02:00
Andreas Kling
11c4a28660 Kernel: Move headers intended for userspace use into Kernel/API/ 2020-07-04 17:22:23 +02:00
Maciej Zygmanowski
fc79fefb5e WindowServer: Don't crash when invalid resolution requested 2020-07-03 12:31:40 +02:00
Peter Elliott
f833362536 WindowServer: don't send resize on resolution change unless needed
fixes #2575

The extra ResizeEvent would be handled after on_rect_change, and would
reset the size of main_widget to what it was before the resize.

Bonus: Less unnecessary events.
2020-06-29 16:50:40 +02:00
Andreas Kling
e50fa413cb WindowServer: Move window title bar icons 1px to the right
This makes wider icons look better, since they no longer rub up against
the left edge.
2020-06-28 00:09:01 +02:00
Hüseyin ASLITÜRK
5950736efa WindowServer: Add a new IsMaximized message
New message to query window maximized state.
2020-06-18 23:18:11 +02:00
Hüseyin ASLITÜRK
2f7e5a5e40 WindowServer: Replace character with code point
Replace u8 data type width u32. Remove character property from event and add code_point property for represent UTF-8 character.
2020-06-16 13:15:17 +02:00
Andreas Kling
4ab1b0b436 LibIPC: Only start responsiveness timer after sending client a message
Instead of always running the responsiveness timer for IPC clients,
we now only start it after sending a message. This avoids waking up
otherwise idle clients to do ping/pong busywork.
2020-06-13 13:47:01 +02:00
Andreas Kling
2ce2c4810a LibIPC+WindowServer+LibGUI: Detect and highlight unresponsive GUI apps
IPC::ClientConnection now tracks the time since the last time we got
a message from the client and calls a virtual function on itself after
3 seconds: may_have_become_unresponsive().

Subclasses of ClientConnection can then react to this if they like.

We use this mechanism in WindowServer to send out a friendly Ping
message to the client. If he doesn't Pong within 1 second, we mark
the client as "unresponsive" and recompose all of his windows with
a darkened appearance and amended title until he Pongs us.

This is a little on the aggressive side and we should figure out a way
to wake up less often. Perhaps this could only be done to windows the
user is currently interacting with, for example.

Anyways, this is pretty cool! :^)
2020-06-11 22:46:49 +02:00
Andreas Kling
116cf92156 LibGfx: Rename Rect,Point,Size => IntRect,IntPoint,IntSize
This fits nicer with FloatRect,FloatPoint,FloatSize and gives a much
better visual clue about what type of metric is being used.
2020-06-10 10:59:04 +02:00
Nico Weber
8630ef6df6 WindowServer: Make perror() strings slightly more detailed.
If one fails, it's now easier to see which one it is.
2020-06-05 09:29:19 +02:00
Hüseyin ASLITÜRK
9ec6ac31b8 WindowsServer: Add scancode value to KeyEvent 2020-06-03 21:52:40 +02:00
Andreas Kling
29029568ee WindowServer: Remove keyboard shortcut for toggling the system menu
100% of the time I activated this shortcut, I did not want to activate
this shortcut.
2020-06-01 19:24:10 +02:00
Andreas Kling
1d6ec51bee WindowServer+LibGUI: Add per-window progress
Each window now has an associated progress integer that can be updated
via the SetWindowProgress IPC call.

This can be used by clients to indicate the progress of ongoing tasks.
Any number in the range 0 through 100 indicate a progress percentage.
Any other number means "no progress"
2020-05-30 23:00:35 +02:00
Sergey Bugaev
602c3fdb3a AK: Rename FileSystemPath -> LexicalPath
And move canonicalized_path() to a static method on LexicalPath.

This is to make it clear that FileSystemPath/canonicalized_path() only
perform *lexical* canonicalization.
2020-05-26 14:35:10 +02:00
Sergey Bugaev
4139838a93 Userland et al: Pledge sigaction when needed
* In some cases, we can first call sigaction()/signal(), then *not* pledge
  sigaction.
* In other cases, we pledge sigaction at first, call sigaction()/signal()
  second, then pledge again, this time without sigaction.
* In yet other cases, we keep the sigaction pledge. I suppose these could all be
  migrated to drop it or not pledge it at all, if somebody is interested in
  doing that.
2020-05-26 14:35:10 +02:00
Sergey Bugaev
c1a26f0b35 WindowServer: Don't crash when minimizing Eyes
Or any other window that globally tracks the mouse cursor.
2020-05-25 12:38:37 +02:00
Hüseyin ASLITÜRK
d18f6e82eb LibGUI: Replace up and down arrows with emoji 2020-05-20 13:40:24 +02:00
Andreas Kling
191073000e WindowServer: Remove WindowManager::invalidate(Window) API's
Instead, we now tell Windows to invalidate themselves. Window will then
pass on the requests to Compositor.

My basic idea here is that WindowManager should do window management,
dealing with incoming events, moving, resizing, etc. Compositor should
deal with painting the window stack in the right order with the least
amount of effort. :^)
2020-05-20 08:31:46 +02:00
Andreas Kling
10699b347f WindowServer: Move occlusion things from WindowManager to Compositor 2020-05-20 08:31:46 +02:00
Andreas Kling
ecea904ce9 WindowServer: Always send mouse events to the full-screen window
Full-screen mode is pleasantly exclusive, so we only need to send the
incoming mouse events to the active full-screen window.

This fixes an issue where clicking on the area normally covered by
the menubar while in full-screen mode would not send mouse events to
the full-screen window.
2020-05-19 18:14:19 +02:00
Andreas Kling
c1827d9766 WindowServer: Ignore overlap when compositing full-screen windows
Normally we walk the window stack to see if a given dirty rect is
covered by an opaque window. When the active window is full-screened,
we can skip this check and just unconditionally paint the window.

This fixes an issue where windows with higher inherent z-order (like
the taskbar and menu windows) would get cursor ghosting in them while
a normal window was full-screened.

Fixes #2289.
2020-05-19 17:59:13 +02:00
Shannon Booth
195c1784ba WindowServer: Rename WindowManager wm_config() to config()
It looked a little silly with all of the callers saying wm.wm
2020-05-18 14:34:57 +02:00
Shannon Booth
d3eccf0409 WindowServer: Make some WindowManager member functions const 2020-05-18 14:34:57 +02:00
Shannon Booth
1048283186 WindowServer: Remove uneeded const_casts for getting a submenu 2020-05-18 14:34:57 +02:00
Shannon Booth
41471eb3ae WindowServer: Add const version of Menu::find_menu_by_id(int menu_id)
It's a little sad having two diferent versions of this function, but I
don't know of any better way to do it. This also gets rid of some const
casts down the line.
2020-05-18 14:34:57 +02:00
Shannon Booth
08064ed219 WindowServer: Add const qualified version of MenuItem::submenu() 2020-05-18 14:34:57 +02:00
Andreas Kling
cd29844632 LibIPC: Allow opt-in UTF-8 validation on message parameters
You can now mark String message parameters with the [UTF8] attribute.
This will cause the generated decoder to perform UTF-8 validation and
reject the message if the given parameter is not a valid UTF-8 string.

This frees up the receiving side from having to do this validation at
a higher level.
2020-05-16 14:13:09 +02:00
Shannon Booth
df43e09433 LibGUI+WindowServer: Allow applications to set custom cursor bitmaps
This will allow e.g PaintBrush to use custom cursors for each tool.
2020-05-16 09:44:55 +02:00
Andreas Kling
244efe050a Clipboard: Move the system clipboard to a dedicated service process :^)
This commit moves the clipboard from WindowServer into a new Clipboard
service program. Clipboard runs as the unprivileged "clipboard" user
and with a much tighter pledge than WindowServer.

To keep things working as before, all GUI::Application users now make
a connection to Clipboard after making the connection to WindowServer.
It could be interesting to connect to Clipboard on demand, but right
now that would necessitate expanding every GUI app's pledge to include
"unix" and also unveiling the clipboard portal, which I prefer not to.
2020-05-14 22:53:58 +02:00
Sergey Bugaev
450a2a0f9c Build: Switch to CMake :^)
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-05-14 20:15:18 +02:00
DexesTTP
aab998e776 WindowServer: Invalidate the cursor when setting an override cursor 2020-05-13 09:33:37 +02:00
Andreas Kling
c2b5519ce2 LibGUI+WindowServer: Allow apps to use the "move" cursor :^) 2020-05-13 00:16:40 +02:00
Andreas Kling
f2058a39bf WindowServer: Shade the bottom of the menu bar like a button
This adds a row of secondary (darker) shade to the menubar, giving it
a more buttonish look to match the highlight added to the Taskbar. :^)
2020-05-10 22:32:12 +02:00
Andreas Kling
c6f098c5a9 WindowServer: Add 2px of tasteful space above maximized windows
This makes the visual interaction between the menu bar and the window
a lot less janky looking.
2020-05-10 14:46:23 +02:00
Shannon Booth
eb43e2d544 WindowServer: Add basic search functionality in menus
Perform a case insensitive search through the current menu. Jump to the
first item matching all keys in the current search. Backspace can clear
the current search, and the search will timeout after 3 seconds.
2020-05-10 13:34:51 +02:00
Shannon Booth
d5c40899cb WindowServer: Rework and simplify Menu event handling
The menu manager will now send events directly to the current menu.
Previously if a menu was opened it would always be set as the current
menu. Now when opening a menu you can optionally say that you do not
want to have it as the current menu.

One scenerio when this happens is when a menu is popped up as part of a
preview, for example, when hovering over a menu item that is a submenu.

Sending the event to the current menu simplifies things and solves a few
inconsistencies in bevhaviour (such as hovering over a submenu, but key
events not being sent to the submenu).
2020-05-10 13:34:51 +02:00
Shannon Booth
b1c83e5a64 WindowServer: Remove stray semicolon 2020-05-10 13:34:51 +02:00
Andreas Kling
7aa2acefd0 WindowServer: Cancel any ongoing input tracking when a menu pops up
When the user opens a context menu by right-clicking on something,
we now immediately stop sending mouse events to whoever was doing
active input window tracking before.

There are probably more situations where we should do this, and maybe
there's also a more generic way to express it, but this works for now.
2020-05-09 16:40:13 +02:00
Andreas Kling
cf3b58fbe8 Services: Renamed from Servers
It didn't feel right to have a "DHCPClient" in a "Servers" directory.
Rename this to Services to better reflect the type of programs we'll
be putting in there.
2020-05-08 21:57:44 +02:00