From 7114da35ba3af8793c5d213fff83ef6d75719575 Mon Sep 17 00:00:00 2001 From: lkn Date: Sun, 21 Jun 2026 16:59:58 +0200 Subject: [PATCH] wayland: fix XWayland cursor position offset by titlebar height view_surface_at() was double-subtracting the frame_rel offset. Since v->x/v->y already represents the client content position (frame origin + frame_rel), the surface-local coordinates are simply px - v->x. The bounds check now correctly tests against 0..width/height. --- src/backend/wayland/wl_pointer_focus.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/backend/wayland/wl_pointer_focus.c b/src/backend/wayland/wl_pointer_focus.c index 7e8ed48..8dd9053 100644 --- a/src/backend/wayland/wl_pointer_focus.c +++ b/src/backend/wayland/wl_pointer_focus.c @@ -78,17 +78,16 @@ view_surface_at(int px, int py, double *sx_out, double *sy_out, } if (v->xw_surface && v->xw_surface->surface) { + /* v->x/v->y is the absolute client content position + * (frame origin + frame_rel offset). Check if pointer + * is within the client area. */ double sx = px - (double)v->x; double sy = py - (double)v->y; - /* If the XWayland view has a frame, only return the surface - * when the pointer is over the client content area. */ if (v->frame_id) { - if (sx < v->frame_rel_x || sy < v->frame_rel_y || - sx >= v->frame_rel_x + v->xw_surface->width || - sy >= v->frame_rel_y + v->xw_surface->height) + if (sx < 0 || sy < 0 || + sx >= v->xw_surface->width || + sy >= v->xw_surface->height) continue; - sx -= v->frame_rel_x; - sy -= v->frame_rel_y; } if (sx_out) *sx_out = sx; if (sy_out) *sy_out = sy;