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.
This commit is contained in:
Karol Kosek 2021-11-21 18:51:39 +01:00 committed by Brian Gianforcaro
parent bffdc056a2
commit 65f3a259d2
Notes: sideshowbarker 2024-07-18 00:39:49 +09:00

View File

@ -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);
});