Commit Graph

113 Commits

Author SHA1 Message Date
Uma Sankar Yedida
9ccae7a908 WindowServer+LibGfx: Added Crosshair cursor 2020-10-30 19:10:15 +01:00
Andreas Kling
3ec19ae4b6 LibGUI+LibGfx+WindowServer: Auto-generate disabled action icons :^)
This patch adds a simple filter that makes button and menu item icons
have that "'90s disabled" look when disabled. It's pretty awesome.
2020-10-27 21:25:40 +01:00
Andreas Kling
ce4ee1df1b WindowServer: Improve look of drag&drop items somewhat
This just adds a bit of padding around items. There's lots of room for
improvement here.
2020-10-27 20:45:38 +01:00
Andreas Kling
cfe1c132cb WindowServer: Raise menu item icons slightly when hovered :^)
Same effect as LibGUI toolbar buttons.
2020-10-25 15:32:19 +01:00
Andreas Kling
20ca3d4a99 LibGfx+WindowServer: Handle taller window title fonts better
If the window title font is taller than the theme's specified title
height, compute the title height based on the font instead. :^)
2020-10-24 00:26:13 +02:00
Andreas Kling
f5f99ccd6a WindowServer: Return some event members by const reference 2020-10-20 18:10:22 +02:00
Nico Weber
be693e95ff Services: Remove unused includes of {LibCore,WindowServer}/EventLoop.h 2020-10-05 23:48:33 +02:00
Linus Groh
bcfc6f0c57 Everywhere: Fix more typos 2020-10-03 12:36:49 +02:00
Ben Wiederhake
934d4d4033 Meta+Services: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
Andreas Kling
d3fcba78b0 WindowServer: Shrink menubar menu text rects slightly
We don't want the menu titles to cover the entire menubar.
2020-09-19 19:16:22 +02:00
Tom
6212f57755 WindowServer: Make SetWindowTaskbarRect tolerant to non-existing windows
There is a window between windows disappearing (e.g. closing or crashes)
and the Taskbar process being notified. So it is entirely possible that
it may call SetWindowTaskbarRect() for a window and/or client id that no
longer exists. As the Taskbar process does not own these windows, this
should not be treated as a misbehaving application request. Instead, just
silently ignore the request. The Taskbar will be notified shortly after
that the window no longer exist and remove it from its list.

Fixes #3494
2020-09-16 15:57:12 +02:00
Andreas Kling
aba793fb3e LibIPC: Share most of the code between {Client,Server}Connection
This patch introduces IPC::Connection which becomes the new base class
of ClientConnection and ServerConnection. Most of the functionality
has been hoisted up to the base class since almost all of it is useful
on both sides.

This gives us the ability to send synchronous messages in both
directions, which is needed for the WebContent server process.
Unlike other servers, WebContent does not mind blocking on a response
from its client.
2020-09-12 14:49:29 +02:00
Andreas Kling
b4f307f982 LibGUI+WindowServer: Rename window "override cursor" to just "cursor"
Let's just say each window has a cursor, there's not really overriding
going on.
2020-09-11 14:26:37 +02:00
Andreas Kling
0f9be82826 LibGfx: Move StandardCursor enum to LibGfx
This enum existed both in LibGUI and WindowServer which was silly and
error-prone.
2020-09-10 19:25:13 +02:00
Tom
0c2d36d1cd WindowServer: Draw minimize animation inverted
Inverting the pixels makes the animation visible over most colors.
2020-09-08 10:45:35 +02:00
Tom
3a4a9d4c6b WindowServer: Fix invalidating window frame
When invalidating the frame we need to properly flag that so that
we trigger rendering the frame, even if "all" was flagged as being
invalidated. Otherwise it will only get rendered if anything else
happens to trigger it (such as focus change).

Fixes #3427
2020-09-07 19:39:48 +02:00
thankyouverycool
72deaa3423 WindowServer: Return correct IsMaximized response 2020-08-31 09:08:26 +02:00
Ben Wiederhake
ec842b21cf WindowServer: Unbreak building with extra debug macros 2020-08-30 09:43:49 +02:00
Tom
6ea7e67b62 WindowServer: Fix minor flicker with transparent windows
Do not fill the backing store mismatch area with the solid window
color if the window is transparent. This caused some minor flicker
when such a window is e.g. snapped to the left/right or maximized.
2020-08-27 10:13:03 +02:00
thankyouverycool
208cb995ba WindowServer+LibGfx: Move title bar button layout to WindowTheme 2020-08-26 08:53:14 +02:00
Andreas Kling
85e818206c LibGfx+WindowServer: Simplify notification window frame theming
Don't require theme clients to provide the frame rect, the theme can
compute that internally based on the window rect.
2020-08-23 13:17:34 +02:00
Peter Elliott
45ed58865e LibGUI+WindowServer: Add resize_aspect_ratio()
When a resize_aspect_ratio is specified, and window will only be resized
to a multiple of that ratio. When resize_aspect_ratio is set, windows
cannot be tiled.
2020-08-23 01:05:22 +02:00
Andreas Kling
e374eb3035 LibGUI+WindowServer: Remove ResizeEvent::old_size()
Turns out nobody was using this information anyway, so let's not go
through all the trouble of plumbing it from WindowServer to LibGUI.

Fixes #3247.
2020-08-22 13:11:25 +02:00
Andreas Kling
80a9896e83 LibGfx+WindowServer: Simplify WindowTheme::paint_normal_frame() API
Don't require passing in the outer frame rect since the theme can
compute that itself, based on the window rect.
2020-08-21 21:16:13 +02:00
Tom
5c60a6a8fb WindowServer: Fix MenuApplets painting
We need to clip painting to the actual size to prevent corrupting
the area outside of the applet as the backing store is not
guaranteed to be perfectly in sync.

Fixes #3107
2020-08-21 12:00:24 +02:00
Tom
f503d3c046 WindowServer: Process dnd mouse events first
Fixes duplicate GUI::DragOperation instances being created.

Fixes #3151
2020-08-19 21:06:37 +02:00
Tom
2552e3be00 WindowServer: Find parent taskbar rect for minimize animation
If a modal window is being minimized, it may not have its own
taskbar rectangle. In that case, try finding a parent in the
modal window stack that does have one, and use that for the
animation.
2020-08-19 11:38:26 +02:00
Tom
c711d34276 WindowServer: Use same modal minimize/maximize logic with shortcuts
When minimizing/maximizing windows using the keyboard shortcuts
we should use the same logic dealing with modal windows as the
window frame buttons.
2020-08-18 19:50:33 +02:00
Sergey Bugaev
1671e1ac92 WindowServer+LibVT: Convert some dbgprintf() to dbg()
These kept annoying me, because these were the only two lines in the default
boot log that went unattributed.
2020-08-18 17:19:52 +02:00
Tom
a698a58d3c WindowServer: Fix flickering
Rather than blitting and rendering each window every time, only
render what actually changed. And while doing so, only render
the portions that are visible on the screen. This avoids flickering
because flipping framebuffers isn't always perfectly in sync with
the code, so it's possible that the flip happens slightly delayed
and we can briefly see the next iteration having partially completed.

Also, avoid touching the mouse cursor unless it is in an area that
needs updating. This reduces flickering unless it is over an area
that is updated often. And because we no longer render the entire
screen, we'll save the contents below the cursor so that we can
hide it before touching that area.

Fixes #2981
2020-08-18 12:12:27 +02:00
Andreas Kling
a50a9d67ee WindowServer: Close the framebuffer fd in ~Screen() 2020-08-17 18:05:35 +02:00
Tom
5f3d384454 WindowServer: Minimize the modal stack when minimizing from frame
Rather than only minimizing the modal window, minimize the entire
modal window stack just like when minimizing it from the task bar.
2020-08-15 01:28:18 +02:00
Linus Groh
895ab8e745 WindowServer: Take MenuApplet windows into account for hovered_window
This finally makes tooltips on menu applets the same as everywhere else!

Here's what went wrong:
WindowManager::process_mouse_event() receives a Window*&, determines the
hovered window and sets it accordingly. However there's a branch that
tests for menubar_rect().contains(event.position()) and returns early -
which resulted in hovered_window never being set to any MenuApplet
window, even hovered ones.

The hovered_window result is being used in WindowManager::event() and
passed to WindowManager::set_hovered_window(), which is responsible for
creating WindowLeft and WindowEntered events when the hovered window
changes, as a result of the mentioned chain of events this also never
happens for MenuApplet windows.
The WindowLeft event would the cause Window::handle_left_event() in
LibGUI to be called, which unsets the window's hovered widget, which
is necessary for the widget to receive a subsequent Enter event -
again, all of this never happened.

Now it's working as expected though, so we can start using tooltips on
menu applets :^)
2020-08-14 10:28:03 +02:00
Linus Groh
d979379a99 WindowServer: Handle global cursor tracking before ongoing drag/move/resize
In the case of an ongoing window drag/move/resize action
WindowManager::process_mouse_event() would return early, even before
delivering mouse events to windows with global cursor tracking enabled.
They would only continue to receive new mouse events once those actions
were completed.

Fixes #3116.
2020-08-13 15:54:17 +02:00
Ben Wiederhake
3ec7b8b33c Services: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
2020-08-12 20:40:59 +02:00
Tom
8ffa4131ce WindowServer: Limit maximizing windows to top window in modal stack
When maximizing a window that is blocked by a modal window, only
maximize the top window in the stack. However, if the stack is
minimized, restore all of them in addition.

Fixes #3074
2020-08-10 21:02:11 +02:00
Andreas Kling
ecc8a42cd2 WindowServer: Use to_theme_window_type() a bit more 2020-08-10 13:05:02 +02:00
Andreas Kling
de1a54c378 WindowServer+LibGfx: Move window frame rect calculation to WindowTheme 2020-08-10 13:03:44 +02:00
Andreas Kling
c81c8b68bb WindowServer+LibGfx: Move notification window frame painting to LibGfx
ClassicWindowTheme can now also paint notification window frames.
2020-08-09 19:34:56 +02:00
Andreas Kling
e7460b6fb4 WindowServer+LibGfx: Move normal window frame painting to a WindowTheme
This patch introduces the ClassicWindowTheme, which is our default
theme implemented as a Gfx::WindowTheme subclass.

In this initial cut, we move normal window frame painting and title
bar metrics helpers out of WindowServer and into LibGfx.

This will eventually allow us much greater flexibility with theming
windows, and also makes it easier to build applications that want to
render a window with a specific style for some reason. :^)
2020-08-09 19:29:15 +02:00
Nico Weber
ce95628b7f Unicode: Try s/codepoint/code_point/g again
This time, without trailing 's'. Ran:

    git grep -l 'codepoint' | xargs sed -ie 's/codepoint/code_point/g
2020-08-05 22:33:42 +02:00
Nico Weber
19ac1f6368 Revert "Unicode: s/codepoint/code_point/g"
This reverts commit ea9ac3155d.
It replaced "codepoint" with "code_points", not "code_point".
2020-08-05 22:33:42 +02:00
Andreas Kling
ea9ac3155d Unicode: s/codepoint/code_point/g
Unicode calls them "code points" so let's follow their style.
2020-08-03 19:06:41 +02:00
Tom
ad48bd1aca WindowServer: Bring window stack to front when clicking on frame
When clicking on a window's frame that is blocked by a modal
window, we want to bring the entire window stack to the front
regardless of where the user clicked in the frame (not just the
icon).
2020-08-03 18:34:39 +02:00
Ben Wiederhake
597b0c9efd WindowServer: Redraw MenuApplets on add/delete 2020-08-02 11:00:50 +02:00
Nico Weber
6dd10ad8dc Themes: Fix default theme window stripes and shadow after #2811
Change #2811 made window title stripes and window title shadow themable,
but it used the same stripe and shadow color for all window modes.
This is fine for the new 'basalt' theme which uses the same color
in all four window modes, but it changed the default theme so that
background windows had brown stripes and a brown shadow.

Instead, make the title stripe and title shadow themable per window mode,
and change the default theme to restore the colors it had before
change #2811: The title stripe color is the same as Border1 for all
window modes, and the title shadow is the same as the title stripe
darkened by 0.6.
2020-08-01 19:26:54 +02:00
Peter Elliott
5ae9eee4a3 LibGUI+WindowServer: Provide default placement to windows
This prevents windows from being opened directly on top of eachother,
and provides default behavior for when window position is not specified.

The new behavior is as follows:
- Windows that have been created without a set position are assigned one
  by WindowServer.
- The assigned position is either offset from the last window that is
  still in an assigned position, or a default position if no such window
  is available.
2020-08-01 08:06:48 +02:00
thankyouverycool
c815fa7f47 Services: Convert WindowFrame button bitmaps to themable PNGs
Custom buttons can now be set using TitleButtonIcons under the
Paths group in themes. WindowFrame recognizes window-close.png,
window-minimize.png, window-maximize.png and window-restore.png
filenames.
2020-08-01 07:56:48 +02:00
thankyouverycool
c50f258b7a LibGUI+WindowServer: Allow applets to retrieve their location
MenuApplet windows can now call rect_in_menubar to return their
location in the MenuBar.
2020-07-26 11:32:12 +02:00
thankyouverycool
030f4150b8 WindowServer: Adjust MenuApplet position on resize
Applet rects are now recalculated when changed.
2020-07-26 11:32:12 +02:00