summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-05-19 18:12:31 +0200
committerAndreas Kling <kling@serenityos.org>2020-05-19 18:14:19 +0200
commitecea904ce9518607505f517c94bb7182789824bc (patch)
tree17ee7991611aba5757233fa4b6c7b2e491999090
parentc1827d976614e26a44317791ac981a4d8e7b5c58 (diff)
downloadserenity-ecea904ce9518607505f517c94bb7182789824bc.zip
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.
-rw-r--r--Services/WindowServer/WindowManager.cpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/Services/WindowServer/WindowManager.cpp b/Services/WindowServer/WindowManager.cpp
index e6a8bc0c4f..392d2068af 100644
--- a/Services/WindowServer/WindowManager.cpp
+++ b/Services/WindowServer/WindowManager.cpp
@@ -818,11 +818,7 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind
return IterationDecision::Continue;
});
} else {
- for_each_visible_window_from_front_to_back([&](Window& window) {
- auto window_frame_rect = window.frame().rect();
- if (!window_frame_rect.contains(event.position()))
- return IterationDecision::Continue;
-
+ auto process_mouse_event_for_window = [&](Window& window) {
if (&window != m_resize_candidate.ptr())
clear_resize_candidate();
@@ -833,13 +829,13 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind
hovered_window = &window;
start_window_move(window, event);
m_moved_or_resized_since_logo_keydown = true;
- return IterationDecision::Break;
+ return;
}
if (window.is_resizable() && m_keyboard_modifiers == Mod_Logo && event.type() == Event::MouseDown && event.button() == MouseButton::Right && !window.is_blocked_by_modal_window()) {
hovered_window = &window;
start_window_resize(window, event);
m_moved_or_resized_since_logo_keydown = true;
- return IterationDecision::Break;
+ return;
}
}
@@ -852,7 +848,7 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind
new_opacity = 1.0f;
window.set_opacity(new_opacity);
window.invalidate();
- return IterationDecision::Break;
+ return;
}
// Well okay, let's see if we're hitting the frame or the window inside the frame.
@@ -872,14 +868,25 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind
m_active_input_window = window.make_weak_ptr();
}
}
- return IterationDecision::Break;
+ return;
}
// We are hitting the frame, pass the event along to WindowFrame.
- window.frame().on_mouse_event(event.translated(-window_frame_rect.location()));
+ window.frame().on_mouse_event(event.translated(-window.frame().rect().location()));
event_window_with_frame = &window;
- return IterationDecision::Break;
- });
+ };
+
+ if (auto* fullscreen_window = active_fullscreen_window()) {
+ process_mouse_event_for_window(*fullscreen_window);
+ } else {
+ for_each_visible_window_from_front_to_back([&](Window& window) {
+ auto window_frame_rect = window.frame().rect();
+ if (!window_frame_rect.contains(event.position()))
+ return IterationDecision::Continue;
+ process_mouse_event_for_window(window);
+ return IterationDecision::Break;
+ });
+ }
// Clicked outside of any window
if (!hovered_window && !event_window_with_frame && event.type() == Event::MouseDown)