mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:57:35 +00:00
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.
This commit is contained in:
parent
66ad739934
commit
bb23e61fbf
11 changed files with 76 additions and 15 deletions
|
@ -7,6 +7,7 @@
|
|||
#include <AK/Badge.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/FontDatabase.h>
|
||||
#include <LibGfx/SystemTheme.h>
|
||||
#include <LibJS/Console.h>
|
||||
#include <LibJS/Heap/Heap.h>
|
||||
|
@ -69,6 +70,12 @@ void ClientConnection::update_system_theme(const Core::AnonymousBuffer& theme_bu
|
|||
m_page_host->set_palette_impl(*impl);
|
||||
}
|
||||
|
||||
void ClientConnection::update_system_fonts(String const& default_font_query, String const& 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 ClientConnection::update_screen_rect(const Gfx::IntRect& rect)
|
||||
{
|
||||
m_page_host->set_screen_rect(rect);
|
||||
|
|
|
@ -34,6 +34,7 @@ private:
|
|||
|
||||
virtual void greet() override;
|
||||
virtual void update_system_theme(Core::AnonymousBuffer const&) override;
|
||||
virtual void update_system_fonts(String const&, String const&) override;
|
||||
virtual void update_screen_rect(Gfx::IntRect const&) override;
|
||||
virtual void load_url(URL const&) override;
|
||||
virtual void load_html(String const&, URL const&) override;
|
||||
|
|
|
@ -3,6 +3,7 @@ endpoint WebContentServer
|
|||
greet() => ()
|
||||
|
||||
update_system_theme(Core::AnonymousBuffer theme_buffer) =|
|
||||
update_system_fonts(String default_font_query, String fixed_width_font_query) =|
|
||||
update_screen_rect(Gfx::IntRect rect) =|
|
||||
|
||||
load_url(URL url) =|
|
||||
|
|
|
@ -54,7 +54,7 @@ ClientConnection::ClientConnection(NonnullRefPtr<Core::LocalSocket> client_socke
|
|||
s_connections = new HashMap<int, NonnullRefPtr<ClientConnection>>;
|
||||
s_connections->set(client_id, *this);
|
||||
|
||||
async_fast_greet(Screen::the().rect(), Gfx::current_system_theme_buffer());
|
||||
async_fast_greet(Screen::the().rect(), Gfx::current_system_theme_buffer(), Gfx::FontDatabase::default_font_query(), Gfx::FontDatabase::fixed_width_font_query());
|
||||
}
|
||||
|
||||
ClientConnection::~ClientConnection()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
endpoint WindowClient
|
||||
{
|
||||
fast_greet(Gfx::IntRect screen_rect, Core::AnonymousBuffer theme_buffer) =|
|
||||
fast_greet(Gfx::IntRect screen_rect, Core::AnonymousBuffer theme_buffer, String default_font_query, String fixed_width_font_query) =|
|
||||
|
||||
paint(i32 window_id, Gfx::IntSize window_size, Vector<Gfx::IntRect> rects) =|
|
||||
mouse_move(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta, bool is_drag, Vector<String> mime_types) =|
|
||||
|
@ -35,6 +35,7 @@ endpoint WindowClient
|
|||
drag_dropped(i32 window_id, Gfx::IntPoint mouse_position, [UTF8] String text, HashMap<String,ByteBuffer> mime_data) =|
|
||||
|
||||
update_system_theme(Core::AnonymousBuffer theme_buffer) =|
|
||||
update_system_fonts(String default_font_query, String fixed_width_font_query) =|
|
||||
|
||||
display_link_notification() =|
|
||||
|
||||
|
|
|
@ -62,6 +62,9 @@ int main(int, char**)
|
|||
Gfx::set_system_theme(theme);
|
||||
auto palette = Gfx::PaletteImpl::create_with_anonymous_buffer(theme);
|
||||
|
||||
Gfx::FontDatabase::set_default_font_query("Katica 10 400");
|
||||
Gfx::FontDatabase::set_fixed_width_font_query("Csilla 10 400");
|
||||
|
||||
WindowServer::EventLoop loop;
|
||||
|
||||
if (pledge("stdio video thread sendfd recvfd accept rpath wpath cpath proc", nullptr) < 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue