mirror of
https://github.com/labwc/labwc.git
synced 2026-02-10 04:27:47 -05:00
cursor: offset xdg invisible border when dragging outside view
Note: view->padding was deleted in commitb279550as the wlroots scene-graph xdg-surface commit handler offsets the CSD invisible border. If view->padding still existed, we could have used that, but considering that this is probably the only place where this offset will now be needed (because we're generating surface local coordinates), it's simpler to just do it locally. Related to issue #340 Written-by: @Consolatis Backport of81810db3b6
This commit is contained in:
parent
cc0e2769d9
commit
74da710c98
1 changed files with 7 additions and 3 deletions
10
src/cursor.c
10
src/cursor.c
|
|
@ -305,15 +305,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)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue