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;