summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-04-18 22:15:59 +0200
committerAndreas Kling <kling@serenityos.org>2020-04-18 22:15:59 +0200
commit0345fdcb779796a948d1928e1558062493cf80a1 (patch)
treefc4bae0a575303d2777dd1983fcd0bca9ea49889
parent5dd87c18c478e794ef5abd298624d8eb0ee31bfb (diff)
downloadserenity-0345fdcb779796a948d1928e1558062493cf80a1.zip
WindowServer: Allow WindowType::Desktop windows to become active
This allows us to focus the desktop and interact with it normally. :^)
-rw-r--r--Servers/WindowServer/WindowManager.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/Servers/WindowServer/WindowManager.cpp b/Servers/WindowServer/WindowManager.cpp
index c32b76b9f8..ce28c5bbd5 100644
--- a/Servers/WindowServer/WindowManager.cpp
+++ b/Servers/WindowServer/WindowManager.cpp
@@ -843,8 +843,12 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind
// Well okay, let's see if we're hitting the frame or the window inside the frame.
if (window.rect().contains(event.position())) {
- if (window.type() == WindowType::Normal && event.type() == Event::MouseDown)
- move_to_front_and_make_active(window);
+ if (event.type() == Event::MouseDown) {
+ if (window.type() == WindowType::Normal)
+ move_to_front_and_make_active(window);
+ else if (window.type() == WindowType::Desktop)
+ set_active_window(&window);
+ }
hovered_window = &window;
if (!window.global_cursor_tracking() && !windows_who_received_mouse_event_due_to_cursor_tracking.contains(&window)) {
@@ -1052,12 +1056,21 @@ void WindowManager::set_highlight_window(Window* window)
invalidate(*m_highlight_window);
}
+static bool window_type_can_become_active(WindowType type)
+{
+ return type == WindowType::Normal || type == WindowType::Desktop;
+}
+
void WindowManager::set_active_window(Window* window)
{
+ if (window) {
+ dbg() << "set_active_window: " << window->title();
+ }
+
if (window && window->is_blocked_by_modal_window())
return;
- if (window && window->type() != WindowType::Normal)
+ if (window && !window_type_can_become_active(window->type()))
return;
if (window == m_active_window)