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

WindowServer: Bring window stack to front when clicking on frame

When clicking on a window's frame that is blocked by a modal
window, we want to bring the entire window stack to the front
regardless of where the user clicked in the frame (not just the
icon).
This commit is contained in:
Tom 2020-08-02 13:44:39 -06:00 committed by Andreas Kling
parent f4a5c9b6c2
commit ad48bd1aca

View file

@ -353,16 +353,18 @@ void WindowFrame::on_mouse_event(const MouseEvent& event)
{
ASSERT(!m_window.is_fullscreen());
if (m_window.is_blocked_by_modal_window())
return;
auto& wm = WindowManager::the();
if (m_window.type() != WindowType::Normal && m_window.type() != WindowType::Notification)
return;
if (m_window.type() == WindowType::Normal && title_bar_icon_rect().contains(event.position())) {
if (m_window.type() == WindowType::Normal) {
if (event.type() == Event::MouseDown)
wm.move_to_front_and_make_active(m_window);
if (m_window.is_blocked_by_modal_window())
return;
if (title_bar_icon_rect().contains(event.position())) {
if (event.type() == Event::MouseDown && (event.button() == MouseButton::Left || event.button() == MouseButton::Right)) {
// Manually start a potential double click. Since we're opening
// a menu, we will only receive the MouseDown event, so we
@ -391,6 +393,7 @@ void WindowFrame::on_mouse_event(const MouseEvent& event)
return;
}
}
}
// This is slightly hackish, but expand the title bar rect by two pixels downwards,
// so that mouse events between the title bar and window contents don't act like