mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:52:45 +00:00 
			
		
		
		
	WindowServer+SystemMenu: Check the current system theme on startup
This commit is contained in:
		
							parent
							
								
									b6d035aa05
								
							
						
					
					
						commit
						0fa7cf70b5
					
				
					 4 changed files with 13 additions and 0 deletions
				
			
		|  | @ -185,6 +185,8 @@ NonnullRefPtr<GUI::Menu> build_system_menu() | ||||||
|         quick_sort(g_themes, [](auto& a, auto& b) { return a.name < b.name; }); |         quick_sort(g_themes, [](auto& a, auto& b) { return a.name < b.name; }); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     auto current_theme_name = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::GetSystemTheme>()->theme_name(); | ||||||
|  | 
 | ||||||
|     { |     { | ||||||
|         int theme_identifier = 0; |         int theme_identifier = 0; | ||||||
|         for (auto& theme : g_themes) { |         for (auto& theme : g_themes) { | ||||||
|  | @ -194,6 +196,8 @@ NonnullRefPtr<GUI::Menu> build_system_menu() | ||||||
|                 auto response = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetSystemTheme>(theme.path, theme.name); |                 auto response = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetSystemTheme>(theme.path, theme.name); | ||||||
|                 ASSERT(response->success()); |                 ASSERT(response->success()); | ||||||
|             }); |             }); | ||||||
|  |             if (theme.name == current_theme_name) | ||||||
|  |                 action->set_checked(true); | ||||||
|             g_themes_group.add_action(action); |             g_themes_group.add_action(action); | ||||||
|             g_themes_menu->add_action(action); |             g_themes_menu->add_action(action); | ||||||
|             ++theme_identifier; |             ++theme_identifier; | ||||||
|  |  | ||||||
|  | @ -730,6 +730,13 @@ OwnPtr<Messages::WindowServer::SetSystemThemeResponse> ClientConnection::handle( | ||||||
|     return make<Messages::WindowServer::SetSystemThemeResponse>(success); |     return make<Messages::WindowServer::SetSystemThemeResponse>(success); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | OwnPtr<Messages::WindowServer::GetSystemThemeResponse> ClientConnection::handle(const Messages::WindowServer::GetSystemTheme&) | ||||||
|  | { | ||||||
|  |     auto wm_config = Core::ConfigFile::open("/etc/WindowServer/WindowServer.ini"); | ||||||
|  |     auto name = wm_config->read_entry("Theme", "Name"); | ||||||
|  |     return make<Messages::WindowServer::GetSystemThemeResponse>(name); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void ClientConnection::boost() | void ClientConnection::boost() | ||||||
| { | { | ||||||
|     // FIXME: Re-enable this when we have a solution for boosting.
 |     // FIXME: Re-enable this when we have a solution for boosting.
 | ||||||
|  |  | ||||||
|  | @ -122,6 +122,7 @@ private: | ||||||
|     virtual OwnPtr<Messages::WindowServer::StartDragResponse> handle(const Messages::WindowServer::StartDrag&) override; |     virtual OwnPtr<Messages::WindowServer::StartDragResponse> handle(const Messages::WindowServer::StartDrag&) override; | ||||||
|     virtual OwnPtr<Messages::WindowServer::SetSystemMenuResponse> handle(const Messages::WindowServer::SetSystemMenu&) override; |     virtual OwnPtr<Messages::WindowServer::SetSystemMenuResponse> handle(const Messages::WindowServer::SetSystemMenu&) override; | ||||||
|     virtual OwnPtr<Messages::WindowServer::SetSystemThemeResponse> handle(const Messages::WindowServer::SetSystemTheme&) override; |     virtual OwnPtr<Messages::WindowServer::SetSystemThemeResponse> handle(const Messages::WindowServer::SetSystemTheme&) override; | ||||||
|  |     virtual OwnPtr<Messages::WindowServer::GetSystemThemeResponse> handle(const Messages::WindowServer::GetSystemTheme&) override; | ||||||
|     virtual OwnPtr<Messages::WindowServer::SetWindowBaseSizeAndSizeIncrementResponse> handle(const Messages::WindowServer::SetWindowBaseSizeAndSizeIncrement&) override; |     virtual OwnPtr<Messages::WindowServer::SetWindowBaseSizeAndSizeIncrementResponse> handle(const Messages::WindowServer::SetWindowBaseSizeAndSizeIncrement&) override; | ||||||
|     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; | ||||||
|  |  | ||||||
|  | @ -87,6 +87,7 @@ endpoint WindowServer = 2 | ||||||
|     StartDrag(String text, String data_type, String data, i32 bitmap_id, Gfx::Size bitmap_size) => (bool started) |     StartDrag(String text, String data_type, String data, i32 bitmap_id, Gfx::Size bitmap_size) => (bool started) | ||||||
| 
 | 
 | ||||||
|     SetSystemTheme(String theme_path, String theme_name) => (bool success) |     SetSystemTheme(String theme_path, String theme_name) => (bool success) | ||||||
|  |     GetSystemTheme() => (String theme_name) | ||||||
| 
 | 
 | ||||||
|     SetWindowBaseSizeAndSizeIncrement(i32 window_id, Gfx::Size base_size, Gfx::Size size_increment) => () |     SetWindowBaseSizeAndSizeIncrement(i32 window_id, Gfx::Size base_size, Gfx::Size size_increment) => () | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling