mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:57:35 +00:00
WindowServer+LibGUI: Add an IPC API to change the current system fonts
This patch adds a set_system_fonts() IPC API that takes the two main font queries as parameters. We'll probably expand this with additional queries when we figure out what they should be. Note that changing the system fonts on a live system mostly takes effect in newly launched programs. This is because GUI::Widget will currently cache a pointer to the Gfx::FontDatabase::default_font() when first constructed. This is something we'll have to fix somehow. Also note that the settings are not yet persisted.
This commit is contained in:
parent
bb23e61fbf
commit
c778130d63
6 changed files with 39 additions and 8 deletions
|
@ -1543,13 +1543,8 @@ Gfx::IntRect WindowManager::dnd_rect() const
|
|||
return Gfx::IntRect(location, { width, height }).inflated(16, 8);
|
||||
}
|
||||
|
||||
bool WindowManager::update_theme(String theme_path, String theme_name)
|
||||
void WindowManager::invalidate_after_theme_or_font_change()
|
||||
{
|
||||
auto new_theme = Gfx::load_system_theme(theme_path);
|
||||
if (!new_theme.is_valid())
|
||||
return false;
|
||||
Gfx::set_system_theme(new_theme);
|
||||
m_palette = Gfx::PaletteImpl::create_with_anonymous_buffer(new_theme);
|
||||
Compositor::the().set_background_color(palette().desktop_background().to_string());
|
||||
HashTable<ClientConnection*> notified_clients;
|
||||
WindowFrame::reload_config();
|
||||
|
@ -1565,11 +1560,21 @@ bool WindowManager::update_theme(String theme_path, String theme_name)
|
|||
});
|
||||
MenuManager::the().did_change_theme();
|
||||
AppletManager::the().did_change_theme();
|
||||
Compositor::the().invalidate_occlusions();
|
||||
Compositor::the().invalidate_screen();
|
||||
}
|
||||
|
||||
bool WindowManager::update_theme(String theme_path, String theme_name)
|
||||
{
|
||||
auto new_theme = Gfx::load_system_theme(theme_path);
|
||||
if (!new_theme.is_valid())
|
||||
return false;
|
||||
Gfx::set_system_theme(new_theme);
|
||||
m_palette = Gfx::PaletteImpl::create_with_anonymous_buffer(new_theme);
|
||||
auto wm_config = Core::ConfigFile::open("/etc/WindowServer.ini");
|
||||
wm_config->write_entry("Theme", "Name", theme_name);
|
||||
wm_config->sync();
|
||||
Compositor::the().invalidate_occlusions();
|
||||
Compositor::the().invalidate_screen();
|
||||
invalidate_after_theme_or_font_change();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue