mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
cursor: Handle absolute motion for relative_pointer
Signed-off-by: Joshua Ashton <joshua@froggi.es>
This commit is contained in:
parent
f5072151a9
commit
7e4e579c37
1 changed files with 24 additions and 1 deletions
25
src/cursor.c
25
src/cursor.c
|
|
@ -367,7 +367,30 @@ cursor_motion_absolute(struct wl_listener *listener, void *data)
|
|||
struct seat *seat = wl_container_of(
|
||||
listener, seat, cursor_motion_absolute);
|
||||
struct wlr_event_pointer_motion_absolute *event = data;
|
||||
wlr_cursor_warp_absolute(seat->cursor, event->device, event->x, event->y);
|
||||
|
||||
double lx, ly;
|
||||
wlr_cursor_absolute_to_layout_coords(seat->cursor, event->device,
|
||||
event->x, event->y, &lx, &ly);
|
||||
|
||||
double dx = lx - seat->cursor->x;
|
||||
double dy = ly - seat->cursor->y;
|
||||
|
||||
wlr_relative_pointer_manager_v1_send_relative_motion(
|
||||
seat->server->relative_pointer_manager,
|
||||
seat->seat, (uint64_t)event->time_msec * 1000,
|
||||
dx, dy, dx, dy);
|
||||
|
||||
if (!seat->current_constraint) {
|
||||
/*
|
||||
* The cursor doesn't move unless we tell it to. The cursor
|
||||
* automatically handles constraining the motion to the output layout,
|
||||
* as well as any special configuration applied for the specific input
|
||||
* device which generated the event. You can pass NULL for the device
|
||||
* if you want to move the cursor around without any input.
|
||||
*/
|
||||
wlr_cursor_move(seat->cursor, event->device, dx, dy);
|
||||
}
|
||||
|
||||
process_cursor_motion(seat->server, event->time_msec);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue