mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:58:11 +00:00
LibGUI: Revert GWindowServerConnection to being a singleton
This was a mistake, of course. Nested event loops don't need (or want) independent server connections. We initialize the connection early in GEventLoop for e.g. users that want to get the size of a GDesktop before the connection has been established. Bug noticed by Andreas, introduced by me ;-)
This commit is contained in:
parent
4adbddeb36
commit
7a53096e8d
10 changed files with 50 additions and 40 deletions
|
@ -31,7 +31,7 @@ bool GDesktop::set_wallpaper(const StringView& path)
|
|||
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);
|
||||
auto response = GWindowServerConnection::the().sync_request(message, WSAPI_ServerMessage::Type::DidSetWallpaper);
|
||||
return response.value;
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,6 @@ 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);
|
||||
auto response = GWindowServerConnection::the().sync_request(message, WSAPI_ServerMessage::Type::DidGetWallpaper);
|
||||
return String(response.text, response.text_length);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue