From 69903b23a772931cab1c35cd6381bccbb6e077cf Mon Sep 17 00:00:00 2001 From: lkn Date: Sun, 7 Jun 2026 10:36:36 +0200 Subject: [PATCH] view_surface_at: skip shaded windows in pointer hit-testing When a window is shaded (rolled up to titlebar only), the client surface is hidden but view_surface_at would still return it for points over the frame decorations. This caused two symptoms: 1. Pointer focus stayed on the client surface, showing I-beam cursor instead of default arrow over the titlebar. 2. Button events routed to the client surface instead of titlebar, preventing double-click-to-unshade from working. Fix: after matching a toplevel view via scene graph, check whether the associated WWindow has flags.shaded set and skip it if so. --- src/backend/wayland/wl_pointer_focus.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/backend/wayland/wl_pointer_focus.c b/src/backend/wayland/wl_pointer_focus.c index 0025d9f..73f5b84 100644 --- a/src/backend/wayland/wl_pointer_focus.c +++ b/src/backend/wayland/wl_pointer_focus.c @@ -64,6 +64,19 @@ view_surface_at(int px, int py, double *sx_out, double *sy_out, } if (!match) continue; + /* If the window is shaded, the client surface is hidden; + * do not route pointer events to it. The pointer is over + * frame decorations (titlebar) regardless of what the scene + * graph or xdg geometry says. */ + { + WObjDescriptor *_desc = wm_backend->context_find(v->id, WM_CTX_CLIENT_WIN); + if (_desc && _desc->parent_type == WCLASS_WINDOW) { + WWindow *_wwin = (WWindow *)_desc->parent; + if (_wwin->flags.shaded) + continue; + } + } + if (v->xw_surface && v->xw_surface->surface) { double sx = px - (double)v->x; double sy = py - (double)v->y;