mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:47:34 +00:00
WindowServer, LibGUI: RefreshSystemTheme implementation
Adds a mechanism through which windowing clients can re-request an UpdateSystemTheme message. This is currently used in SystemMenu's ShutdownDialog to refresh it's theme when the dialog is instantiated.
This commit is contained in:
parent
fdc9b3c5a0
commit
fcf50af53d
5 changed files with 15 additions and 0 deletions
|
@ -845,6 +845,11 @@ void Window::schedule_relayout()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Window::refresh_system_theme()
|
||||||
|
{
|
||||||
|
WindowServerConnection::the().post_message(Messages::WindowServer::RefreshSystemTheme());
|
||||||
|
}
|
||||||
|
|
||||||
void Window::for_each_window(Badge<WindowServerConnection>, Function<void(Window&)> callback)
|
void Window::for_each_window(Badge<WindowServerConnection>, Function<void(Window&)> callback)
|
||||||
{
|
{
|
||||||
for (auto& e : *reified_windows) {
|
for (auto& e : *reified_windows) {
|
||||||
|
|
|
@ -181,6 +181,8 @@ public:
|
||||||
|
|
||||||
void schedule_relayout();
|
void schedule_relayout();
|
||||||
|
|
||||||
|
void refresh_system_theme();
|
||||||
|
|
||||||
static void for_each_window(Badge<WindowServerConnection>, Function<void(Window&)>);
|
static void for_each_window(Badge<WindowServerConnection>, Function<void(Window&)>);
|
||||||
static void update_all_windows(Badge<WindowServerConnection>);
|
static void update_all_windows(Badge<WindowServerConnection>);
|
||||||
void notify_state_changed(Badge<WindowServerConnection>, bool minimized, bool occluded);
|
void notify_state_changed(Badge<WindowServerConnection>, bool minimized, bool occluded);
|
||||||
|
|
|
@ -869,6 +869,12 @@ void ClientConnection::handle(const Messages::WindowServer::SetWindowProgress& m
|
||||||
it->value->set_progress(message.progress());
|
it->value->set_progress(message.progress());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientConnection::handle(const Messages::WindowServer::RefreshSystemTheme&)
|
||||||
|
{
|
||||||
|
// Post the client an UpdateSystemTheme message to refresh its theme.
|
||||||
|
post_message(Messages::WindowClient::UpdateSystemTheme(Gfx::current_system_theme_buffer_id()));
|
||||||
|
}
|
||||||
|
|
||||||
void ClientConnection::handle(const Messages::WindowServer::Pong&)
|
void ClientConnection::handle(const Messages::WindowServer::Pong&)
|
||||||
{
|
{
|
||||||
m_ping_timer = nullptr;
|
m_ping_timer = nullptr;
|
||||||
|
|
|
@ -143,6 +143,7 @@ private:
|
||||||
virtual void handle(const Messages::WindowServer::EnableDisplayLink&) override;
|
virtual void handle(const Messages::WindowServer::EnableDisplayLink&) override;
|
||||||
virtual void handle(const Messages::WindowServer::DisableDisplayLink&) override;
|
virtual void handle(const Messages::WindowServer::DisableDisplayLink&) override;
|
||||||
virtual void handle(const Messages::WindowServer::SetWindowProgress&) override;
|
virtual void handle(const Messages::WindowServer::SetWindowProgress&) override;
|
||||||
|
virtual void handle(const Messages::WindowServer::RefreshSystemTheme&) override;
|
||||||
virtual void handle(const Messages::WindowServer::Pong&) override;
|
virtual void handle(const Messages::WindowServer::Pong&) override;
|
||||||
virtual OwnPtr<Messages::WindowServer::GetGlobalCursorPositionResponse> handle(const Messages::WindowServer::GetGlobalCursorPosition&) override;
|
virtual OwnPtr<Messages::WindowServer::GetGlobalCursorPositionResponse> handle(const Messages::WindowServer::GetGlobalCursorPosition&) override;
|
||||||
virtual OwnPtr<Messages::WindowServer::SetMouseAccelerationResponse> handle(const Messages::WindowServer::SetMouseAcceleration&) override;
|
virtual OwnPtr<Messages::WindowServer::SetMouseAccelerationResponse> handle(const Messages::WindowServer::SetMouseAcceleration&) override;
|
||||||
|
|
|
@ -98,6 +98,7 @@ endpoint WindowServer = 2
|
||||||
|
|
||||||
SetSystemTheme(String theme_path, [UTF8] String theme_name) => (bool success)
|
SetSystemTheme(String theme_path, [UTF8] String theme_name) => (bool success)
|
||||||
GetSystemTheme() => ([UTF8] String theme_name)
|
GetSystemTheme() => ([UTF8] String theme_name)
|
||||||
|
RefreshSystemTheme() =|
|
||||||
|
|
||||||
SetWindowBaseSizeAndSizeIncrement(i32 window_id, Gfx::IntSize base_size, Gfx::IntSize size_increment) => ()
|
SetWindowBaseSizeAndSizeIncrement(i32 window_id, Gfx::IntSize base_size, Gfx::IntSize size_increment) => ()
|
||||||
SetWindowResizeAspectRatio(i32 window_id, Optional<Gfx::IntSize> resize_aspect_ratio) => ()
|
SetWindowResizeAspectRatio(i32 window_id, Optional<Gfx::IntSize> resize_aspect_ratio) => ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue