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

WindowServer: Unify hit testing between fullscreen/regular windows

Even if a window is in fullscreen mode, we still want hit testing to
walk the window stack. Otherwise child windows of the fullscreen
window will not receive mouse events.
This commit is contained in:
Andreas Kling 2021-06-18 15:07:07 +02:00
parent 09dacf4cd1
commit 2f9e8a982c

View file

@ -1054,20 +1054,21 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind
} }
}; };
if (auto* fullscreen_window = active_fullscreen_window()) { // Hit test the window stack to see what's under the cursor.
process_mouse_event_for_window(*fullscreen_window); auto result = m_window_stack.hit_test(event.position());
} else {
m_window_stack.for_each_visible_window_from_front_to_back([&](Window& window) { if (!result.has_value()) {
if (!window.hit_test(event.position()).has_value()) // No window is outside the cursor.
return IterationDecision::Continue; if (event.type() == Event::MouseDown) {
process_mouse_event_for_window(window); // Clicked outside of any window -> no active window.
return IterationDecision::Break; // FIXME: Is this actually necessary? The desktop window should catch everything anyway.
}); set_active_window(nullptr);
}
clear_resize_candidate();
return;
} }
// Clicked outside of any window process_mouse_event_for_window(*result->window);
if (!hovered_window && !event_window_with_frame && event.type() == Event::MouseDown)
set_active_window(nullptr);
auto reverse_iterator = m_window_stack.windows().rbegin(); auto reverse_iterator = m_window_stack.windows().rbegin();
for (; reverse_iterator != m_window_stack.windows().rend(); ++reverse_iterator) { for (; reverse_iterator != m_window_stack.windows().rend(); ++reverse_iterator) {