mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:38:11 +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:
parent
9c6c18d9b6
commit
04f95f9160
13 changed files with 51 additions and 56 deletions
|
@ -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>());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue