summaryrefslogtreecommitdiff
path: root/Userland/Services
diff options
context:
space:
mode:
authorKarol Kosek <krkk@serenityos.org>2021-11-21 18:51:39 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-11-26 11:30:55 -0800
commit65f3a259d2801a848bc2dacd1f15d7c26c1a65fc (patch)
treef0d8dfb3900e3b7a3196ad02f6bf340a6fa13e6b /Userland/Services
parentbffdc056a22429ea6a17908ac479de20b41df660 (diff)
downloadserenity-65f3a259d2801a848bc2dacd1f15d7c26c1a65fc.zip
WindowServer: Clear wallpaper if the requested path is empty
235f39e449 secretly added an if check that ignores all the files that couldn't be loaded into bitmaps. Unfortunately, we send an empty path as a way to unset the wallpaper, which meant that we couldn't go back to the default background color anymore.
Diffstat (limited to 'Userland/Services')
-rw-r--r--Userland/Services/WindowServer/Compositor.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp
index f1b65b4a80..68cff53096 100644
--- a/Userland/Services/WindowServer/Compositor.cpp
+++ b/Userland/Services/WindowServer/Compositor.cpp
@@ -813,12 +813,15 @@ bool Compositor::set_wallpaper(const String& path, Function<void(bool)>&& callba
},
[this, path, callback = move(callback)](ErrorOr<NonnullRefPtr<Gfx::Bitmap>> bitmap) {
- if (bitmap.is_error()) {
+ if (bitmap.is_error() && !path.is_empty()) {
callback(false);
return;
}
m_wallpaper_path = path;
- m_wallpaper = bitmap.release_value();
+ if (bitmap.is_error())
+ m_wallpaper = nullptr;
+ else
+ m_wallpaper = bitmap.release_value();
invalidate_screen();
callback(true);
});