1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:17:35 +00:00

WindowServer: Propagate theme change to the applet area

Fixes: #6056
This commit is contained in:
Dawid Wolosowicz 2021-04-04 20:22:45 +02:00 committed by Andreas Kling
parent 182f9582d2
commit 863bc35399
3 changed files with 24 additions and 2 deletions

View file

@ -152,11 +152,29 @@ void AppletManager::relayout()
if (m_window->rect() == rect) if (m_window->rect() == rect)
return; return;
m_window->set_rect(rect); m_window->set_rect(rect);
repaint();
WindowManager::the().tell_wm_listeners_applet_area_size_changed(rect.size());
}
void AppletManager::repaint()
{
if (!m_window) {
return;
}
auto rect = Gfx::IntRect { { 0, 0 }, m_window->size() };
if (!rect.is_empty()) { if (!rect.is_empty()) {
Gfx::Painter painter(*m_window->backing_store()); Gfx::Painter painter(*m_window->backing_store());
painter.fill_rect({ { 0, 0 }, rect.size() }, WindowManager::the().palette().window()); painter.fill_rect(rect, WindowManager::the().palette().window());
} }
WindowManager::the().tell_wm_listeners_applet_area_size_changed(rect.size()); }
void AppletManager::did_change_theme()
{
repaint();
} }
void AppletManager::remove_applet(Window& applet) void AppletManager::remove_applet(Window& applet)

View file

@ -52,7 +52,10 @@ public:
Window* window() { return m_window; } Window* window() { return m_window; }
const Window* window() const { return m_window; } const Window* window() const { return m_window; }
void did_change_theme();
private: private:
void repaint();
void draw_applet(const Window& applet); void draw_applet(const Window& applet);
void set_hovered_applet(Window*); void set_hovered_applet(Window*);

View file

@ -1525,6 +1525,7 @@ bool WindowManager::update_theme(String theme_path, String theme_name)
return IterationDecision::Continue; return IterationDecision::Continue;
}); });
MenuManager::the().did_change_theme(); MenuManager::the().did_change_theme();
AppletManager::the().did_change_theme();
auto wm_config = Core::ConfigFile::open("/etc/WindowServer/WindowServer.ini"); auto wm_config = Core::ConfigFile::open("/etc/WindowServer/WindowServer.ini");
wm_config->write_entry("Theme", "Name", theme_name); wm_config->write_entry("Theme", "Name", theme_name);
wm_config->sync(); wm_config->sync();