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

LibGUI+WindowServer: Create IPC calls for passing SystemEffects

SystemEffects are sent to the WindowManager through
set_system_effects() and broadcast to Desktop clients with
update_system_effects(). WindowManager is reponsible for saving,
loading and rebroadcasting effects from WindowServer.ini on
config changes.
This commit is contained in:
thankyouverycool 2022-08-07 19:54:22 -04:00 committed by Andreas Kling
parent e2318dffe3
commit 841d06f676
8 changed files with 71 additions and 4 deletions

View file

@ -101,6 +101,8 @@ void WindowManager::reload_config()
Compositor::the().invalidate_after_theme_or_font_change();
WindowFrame::reload_config();
load_system_effects();
}
Gfx::Font const& WindowManager::font() const
@ -2331,6 +2333,46 @@ void WindowManager::set_cursor_highlight_color(Gfx::Color const& color)
sync_config_to_disk();
}
void WindowManager::apply_system_effects(Vector<bool> effects, ShowGeometry geometry)
{
if (m_system_effects == SystemEffects { effects, geometry })
return;
m_system_effects = { effects, geometry };
m_config->write_bool_entry("Effects", "AnimateMenus", m_system_effects.animate_menus());
m_config->write_bool_entry("Effects", "FlashMenus", m_system_effects.flash_menus());
m_config->write_bool_entry("Effects", "AnimateWindows", m_system_effects.animate_windows());
m_config->write_bool_entry("Effects", "SmoothScrolling", m_system_effects.smooth_scrolling());
m_config->write_bool_entry("Effects", "TabAccents", m_system_effects.tab_accents());
m_config->write_bool_entry("Effects", "SplitterKnurls", m_system_effects.splitter_knurls());
m_config->write_bool_entry("Effects", "MenuShadow", m_system_effects.menu_shadow());
m_config->write_bool_entry("Effects", "WindowShadow", m_system_effects.window_shadow());
m_config->write_bool_entry("Effects", "TooltipShadow", m_system_effects.tooltip_shadow());
m_config->write_entry("Effects", "ShowGeometry", ShowGeometryTools::enum_to_string(geometry));
sync_config_to_disk();
}
void WindowManager::load_system_effects()
{
Vector<bool> effects = {
m_config->read_bool_entry("Effects", "AnimateMenus", true),
m_config->read_bool_entry("Effects", "FlashMenus", true),
m_config->read_bool_entry("Effects", "AnimateWindows", true),
m_config->read_bool_entry("Effects", "SmoothScrolling", true),
m_config->read_bool_entry("Effects", "TabAccents", true),
m_config->read_bool_entry("Effects", "SplitterKnurls", true),
m_config->read_bool_entry("Effects", "MenuShadow", true),
m_config->read_bool_entry("Effects", "WindowShadow", true),
m_config->read_bool_entry("Effects", "TooltipShadow", true)
};
ShowGeometry geometry = ShowGeometryTools::string_to_enum(m_config->read_entry("Effects", "ShowGeometry", "OnMoveAndResize"));
m_system_effects = { effects, geometry };
ConnectionFromClient::for_each_client([&](auto& client) {
client.async_update_system_effects(effects);
});
}
bool WindowManager::sync_config_to_disk()
{
if (auto result = m_config->sync(); result.is_error()) {