mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:57:44 +00:00
WindowServer: Support PNG wallpapers.
Fix up /bin/pape so it tells the WindowServer which wallpaper file to use.
This commit is contained in:
parent
fe25f957e5
commit
e4dfd5a3a4
15 changed files with 150 additions and 12890 deletions
34
LibGUI/GDesktop.cpp
Normal file
34
LibGUI/GDesktop.cpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include <LibGUI/GDesktop.h>
|
||||
#include <LibGUI/GEventLoop.h>
|
||||
#include <string.h>
|
||||
|
||||
GDesktop& GDesktop::the()
|
||||
{
|
||||
static GDesktop* s_the;
|
||||
if (!s_the)
|
||||
s_the = new GDesktop;
|
||||
return *s_the;
|
||||
}
|
||||
|
||||
GDesktop::GDesktop()
|
||||
{
|
||||
}
|
||||
|
||||
bool GDesktop::set_wallpaper(const String& path)
|
||||
{
|
||||
WSAPI_ClientMessage message;
|
||||
message.type = WSAPI_ClientMessage::Type::SetWallpaper;
|
||||
ASSERT(path.length() < (int)sizeof(message.text));
|
||||
strncpy(message.text, path.characters(), path.length());
|
||||
message.text_length = path.length();
|
||||
auto response = GEventLoop::current().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().sync_request(message, WSAPI_ServerMessage::Type::DidGetWallpaper);
|
||||
return String(response.text, response.text_length);
|
||||
}
|
17
LibGUI/GDesktop.h
Normal file
17
LibGUI/GDesktop.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/AKString.h>
|
||||
#include <SharedGraphics/Rect.h>
|
||||
|
||||
class GDesktop {
|
||||
public:
|
||||
static GDesktop& the();
|
||||
|
||||
String wallpaper() const;
|
||||
bool set_wallpaper(const String& path);
|
||||
|
||||
private:
|
||||
GDesktop();
|
||||
|
||||
Rect m_rect;
|
||||
};
|
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
void quit(int);
|
||||
|
||||
bool post_message_to_server(const WSAPI_ClientMessage&);
|
||||
static bool post_message_to_server(const WSAPI_ClientMessage&);
|
||||
bool wait_for_specific_event(WSAPI_ServerMessage::Type, WSAPI_ServerMessage&);
|
||||
|
||||
WSAPI_ServerMessage sync_request(const WSAPI_ClientMessage& request, WSAPI_ServerMessage::Type response_type);
|
||||
|
|
|
@ -46,6 +46,7 @@ LIBGUI_OBJS = \
|
|||
GMessageBox.o \
|
||||
GInputBox.o \
|
||||
GDialog.o \
|
||||
GDesktop.o \
|
||||
GWindow.o
|
||||
|
||||
OBJS = $(SHAREDGRAPHICS_OBJS) $(LIBGUI_OBJS)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue