mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 21:30:58 +00:00 
			
		
		
		
	 2177594c96
			
		
	
	
		2177594c96
		
	
	
	
	
		
			
			As a consequence, move to use an explicit handshake() method rather than calling virtuals from the constructor. This seemed to not bother AClientConnection, but LibGUI crashes (rightfully) because of it.
		
			
				
	
	
		
			44 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include <LibGUI/GDesktop.h>
 | |
| #include <LibGUI/GEventLoop.h>
 | |
| #include <string.h>
 | |
| #include <unistd.h>
 | |
| 
 | |
| GDesktop& GDesktop::the()
 | |
| {
 | |
|     static GDesktop* the;
 | |
|     if (!the)
 | |
|         the = new GDesktop;
 | |
|     return *the;
 | |
| }
 | |
| 
 | |
| GDesktop::GDesktop()
 | |
| {
 | |
| }
 | |
| 
 | |
| void GDesktop::did_receive_screen_rect(Badge<GWindowServerConnection>, const Rect& rect)
 | |
| {
 | |
|     if (m_rect == rect)
 | |
|         return;
 | |
|     m_rect = rect;
 | |
|     if (on_rect_change)
 | |
|         on_rect_change(rect);
 | |
| }
 | |
| 
 | |
| bool GDesktop::set_wallpaper(const StringView& path)
 | |
| {
 | |
|     WSAPI_ClientMessage message;
 | |
|     message.type = WSAPI_ClientMessage::Type::SetWallpaper;
 | |
|     ASSERT(path.length() < (int)sizeof(message.text));
 | |
|     strncpy(message.text, path.characters_without_null_termination(), path.length());
 | |
|     message.text_length = path.length();
 | |
|     auto response = GEventLoop::current().connection().sync_request(message, WSAPI_ServerMessage::Type::DidSetWallpaper);
 | |
|     return response.value;
 | |
| }
 | |
| 
 | |
| String GDesktop::wallpaper() const
 | |
| {
 | |
|     WSAPI_ClientMessage message;
 | |
|     message.type = WSAPI_ClientMessage::Type::GetWallpaper;
 | |
|     auto response = GEventLoop::current().connection().sync_request(message, WSAPI_ServerMessage::Type::DidGetWallpaper);
 | |
|     return String(response.text, response.text_length);
 | |
| }
 |