diff options
author | Andreas Kling <kling@serenityos.org> | 2021-05-21 18:10:23 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-21 20:15:51 +0200 |
commit | bb23e61fbff779f56dd18cf4abd6ae5c0f8d8514 (patch) | |
tree | 580ba33767f3124693003dfd8a0e767865327e3e /Userland/Libraries/LibGUI/WindowServerConnection.cpp | |
parent | 66ad73993468807b8dff5367794acd66ebee1e59 (diff) | |
download | serenity-bb23e61fbff779f56dd18cf4abd6ae5c0f8d8514.zip |
LibGfx+WindowServer: Have WindowServer broadcast system font settings
Instead of everybody getting their system fonts from Gfx::FontDatabase
(where it's all hardcoded), they now get it from WindowServer.
These are then plumbed into the usual Gfx::FontDatabase places so that
the old default_font() and default_fixed_width_font() APIs keep working.
Diffstat (limited to 'Userland/Libraries/LibGUI/WindowServerConnection.cpp')
-rw-r--r-- | Userland/Libraries/LibGUI/WindowServerConnection.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/WindowServerConnection.cpp b/Userland/Libraries/LibGUI/WindowServerConnection.cpp index d51d57d1e3..ac9ff33b5a 100644 --- a/Userland/Libraries/LibGUI/WindowServerConnection.cpp +++ b/Userland/Libraries/LibGUI/WindowServerConnection.cpp @@ -21,6 +21,7 @@ #include <LibGUI/Window.h> #include <LibGUI/WindowServerConnection.h> #include <LibGfx/Bitmap.h> +#include <LibGfx/FontDatabase.h> #include <LibGfx/Palette.h> #include <LibGfx/SystemTheme.h> @@ -47,9 +48,11 @@ void WindowServerConnection::handshake() auto message = wait_for_specific_message<Messages::WindowClient::FastGreet>(); set_system_theme_from_anonymous_buffer(message->theme_buffer()); Desktop::the().did_receive_screen_rect({}, message->screen_rect()); + Gfx::FontDatabase::set_default_font_query(message->default_font_query()); + Gfx::FontDatabase::set_fixed_width_font_query(message->fixed_width_font_query()); } -void WindowServerConnection::fast_greet(Gfx::IntRect const&, Core::AnonymousBuffer const&) +void WindowServerConnection::fast_greet(Gfx::IntRect const&, Core::AnonymousBuffer const&, String const&, String const&) { // NOTE: This message is handled in handshake(). } @@ -63,6 +66,12 @@ void WindowServerConnection::update_system_theme(Core::AnonymousBuffer const& th }); } +void WindowServerConnection::update_system_fonts(const String& default_font_query, const String& fixed_width_font_query) +{ + Gfx::FontDatabase::set_default_font_query(default_font_query); + Gfx::FontDatabase::set_fixed_width_font_query(fixed_width_font_query); +} + void WindowServerConnection::paint(i32 window_id, Gfx::IntSize const& window_size, Vector<Gfx::IntRect> const& rects) { if (auto* window = Window::from_window_id(window_id)) |