mirror of
https://github.com/labwc/labwc.git
synced 2025-11-01 22:58:47 -04:00
input: add relative cursor move emulation
This commit is contained in:
parent
c9018da4c4
commit
ba9de228e0
2 changed files with 21 additions and 11 deletions
|
|
@ -1174,18 +1174,9 @@ cursor_button(struct wl_listener *listener, void *data)
|
|||
}
|
||||
|
||||
void
|
||||
cursor_emulate_move_absolute(struct seat *seat, struct wlr_input_device *device,
|
||||
double x, double y, uint32_t time_msec)
|
||||
cursor_emulate_move(struct seat *seat, struct wlr_input_device *device,
|
||||
double dx, double dy, uint32_t time_msec)
|
||||
{
|
||||
idle_manager_notify_activity(seat->seat);
|
||||
|
||||
double lx, ly;
|
||||
wlr_cursor_absolute_to_layout_coords(seat->cursor,
|
||||
device, x, y, &lx, &ly);
|
||||
|
||||
double dx = lx - seat->cursor->x;
|
||||
double dy = ly - seat->cursor->y;
|
||||
|
||||
if (!dx && !dy) {
|
||||
wlr_log(WLR_DEBUG, "dropping useless cursor_emulate: %.10f,%.10f", dx, dy);
|
||||
return;
|
||||
|
|
@ -1205,6 +1196,22 @@ cursor_emulate_move_absolute(struct seat *seat, struct wlr_input_device *device,
|
|||
wlr_seat_pointer_notify_frame(seat->seat);
|
||||
}
|
||||
|
||||
void
|
||||
cursor_emulate_move_absolute(struct seat *seat, struct wlr_input_device *device,
|
||||
double x, double y, uint32_t time_msec)
|
||||
{
|
||||
idle_manager_notify_activity(seat->seat);
|
||||
|
||||
double lx, ly;
|
||||
wlr_cursor_absolute_to_layout_coords(seat->cursor,
|
||||
device, x, y, &lx, &ly);
|
||||
|
||||
double dx = lx - seat->cursor->x;
|
||||
double dy = ly - seat->cursor->y;
|
||||
|
||||
cursor_emulate_move(seat, device, dx, dy, time_msec);
|
||||
}
|
||||
|
||||
void
|
||||
cursor_emulate_button(struct seat *seat, uint32_t button,
|
||||
enum wl_pointer_button_state state, uint32_t time_msec)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue