mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 22:38:13 +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:
parent
09dacf4cd1
commit
2f9e8a982c
1 changed files with 13 additions and 12 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue