mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:18:11 +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
|
@ -14,6 +14,7 @@
|
|||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <SharedGraphics/PNGLoader.h>
|
||||
|
||||
#ifdef KERNEL
|
||||
#include <Kernel/ProcFS.h>
|
||||
|
@ -22,7 +23,6 @@
|
|||
//#define DEBUG_COUNTERS
|
||||
//#define DEBUG_WID_IN_TITLE_BAR
|
||||
//#define RESIZE_DEBUG
|
||||
#define USE_WALLPAPER
|
||||
|
||||
static const int window_titlebar_height = 18;
|
||||
|
||||
|
@ -199,18 +199,8 @@ 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);
|
||||
|
||||
#ifdef USE_WALLPAPER
|
||||
m_wallpaper_path = "/res/wallpapers/retro.rgb";
|
||||
m_wallpaper = GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, m_wallpaper_path, { 1024, 768 });
|
||||
#endif
|
||||
|
||||
#ifdef KERNEL
|
||||
ProcFS::the().add_sys_bool("wm_flash_flush", m_flash_flush);
|
||||
ProcFS::the().add_sys_string("wm_wallpaper", m_wallpaper_path, [this] {
|
||||
m_wallpaper = GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, m_wallpaper_path, m_screen_rect.size());
|
||||
invalidate(m_screen_rect);
|
||||
});
|
||||
#endif
|
||||
|
||||
m_username = getlogin();
|
||||
|
||||
|
@ -351,6 +341,18 @@ void WSWindowManager::tick_clock()
|
|||
invalidate(menubar_rect());
|
||||
}
|
||||
|
||||
bool WSWindowManager::set_wallpaper(const String& path)
|
||||
{
|
||||
auto bitmap = load_png(path);
|
||||
if (!bitmap)
|
||||
return false;
|
||||
|
||||
m_wallpaper_path = path;
|
||||
m_wallpaper = move(bitmap);
|
||||
invalidate();
|
||||
return true;
|
||||
}
|
||||
|
||||
void WSWindowManager::set_resolution(int width, int height)
|
||||
{
|
||||
if (m_screen_rect.width() == width && m_screen_rect.height() == height)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue