From 0363cd3d551753e435b9765f49ea2e7d7bc18a27 Mon Sep 17 00:00:00 2001 From: Maciej Zygmanowski Date: Sun, 1 Aug 2021 17:23:31 +0200 Subject: [PATCH] WindowServer: Add IPC calls for controlling cursor theme This commit adds two new IPC calls for WindowServer: apply_cursor_theme and get_cursor_theme. --- Userland/Services/WindowServer/ClientConnection.cpp | 12 ++++++++++++ Userland/Services/WindowServer/ClientConnection.h | 2 ++ Userland/Services/WindowServer/WindowServer.ipc | 3 +++ 3 files changed, 17 insertions(+) diff --git a/Userland/Services/WindowServer/ClientConnection.cpp b/Userland/Services/WindowServer/ClientConnection.cpp index 035f329047..38ae778882 100644 --- a/Userland/Services/WindowServer/ClientConnection.cpp +++ b/Userland/Services/WindowServer/ClientConnection.cpp @@ -758,6 +758,18 @@ Messages::WindowServer::GetSystemThemeResponse ClientConnection::get_system_them return name; } +void ClientConnection::apply_cursor_theme(String const& name) +{ + WindowManager::the().apply_cursor_theme(name); +} + +Messages::WindowServer::GetCursorThemeResponse ClientConnection::get_cursor_theme() +{ + auto config = Core::ConfigFile::open("/etc/WindowServer.ini"); + auto name = config->read_entry("Mouse", "CursorTheme"); + return name; +} + Messages::WindowServer::SetSystemFontsResponse ClientConnection::set_system_fonts(String const& default_font_query, String const& fixed_width_font_query) { if (!Gfx::FontDatabase::the().get_by_name(default_font_query) diff --git a/Userland/Services/WindowServer/ClientConnection.h b/Userland/Services/WindowServer/ClientConnection.h index d315ef1447..eddfc8bb02 100644 --- a/Userland/Services/WindowServer/ClientConnection.h +++ b/Userland/Services/WindowServer/ClientConnection.h @@ -139,6 +139,8 @@ private: virtual Messages::WindowServer::StartDragResponse start_drag(String const&, HashMap const&, Gfx::ShareableBitmap const&) override; virtual Messages::WindowServer::SetSystemThemeResponse set_system_theme(String const&, String const&) 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; virtual Messages::WindowServer::SetSystemFontsResponse set_system_fonts(String const&, String const&) override; virtual void set_window_base_size_and_size_increment(i32, Gfx::IntSize const&, Gfx::IntSize const&) override; virtual void set_window_resize_aspect_ratio(i32, Optional const&) override; diff --git a/Userland/Services/WindowServer/WindowServer.ipc b/Userland/Services/WindowServer/WindowServer.ipc index 14e7e0bd99..41accd5251 100644 --- a/Userland/Services/WindowServer/WindowServer.ipc +++ b/Userland/Services/WindowServer/WindowServer.ipc @@ -114,6 +114,9 @@ endpoint WindowServer get_system_theme() => ([UTF8] String theme_name) refresh_system_theme() =| + apply_cursor_theme(String name) =| + get_cursor_theme() => (String name) + set_system_fonts(String default_font_query, String fixed_width_font_query) => (bool success) set_window_base_size_and_size_increment(i32 window_id, Gfx::IntSize base_size, Gfx::IntSize size_increment) =|