mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-21 18:37:58 +03:00
WindowServer: Allow changing the desktop wallpaper through a sysctl.
Just write the path of your new wallpaper to /proc/sys/wm_wallpaper. :^)
This commit is contained in:
parent
cda598c29c
commit
7a996e608c
Notes:
sideshowbarker
2024-07-19 15:49:34 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/7a996e608ce
@ -162,7 +162,18 @@ WSWindowManager::WSWindowManager()
|
||||
m_cursor_bitmap_inner = CharacterBitmap::create_from_ascii(cursor_bitmap_inner_ascii, 12, 17);
|
||||
m_cursor_bitmap_outer = CharacterBitmap::create_from_ascii(cursor_bitmap_outer_ascii, 12, 17);
|
||||
|
||||
{
|
||||
LOCKER(m_wallpaper_path.lock());
|
||||
m_wallpaper_path.resource() = "/res/wallpapers/gray-wood.rgb";
|
||||
m_wallpaper = GraphicsBitmap::load_from_file(m_wallpaper_path.resource(), m_screen_rect.size());
|
||||
}
|
||||
|
||||
ProcFS::the().add_sys_bool("wm_flash_flush", &m_flash_flush);
|
||||
ProcFS::the().add_sys_string("wm_wallpaper", m_wallpaper_path, [this] {
|
||||
LOCKER(m_wallpaper_path.lock());
|
||||
m_wallpaper = GraphicsBitmap::load_from_file(m_wallpaper_path.resource(), m_screen_rect.size());
|
||||
invalidate(m_screen_rect);
|
||||
});
|
||||
|
||||
invalidate();
|
||||
compose();
|
||||
@ -426,14 +437,12 @@ void WSWindowManager::compose()
|
||||
return false;
|
||||
};
|
||||
|
||||
if (!m_wallpaper)
|
||||
m_wallpaper = GraphicsBitmap::load_from_file("/res/wallpapers/gray-wood.rgb", { 1024, 768 });
|
||||
|
||||
for (auto& dirty_rect : dirty_rects) {
|
||||
if (any_window_contains_rect(dirty_rect)) {
|
||||
continue;
|
||||
}
|
||||
//dbgprintf("Repaint root %d,%d %dx%d\n", dirty_rect.x(), dirty_rect.y(), dirty_rect.width(), dirty_rect.height());
|
||||
LOCKER(m_wallpaper_path.lock());
|
||||
if (!m_wallpaper)
|
||||
m_back_painter->fill_rect(dirty_rect, m_background_color);
|
||||
else
|
||||
|
@ -105,6 +105,7 @@ private:
|
||||
|
||||
RetainPtr<Font> m_font;
|
||||
|
||||
Lockable<String> m_wallpaper_path;
|
||||
RetainPtr<GraphicsBitmap> m_wallpaper;
|
||||
|
||||
mutable Lock m_lock;
|
||||
|
Loading…
Reference in New Issue
Block a user