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
commit 2f9e8a982c
Notes: sideshowbarker 2024-07-18 12:04:34 +09:00

View file

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