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