mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 13:17:35 +00:00
WindowServer+DisplaySettings: Remove the weird "simple" wallpaper mode
Painting the wallpaper at 100% scale in the top left corner is a weird mode and I don't think we need it. :^)
This commit is contained in:
parent
3046b3467c
commit
93ef661914
4 changed files with 9 additions and 17 deletions
|
@ -26,7 +26,6 @@ namespace DisplaySettings {
|
||||||
|
|
||||||
BackgroundSettingsWidget::BackgroundSettingsWidget()
|
BackgroundSettingsWidget::BackgroundSettingsWidget()
|
||||||
{
|
{
|
||||||
m_modes.append("simple");
|
|
||||||
m_modes.append("tile");
|
m_modes.append("tile");
|
||||||
m_modes.append("center");
|
m_modes.append("center");
|
||||||
m_modes.append("stretch");
|
m_modes.append("stretch");
|
||||||
|
@ -96,10 +95,10 @@ void BackgroundSettingsWidget::load_current_settings()
|
||||||
m_monitor_widget->set_wallpaper(selected_wallpaper);
|
m_monitor_widget->set_wallpaper(selected_wallpaper);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto mode = ws_config->read_entry("Background", "Mode", "simple");
|
auto mode = ws_config->read_entry("Background", "Mode", "center");
|
||||||
if (!m_modes.contains_slow(mode)) {
|
if (!m_modes.contains_slow(mode)) {
|
||||||
warnln("Invalid background mode '{}' in WindowServer config, falling back to 'simple'", mode);
|
warnln("Invalid background mode '{}' in WindowServer config, falling back to 'center'", mode);
|
||||||
mode = "simple";
|
mode = "center";
|
||||||
}
|
}
|
||||||
m_monitor_widget->set_wallpaper_mode(mode);
|
m_monitor_widget->set_wallpaper_mode(mode);
|
||||||
m_mode_combo->set_selected_index(m_modes.find_first_index(mode).value_or(0));
|
m_mode_combo->set_selected_index(m_modes.find_first_index(mode).value_or(0));
|
||||||
|
|
|
@ -104,9 +104,7 @@ void MonitorWidget::redraw_desktop_if_needed()
|
||||||
auto scaled_size = m_wallpaper_bitmap->size().to_type<float>().scaled_by(sw, sh).to_type<int>();
|
auto scaled_size = m_wallpaper_bitmap->size().to_type<float>().scaled_by(sw, sh).to_type<int>();
|
||||||
auto scaled_bitmap = m_wallpaper_bitmap->scaled(sw, sh);
|
auto scaled_bitmap = m_wallpaper_bitmap->scaled(sw, sh);
|
||||||
|
|
||||||
if (m_desktop_wallpaper_mode == "simple") {
|
if (m_desktop_wallpaper_mode == "center") {
|
||||||
painter.blit({}, *scaled_bitmap, scaled_bitmap->rect());
|
|
||||||
} else if (m_desktop_wallpaper_mode == "center") {
|
|
||||||
Gfx::IntRect centered_rect { {}, scaled_size };
|
Gfx::IntRect centered_rect { {}, scaled_size };
|
||||||
centered_rect.center_within(m_desktop_bitmap->rect());
|
centered_rect.center_within(m_desktop_bitmap->rect());
|
||||||
painter.blit(centered_rect.location(), *scaled_bitmap, scaled_bitmap->rect());
|
painter.blit(centered_rect.location(), *scaled_bitmap, scaled_bitmap->rect());
|
||||||
|
|
|
@ -30,15 +30,13 @@ Compositor& Compositor::the()
|
||||||
|
|
||||||
static WallpaperMode mode_to_enum(const String& name)
|
static WallpaperMode mode_to_enum(const String& name)
|
||||||
{
|
{
|
||||||
if (name == "simple")
|
|
||||||
return WallpaperMode::Simple;
|
|
||||||
if (name == "tile")
|
if (name == "tile")
|
||||||
return WallpaperMode::Tile;
|
return WallpaperMode::Tile;
|
||||||
if (name == "center")
|
|
||||||
return WallpaperMode::Center;
|
|
||||||
if (name == "stretch")
|
if (name == "stretch")
|
||||||
return WallpaperMode::Stretch;
|
return WallpaperMode::Stretch;
|
||||||
return WallpaperMode::Simple;
|
if (name == "center")
|
||||||
|
return WallpaperMode::Center;
|
||||||
|
return WallpaperMode::Center;
|
||||||
}
|
}
|
||||||
|
|
||||||
Compositor::Compositor()
|
Compositor::Compositor()
|
||||||
|
@ -92,7 +90,7 @@ void Compositor::init_bitmaps()
|
||||||
void Compositor::did_construct_window_manager(Badge<WindowManager>)
|
void Compositor::did_construct_window_manager(Badge<WindowManager>)
|
||||||
{
|
{
|
||||||
auto& wm = WindowManager::the();
|
auto& wm = WindowManager::the();
|
||||||
m_wallpaper_mode = mode_to_enum(wm.config()->read_entry("Background", "Mode", "simple"));
|
m_wallpaper_mode = mode_to_enum(wm.config()->read_entry("Background", "Mode", "center"));
|
||||||
m_custom_background_color = Color::from_string(wm.config()->read_entry("Background", "Color", ""));
|
m_custom_background_color = Color::from_string(wm.config()->read_entry("Background", "Color", ""));
|
||||||
|
|
||||||
invalidate_screen();
|
invalidate_screen();
|
||||||
|
@ -226,9 +224,7 @@ void Compositor::compose()
|
||||||
// FIXME: If the wallpaper is opaque and covers the whole rect, no need to fill with color!
|
// FIXME: If the wallpaper is opaque and covers the whole rect, no need to fill with color!
|
||||||
painter.fill_rect(rect, background_color);
|
painter.fill_rect(rect, background_color);
|
||||||
if (m_wallpaper) {
|
if (m_wallpaper) {
|
||||||
if (m_wallpaper_mode == WallpaperMode::Simple) {
|
if (m_wallpaper_mode == WallpaperMode::Center) {
|
||||||
painter.blit(rect.location(), *m_wallpaper, rect);
|
|
||||||
} else if (m_wallpaper_mode == WallpaperMode::Center) {
|
|
||||||
Gfx::IntPoint offset { (ws.width() - m_wallpaper->width()) / 2, (ws.height() - m_wallpaper->height()) / 2 };
|
Gfx::IntPoint offset { (ws.width() - m_wallpaper->width()) / 2, (ws.height() - m_wallpaper->height()) / 2 };
|
||||||
painter.blit_offset(rect.location(), *m_wallpaper, rect, offset);
|
painter.blit_offset(rect.location(), *m_wallpaper, rect, offset);
|
||||||
} else if (m_wallpaper_mode == WallpaperMode::Tile) {
|
} else if (m_wallpaper_mode == WallpaperMode::Tile) {
|
||||||
|
|
|
@ -20,7 +20,6 @@ class Window;
|
||||||
class WindowManager;
|
class WindowManager;
|
||||||
|
|
||||||
enum class WallpaperMode {
|
enum class WallpaperMode {
|
||||||
Simple,
|
|
||||||
Tile,
|
Tile,
|
||||||
Center,
|
Center,
|
||||||
Stretch,
|
Stretch,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue