1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:47:34 +00:00

WindowServer+Userland: Pass wallpapers as Gfx::Bitmap instead of path

The WindowServer _really_ does not need to know the filesystem path to
it's wallpaper, and allows setting arbitrary wallpapers (those outside
of `/res/wallpapers`).

The GUI::Desktop will keep track of the path to the wallpaper (if any),
and save it to config if desired (to be persisted).

This avoids the need to `unveil` paths to the wallpaper, fixing #11158
This commit is contained in:
James Puleo 2022-02-13 13:00:57 -05:00 committed by Ali Mohammad Pur
parent f538545987
commit a0e7a4b9a8
13 changed files with 61 additions and 58 deletions

View file

@ -292,11 +292,10 @@ void ClientConnection::set_window_opacity(i32 window_id, float opacity)
it->value->set_opacity(opacity);
}
void ClientConnection::set_wallpaper(String const& path)
void ClientConnection::set_wallpaper(Gfx::ShareableBitmap const& bitmap)
{
Compositor::the().set_wallpaper(path, [&](bool success) {
async_set_wallpaper_finished(success);
});
Compositor::the().set_wallpaper(bitmap.bitmap());
async_set_wallpaper_finished(true);
}
void ClientConnection::set_background_color(String const& background_color)
@ -311,7 +310,7 @@ void ClientConnection::set_wallpaper_mode(String const& mode)
Messages::WindowServer::GetWallpaperResponse ClientConnection::get_wallpaper()
{
return Compositor::the().wallpaper_path();
return Compositor::the().wallpaper_bitmap()->to_shareable_bitmap();
}
Messages::WindowServer::SetScreenLayoutResponse ClientConnection::set_screen_layout(ScreenLayout const& screen_layout, bool save)