From 17ce422c7e6e4f02977468056570f4ee598ed2a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20S=C3=A1lyi?= Date: Fri, 25 Apr 2025 20:09:37 +0200 Subject: [PATCH] Redraw wallpaper on scale factor change --- src/wayland.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/wayland.rs b/src/wayland.rs index b2e6d39..0b1c3b5 100644 --- a/src/wayland.rs +++ b/src/wayland.rs @@ -680,7 +680,8 @@ impl OutputHandler for State { or low quality due to scaling"); } - let surface = bg_layer.layer.wl_surface(); + let layer = &bg_layer.layer; + let surface = layer.wl_surface(); if width == logical_width || height == logical_height { debug!("Output {} needs no scaling", output_name); @@ -705,8 +706,14 @@ impl OutputHandler for State { ) .set_destination(logical_width, logical_height); } - - surface.commit(); + // Hyprland only applies viewport change on the next redraw + if let Some(wallpaper) = &bg_layer.current_wallpaper { + if let Some(wl_buffer) = &wallpaper.borrow().wl_buffer { + layer.attach(Some(wl_buffer), 0, 0); + layer.wl_surface().damage_buffer(0, 0, width, height); + } + } + layer.commit(); } fn output_destroyed(