Bladeren bron

fix(wayland): use BOTTOM layer and honor --disable-mouse for click-through (#528)

On KDE Plasma (Wayland), using ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND
causes the wallpaper surface to be placed below Plasma's own desktop
surface. After any user interaction (right-click context menu, etc.),
KWin repaints the desktop surface on top and the wallpaper disappears
behind a black screen — even though the process is still rendering.

Switching to ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM places the surface above
the desktop but below normal windows, which is the correct stacking for
a live wallpaper on KDE.

Additionally, the input region was unconditionally set to cover the
entire surface (INT32_MAX × INT32_MAX), which meant --disable-mouse
still captured all pointer events and blocked desktop right-click
context menus. This change makes the input region conditional: when
mouse interaction is disabled, the region is left empty so all clicks
pass through to the desktop shell.

Also adds the missing wl_region_destroy() call after
wl_surface_set_input_region() to avoid leaking the Wayland region
object.

Tested on KDE Plasma 6.6.3 / Wayland / NVIDIA RTX 3080.
Alexander Stoyanov 5 maanden geleden
bovenliggende
commit
fbe5968436
1 gewijzigde bestanden met toevoegingen van 5 en 2 verwijderingen
  1. 5 2
      src/WallpaperEngine/Render/Drivers/Output/WaylandOutputViewport.cpp

+ 5 - 2
src/WallpaperEngine/Render/Drivers/Output/WaylandOutputViewport.cpp

@@ -116,7 +116,7 @@ WaylandOutputViewport::WaylandOutputViewport (
 void WaylandOutputViewport::setupLS () {
     surface = wl_compositor_create_surface (m_driver->getWaylandContext ()->compositor);
     layerSurface = zwlr_layer_shell_v1_get_layer_surface (
-	m_driver->getWaylandContext ()->layerShell, surface, output, ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND,
+	m_driver->getWaylandContext ()->layerShell, surface, output, ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM,
 	"linux-wallpaperengine"
     );
 
@@ -125,7 +125,9 @@ void WaylandOutputViewport::setupLS () {
     }
 
     wl_region* region = wl_compositor_create_region (m_driver->getWaylandContext ()->compositor);
-    wl_region_add (region, 0, 0, INT32_MAX, INT32_MAX);
+    if (m_driver->getApp ().getContext ().settings.mouse.enabled) {
+	wl_region_add (region, 0, 0, INT32_MAX, INT32_MAX);
+    }
 
     zwlr_layer_surface_v1_set_size (layerSurface, 0, 0);
     zwlr_layer_surface_v1_set_anchor (
@@ -137,6 +139,7 @@ void WaylandOutputViewport::setupLS () {
     zwlr_layer_surface_v1_add_listener (layerSurface, &layerSurfaceListener, this);
     zwlr_layer_surface_v1_set_exclusive_zone (layerSurface, -1);
     wl_surface_set_input_region (surface, region);
+    wl_region_destroy (region);
     wl_surface_commit (surface);
     wl_display_roundtrip (m_driver->getWaylandContext ()->display);