소스 검색

WindowServer: Store system font queries in WindowServer.ini :^)

Changes to the system font settings are now persisted in /etc.
Note that you still need to restart the system for changes to fully
apply in all programs.
Andreas Kling 4 년 전
부모
커밋
59fd1f40ce
3개의 변경된 파일13개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 0
      Base/etc/WindowServer.ini
  2. 4 0
      Userland/Services/WindowServer/ClientConnection.cpp
  3. 5 2
      Userland/Services/WindowServer/main.cpp

+ 4 - 0
Base/etc/WindowServer.ini

@@ -3,6 +3,10 @@ Width=1024
 Height=768
 ScaleFactor=1
 
+[Fonts]
+Default=Katica 10 400
+FixedWidth=Csilla 10 400
+
 [Theme]
 Name=Default
 

+ 4 - 0
Userland/Services/WindowServer/ClientConnection.cpp

@@ -724,6 +724,10 @@ Messages::WindowServer::SetSystemFontsResponse ClientConnection::set_system_font
     });
 
     WindowManager::the().invalidate_after_theme_or_font_change();
+
+    auto wm_config = Core::ConfigFile::open("/etc/WindowServer.ini");
+    wm_config->write_entry("Fonts", "Default", default_font_query);
+    wm_config->write_entry("Fonts", "FixedWidth", fixed_width_font_query);
     return true;
 }
 

+ 5 - 2
Userland/Services/WindowServer/main.cpp

@@ -62,8 +62,11 @@ 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");
+    auto default_font_query = wm_config->read_entry("Fonts", "Default", "Katica 10 400");
+    auto fixed_width_font_query = wm_config->read_entry("Fonts", "FixedWidth", "Csilla 10 400");
+
+    Gfx::FontDatabase::set_default_font_query(default_font_query);
+    Gfx::FontDatabase::set_fixed_width_font_query(fixed_width_font_query);
 
     WindowServer::EventLoop loop;