1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:57:43 +00:00

WindowServer: Always update the maximize button icon when we should.

We were only updating it in the WSButton callback, not when changing the
maximized state by calling WSWindow::set_maximized().

Fixes #119.
This commit is contained in:
Andreas Kling 2019-06-02 15:35:00 +02:00
parent ae4ac524ad
commit 3fa0b6cd92
4 changed files with 16 additions and 8 deletions

View file

@ -96,10 +96,11 @@ WSWindowFrame::WSWindowFrame(WSWindow& window)
}));
if (window.is_resizable()) {
m_buttons.append(make<WSButton>(*this, *s_maximize_button_bitmap, [this] (auto& button) {
auto button = make<WSButton>(*this, *s_maximize_button_bitmap, [this] (auto&) {
m_window.set_maximized(!m_window.is_maximized());
button.set_bitmap(m_window.is_maximized() ? *s_unmaximize_button_bitmap : *s_maximize_button_bitmap);
}));
});
m_maximize_button = button.ptr();
m_buttons.append(move(button));
}
m_buttons.append(make<WSButton>(*this, *s_minimize_button_bitmap, [this] (auto&) {
@ -111,6 +112,12 @@ WSWindowFrame::~WSWindowFrame()
{
}
void WSWindowFrame::did_set_maximized(Badge<WSWindow>, bool maximized)
{
ASSERT(m_maximize_button);
m_maximize_button->set_bitmap(maximized ? *s_unmaximize_button_bitmap : *s_maximize_button_bitmap);
}
Rect WSWindowFrame::title_bar_rect() const
{
return { 3, 3, m_window.width(), window_titlebar_height };