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

WindowServer+LibGUI: Pass the system theme using Core::AnonymousBuffer

This was the last remaining user of shbufs in WindowServer, and so
WindowServer no longer pledges "shared_buffer" :^)
This commit is contained in:
Andreas Kling 2021-01-16 17:20:53 +01:00
parent 9c6c18d9b6
commit 04f95f9160
13 changed files with 51 additions and 56 deletions

View file

@ -1404,17 +1404,16 @@ Gfx::IntRect WindowManager::dnd_rect() const
bool WindowManager::update_theme(String theme_path, String theme_name)
{
auto new_theme = Gfx::load_system_theme(theme_path);
if (!new_theme)
if (!new_theme.is_valid())
return false;
ASSERT(new_theme);
Gfx::set_system_theme(*new_theme);
m_palette = Gfx::PaletteImpl::create_with_shared_buffer(*new_theme);
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;
for_each_window([&](Window& window) {
if (window.client()) {
if (!notified_clients.contains(window.client())) {
window.client()->post_message(Messages::WindowClient::UpdateSystemTheme(Gfx::current_system_theme_buffer_id()));
window.client()->post_message(Messages::WindowClient::UpdateSystemTheme(Gfx::current_system_theme_buffer()));
notified_clients.set(window.client());
}
}