mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:17:35 +00:00
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.
This commit is contained in:
parent
c1827d9766
commit
ecea904ce9
1 changed files with 19 additions and 12 deletions
|
@ -818,11 +818,7 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
for_each_visible_window_from_front_to_back([&](Window& window) {
|
auto process_mouse_event_for_window = [&](Window& window) {
|
||||||
auto window_frame_rect = window.frame().rect();
|
|
||||||
if (!window_frame_rect.contains(event.position()))
|
|
||||||
return IterationDecision::Continue;
|
|
||||||
|
|
||||||
if (&window != m_resize_candidate.ptr())
|
if (&window != m_resize_candidate.ptr())
|
||||||
clear_resize_candidate();
|
clear_resize_candidate();
|
||||||
|
|
||||||
|
@ -833,13 +829,13 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind
|
||||||
hovered_window = &window;
|
hovered_window = &window;
|
||||||
start_window_move(window, event);
|
start_window_move(window, event);
|
||||||
m_moved_or_resized_since_logo_keydown = true;
|
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()) {
|
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;
|
hovered_window = &window;
|
||||||
start_window_resize(window, event);
|
start_window_resize(window, event);
|
||||||
m_moved_or_resized_since_logo_keydown = true;
|
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;
|
new_opacity = 1.0f;
|
||||||
window.set_opacity(new_opacity);
|
window.set_opacity(new_opacity);
|
||||||
window.invalidate();
|
window.invalidate();
|
||||||
return IterationDecision::Break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Well okay, let's see if we're hitting the frame or the window inside the frame.
|
// 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();
|
m_active_input_window = window.make_weak_ptr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return IterationDecision::Break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We are hitting the frame, pass the event along to WindowFrame.
|
// 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;
|
event_window_with_frame = &window;
|
||||||
|
};
|
||||||
|
|
||||||
|
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;
|
return IterationDecision::Break;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Clicked outside of any window
|
// Clicked outside of any window
|
||||||
if (!hovered_window && !event_window_with_frame && event.type() == Event::MouseDown)
|
if (!hovered_window && !event_window_with_frame && event.type() == Event::MouseDown)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue