2019-03-21 15:54:19 +01:00
|
|
|
#include <LibGUI/GDesktop.h>
|
2019-11-08 11:39:45 +01:00
|
|
|
#include <LibGUI/GWindowServerConnection.h>
|
2019-03-21 15:54:19 +01:00
|
|
|
#include <string.h>
|
2019-04-03 17:22:14 +02:00
|
|
|
#include <unistd.h>
|
2019-03-21 15:54:19 +01:00
|
|
|
|
|
|
|
|
GDesktop& GDesktop::the()
|
|
|
|
|
{
|
2019-04-05 05:10:18 +02:00
|
|
|
static GDesktop* the;
|
|
|
|
|
if (!the)
|
|
|
|
|
the = new GDesktop;
|
|
|
|
|
return *the;
|
2019-03-21 15:54:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GDesktop::GDesktop()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-17 18:28:30 +02:00
|
|
|
void GDesktop::did_receive_screen_rect(Badge<GWindowServerConnection>, const Rect& rect)
|
2019-04-03 17:22:14 +02:00
|
|
|
{
|
2019-04-03 19:38:44 +02:00
|
|
|
if (m_rect == rect)
|
|
|
|
|
return;
|
2019-04-03 17:22:14 +02:00
|
|
|
m_rect = rect;
|
2019-04-03 19:38:44 +02:00
|
|
|
if (on_rect_change)
|
|
|
|
|
on_rect_change(rect);
|
2019-04-03 17:22:14 +02:00
|
|
|
}
|
|
|
|
|
|
2019-06-02 14:58:02 +02:00
|
|
|
bool GDesktop::set_wallpaper(const StringView& path)
|
2019-03-21 15:54:19 +01:00
|
|
|
{
|
2019-12-02 09:33:37 +01:00
|
|
|
GWindowServerConnection::the().post_message(WindowServer::AsyncSetWallpaper(path));
|
|
|
|
|
return GWindowServerConnection::the().wait_for_specific_message<WindowClient::AsyncSetWallpaperFinished>()->success();
|
2019-03-21 15:54:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String GDesktop::wallpaper() const
|
|
|
|
|
{
|
2019-12-02 09:33:37 +01:00
|
|
|
return GWindowServerConnection::the().send_sync<WindowServer::GetWallpaper>()->path();
|
2019-03-21 15:54:19 +01:00
|
|
|
}
|