mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 05:37:44 +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:
parent
f538545987
commit
a0e7a4b9a8
13 changed files with 61 additions and 58 deletions
|
@ -140,9 +140,7 @@ void BackgroundSettingsWidget::load_current_settings()
|
|||
|
||||
void BackgroundSettingsWidget::apply_settings()
|
||||
{
|
||||
if (GUI::Desktop::the().set_wallpaper(m_monitor_widget->wallpaper()))
|
||||
Config::write_string("WindowManager", "Background", "Wallpaper", m_monitor_widget->wallpaper());
|
||||
else
|
||||
if (!GUI::Desktop::the().set_wallpaper(m_monitor_widget->wallpaper_bitmap(), m_monitor_widget->wallpaper()))
|
||||
GUI::MessageBox::show_error(window(), String::formatted("Unable to load file {} as wallpaper", m_monitor_widget->wallpaper()));
|
||||
|
||||
GUI::Desktop::the().set_background_color(m_color_input->text());
|
||||
|
|
|
@ -58,7 +58,7 @@ bool MonitorWidget::set_wallpaper(String path)
|
|||
return true;
|
||||
}
|
||||
|
||||
String MonitorWidget::wallpaper()
|
||||
StringView MonitorWidget::wallpaper() const
|
||||
{
|
||||
return m_desktop_wallpaper_path;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ void MonitorWidget::set_wallpaper_mode(String mode)
|
|||
update();
|
||||
}
|
||||
|
||||
String MonitorWidget::wallpaper_mode()
|
||||
StringView MonitorWidget::wallpaper_mode() const
|
||||
{
|
||||
return m_desktop_wallpaper_mode;
|
||||
}
|
||||
|
|
|
@ -15,10 +15,12 @@ class MonitorWidget final : public GUI::Widget {
|
|||
|
||||
public:
|
||||
bool set_wallpaper(String path);
|
||||
String wallpaper();
|
||||
StringView wallpaper() const;
|
||||
|
||||
void set_wallpaper_mode(String mode);
|
||||
String wallpaper_mode();
|
||||
StringView wallpaper_mode() const;
|
||||
|
||||
RefPtr<Gfx::Bitmap> wallpaper_bitmap() const { return m_wallpaper_bitmap; }
|
||||
|
||||
void set_desktop_resolution(Gfx::IntSize resolution);
|
||||
Gfx::IntSize desktop_resolution();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue