mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 19:17:44 +00:00
DisplaySettings+WindowServer: Allow updating theme without background
With this change you can now set the theme and background color at the same time in the Display Settings. Before if both were changed before hitting 'apply' the theme background color would overwrite the custom background.
This commit is contained in:
parent
e6ad55ab53
commit
8070a98288
11 changed files with 35 additions and 17 deletions
|
@ -790,9 +790,9 @@ Messages::WindowServer::StartDragResponse ConnectionFromClient::start_drag(Strin
|
|||
return true;
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetSystemThemeResponse ConnectionFromClient::set_system_theme(String const& theme_path, String const& theme_name)
|
||||
Messages::WindowServer::SetSystemThemeResponse ConnectionFromClient::set_system_theme(String const& theme_path, String const& theme_name, bool keep_desktop_background)
|
||||
{
|
||||
bool success = WindowManager::the().update_theme(theme_path, theme_name);
|
||||
bool success = WindowManager::the().update_theme(theme_path, theme_name, keep_desktop_background);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ private:
|
|||
virtual void dismiss_menu(i32) override;
|
||||
virtual void set_window_icon_bitmap(i32, Gfx::ShareableBitmap const&) override;
|
||||
virtual Messages::WindowServer::StartDragResponse start_drag(String const&, HashMap<String, ByteBuffer> const&, Gfx::ShareableBitmap const&) override;
|
||||
virtual Messages::WindowServer::SetSystemThemeResponse set_system_theme(String const&, String const&) override;
|
||||
virtual Messages::WindowServer::SetSystemThemeResponse set_system_theme(String const&, String const&, bool keep_desktop_background) override;
|
||||
virtual Messages::WindowServer::GetSystemThemeResponse get_system_theme() override;
|
||||
virtual void apply_cursor_theme(String const&) override;
|
||||
virtual Messages::WindowServer::GetCursorThemeResponse get_cursor_theme() override;
|
||||
|
|
|
@ -2089,7 +2089,7 @@ void WindowManager::invalidate_after_theme_or_font_change()
|
|||
Compositor::the().invalidate_after_theme_or_font_change();
|
||||
}
|
||||
|
||||
bool WindowManager::update_theme(String theme_path, String theme_name)
|
||||
bool WindowManager::update_theme(String theme_path, String theme_name, bool keep_desktop_background)
|
||||
{
|
||||
auto new_theme = Gfx::load_system_theme(theme_path);
|
||||
if (!new_theme.is_valid())
|
||||
|
@ -2097,7 +2097,8 @@ bool WindowManager::update_theme(String theme_path, String theme_name)
|
|||
Gfx::set_system_theme(new_theme);
|
||||
m_palette = Gfx::PaletteImpl::create_with_anonymous_buffer(new_theme);
|
||||
m_config->write_entry("Theme", "Name", theme_name);
|
||||
m_config->remove_entry("Background", "Color");
|
||||
if (!keep_desktop_background)
|
||||
m_config->remove_entry("Background", "Color");
|
||||
if (auto result = m_config->sync(); result.is_error()) {
|
||||
dbgln("Failed to save config file: {}", result.error());
|
||||
return false;
|
||||
|
|
|
@ -213,7 +213,7 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
bool update_theme(String theme_path, String theme_name);
|
||||
bool update_theme(String theme_path, String theme_name, bool keep_desktop_background);
|
||||
void invalidate_after_theme_or_font_change();
|
||||
|
||||
bool set_hovered_window(Window*);
|
||||
|
|
|
@ -113,7 +113,7 @@ endpoint WindowServer
|
|||
|
||||
start_drag([UTF8] String text, HashMap<String,ByteBuffer> mime_data, Gfx::ShareableBitmap drag_bitmap) => (bool started)
|
||||
|
||||
set_system_theme(String theme_path, [UTF8] String theme_name) => (bool success)
|
||||
set_system_theme(String theme_path, [UTF8] String theme_name, bool keep_desktop_background) => (bool success)
|
||||
get_system_theme() => ([UTF8] String theme_name)
|
||||
refresh_system_theme() =|
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue