diff --git a/src/cursor.c b/src/cursor.c index 81d527ad..6c93f317 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -302,15 +302,19 @@ process_cursor_motion(struct server *server, uint32_t time) * events to the focused surface so we can keep scrolling * or selecting text even if the cursor moves outside of * the surface. - * - * TODO: This seems to miss calculations for invisible CSD borders. - * Tracked at https://github.com/labwc/labwc/issues/340 */ view = server->seat.pressed.view; sx = server->seat.cursor->x - view->x; sy = server->seat.cursor->y - view->y; sx = sx < 0 ? 0 : (sx > view->w ? view->w : sx); sy = sy < 0 ? 0 : (sy > view->h ? view->h : sy); + if (view->type == LAB_XDG_SHELL_VIEW && view->xdg_surface) { + /* Take into account invisible CSD borders */ + struct wlr_box geo; + wlr_xdg_surface_get_geometry(view->xdg_surface, &geo); + sx += geo.x; + sy += geo.y; + } wlr_seat_pointer_notify_motion(server->seat.seat, time, sx, sy); } else if (surface && !input_inhibit_blocks_surface( &server->seat, surface->resource)) {