mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 23:25:20 +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:
@@ -56,25 +56,23 @@ WindowServerConnection& WindowServerConnection::the()
|
||||
return *s_connection;
|
||||
}
|
||||
|
||||
static void set_system_theme_from_shbuf_id(int id)
|
||||
static void set_system_theme_from_anonymous_buffer(Core::AnonymousBuffer buffer)
|
||||
{
|
||||
auto system_theme = SharedBuffer::create_from_shbuf_id(id);
|
||||
ASSERT(system_theme);
|
||||
Gfx::set_system_theme(*system_theme);
|
||||
Application::the()->set_system_palette(*system_theme);
|
||||
Gfx::set_system_theme(buffer);
|
||||
Application::the()->set_system_palette(buffer);
|
||||
}
|
||||
|
||||
void WindowServerConnection::handshake()
|
||||
{
|
||||
auto response = send_sync<Messages::WindowServer::Greet>();
|
||||
set_my_client_id(response->client_id());
|
||||
set_system_theme_from_shbuf_id(response->system_theme_buffer_id());
|
||||
set_system_theme_from_anonymous_buffer(response->theme_buffer());
|
||||
Desktop::the().did_receive_screen_rect({}, response->screen_rect());
|
||||
}
|
||||
|
||||
void WindowServerConnection::handle(const Messages::WindowClient::UpdateSystemTheme& message)
|
||||
{
|
||||
set_system_theme_from_shbuf_id(message.system_theme_buffer_id());
|
||||
set_system_theme_from_anonymous_buffer(message.theme_buffer());
|
||||
Window::update_all_windows({});
|
||||
Window::for_each_window({}, [](auto& window) {
|
||||
Core::EventLoop::current().post_event(window, make<ThemeChangeEvent>());
|
||||
|
||||
Reference in New Issue
Block a user