1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:08:10 +00:00

WindowServer: Relayout window buttons immediately on theme change

This commit is contained in:
Andreas Kling 2020-07-25 13:34:43 +02:00
parent 3ee6ed965f
commit e2f45a4b0e
3 changed files with 14 additions and 6 deletions

View file

@ -328,6 +328,16 @@ void WindowFrame::invalidate_title_bar()
}
void WindowFrame::notify_window_rect_changed(const Gfx::IntRect& old_rect, const Gfx::IntRect& new_rect)
{
layout_buttons();
auto& wm = WindowManager::the();
wm.invalidate(frame_rect_for_window(m_window, old_rect));
wm.invalidate(frame_rect_for_window(m_window, new_rect));
wm.notify_rect_changed(m_window, old_rect, new_rect);
}
void WindowFrame::layout_buttons()
{
auto palette = WindowManager::the().palette();
int window_button_width = palette.window_title_button_width();
@ -352,11 +362,6 @@ void WindowFrame::notify_window_rect_changed(const Gfx::IntRect& old_rect, const
button.set_relative_rect(rect);
}
}
auto& wm = WindowManager::the();
wm.invalidate(frame_rect_for_window(m_window, old_rect));
wm.invalidate(frame_rect_for_window(m_window, new_rect));
wm.notify_rect_changed(m_window, old_rect, new_rect);
}
void WindowFrame::on_mouse_event(const MouseEvent& event)
@ -390,7 +395,7 @@ void WindowFrame::on_mouse_event(const MouseEvent& event)
return;
} else if (event.type() == Event::MouseUp && event.button() == MouseButton::Left) {
// Since the MouseDown event opened a menu, another MouseUp
// from the second click outside the menu wouldn't be considered
// from the second click outside the menu wouldn't be considered
// a double click, so let's manually check if it would otherwise
// have been be considered to be one
auto& wm = WindowManager::the();