mirror of
https://github.com/labwc/labwc.git
synced 2026-04-11 08:21:13 -04:00
input: add relative cursor move emulation
This commit is contained in:
parent
c7b3f4f9d8
commit
7251c3d27c
2 changed files with 21 additions and 11 deletions
|
|
@ -146,6 +146,9 @@ bool cursor_finish_button_release(struct seat *seat);
|
|||
|
||||
void cursor_init(struct seat *seat);
|
||||
void cursor_reload(struct seat *seat);
|
||||
void cursor_emulate_move(struct seat *seat,
|
||||
struct wlr_input_device *device,
|
||||
double dx, double dy, uint32_t time_msec);
|
||||
void cursor_emulate_move_absolute(struct seat *seat,
|
||||
struct wlr_input_device *device,
|
||||
double x, double y, uint32_t time_msec);
|
||||
|
|
|
|||
|
|
@ -1184,18 +1184,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;
|
||||
|
|
@ -1215,6 +1206,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 wlr_button_state state, uint32_t time_msec)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue