mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:17:36 +00:00
WindowServer: Relayout window buttons immediately on theme change
This commit is contained in:
parent
3ee6ed965f
commit
e2f45a4b0e
3 changed files with 14 additions and 6 deletions
|
@ -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)
|
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();
|
auto palette = WindowManager::the().palette();
|
||||||
int window_button_width = palette.window_title_button_width();
|
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);
|
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)
|
void WindowFrame::on_mouse_event(const MouseEvent& event)
|
||||||
|
@ -390,7 +395,7 @@ void WindowFrame::on_mouse_event(const MouseEvent& event)
|
||||||
return;
|
return;
|
||||||
} else if (event.type() == Event::MouseUp && event.button() == MouseButton::Left) {
|
} else if (event.type() == Event::MouseUp && event.button() == MouseButton::Left) {
|
||||||
// Since the MouseDown event opened a menu, another MouseUp
|
// 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
|
// a double click, so let's manually check if it would otherwise
|
||||||
// have been be considered to be one
|
// have been be considered to be one
|
||||||
auto& wm = WindowManager::the();
|
auto& wm = WindowManager::the();
|
||||||
|
|
|
@ -53,6 +53,8 @@ public:
|
||||||
|
|
||||||
void did_set_maximized(Badge<Window>, bool);
|
void did_set_maximized(Badge<Window>, bool);
|
||||||
|
|
||||||
|
void layout_buttons();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void paint_notification_frame(Gfx::Painter&);
|
void paint_notification_frame(Gfx::Painter&);
|
||||||
void paint_normal_frame(Gfx::Painter&);
|
void paint_normal_frame(Gfx::Painter&);
|
||||||
|
|
|
@ -1388,6 +1388,7 @@ bool WindowManager::update_theme(String theme_path, String theme_name)
|
||||||
notified_clients.set(window.client());
|
notified_clients.set(window.client());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
window.frame().layout_buttons();
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
});
|
});
|
||||||
MenuManager::the().did_change_theme();
|
MenuManager::the().did_change_theme();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue