From bc0446aa7af7c57f05cfbb6f549bd7b537f1d30e Mon Sep 17 00:00:00 2001 From: lkn Date: Sun, 21 Jun 2026 19:21:04 +0200 Subject: [PATCH] wayland: account for CSD geometry offset in pointer hit testing wlr_xdg_surface_surface_at expects surface-local coordinates (including the shadow region). Add geometry.x/y back when converting from screen coords to surface-local so the hit test aligns with the actual content. --- src/backend/wayland/wl_pointer_focus.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/wayland/wl_pointer_focus.c b/src/backend/wayland/wl_pointer_focus.c index 8dd9053..0197584 100644 --- a/src/backend/wayland/wl_pointer_focus.c +++ b/src/backend/wayland/wl_pointer_focus.c @@ -95,8 +95,9 @@ view_surface_at(int px, int py, double *sx_out, double *sy_out, return v->xw_surface->surface; } if (v->xdg_surface) { - double sx = px - (double)v->x; - double sy = py - (double)v->y; + struct wlr_box geo = v->xdg_surface->geometry; + double sx = px - (double)v->x + geo.x; + double sy = py - (double)v->y + geo.y; double sub_sx, sub_sy; struct wlr_surface *sub = wlr_xdg_surface_surface_at( v->xdg_surface, sx, sy, &sub_sx, &sub_sy);