mirror of
https://github.com/labwc/labwc.git
synced 2026-03-19 05:33:53 -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
|
|
@ -146,6 +146,9 @@ bool cursor_finish_button_release(struct seat *seat);
|
||||||
|
|
||||||
void cursor_init(struct seat *seat);
|
void cursor_init(struct seat *seat);
|
||||||
void cursor_reload(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,
|
void cursor_emulate_move_absolute(struct seat *seat,
|
||||||
struct wlr_input_device *device,
|
struct wlr_input_device *device,
|
||||||
double x, double y, uint32_t time_msec);
|
double x, double y, uint32_t time_msec);
|
||||||
|
|
|
||||||
|
|
@ -1174,18 +1174,9 @@ cursor_button(struct wl_listener *listener, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cursor_emulate_move_absolute(struct seat *seat, struct wlr_input_device *device,
|
cursor_emulate_move(struct seat *seat, struct wlr_input_device *device,
|
||||||
double x, double y, uint32_t time_msec)
|
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) {
|
if (!dx && !dy) {
|
||||||
wlr_log(WLR_DEBUG, "dropping useless cursor_emulate: %.10f,%.10f", dx, dy);
|
wlr_log(WLR_DEBUG, "dropping useless cursor_emulate: %.10f,%.10f", dx, dy);
|
||||||
return;
|
return;
|
||||||
|
|
@ -1205,6 +1196,22 @@ cursor_emulate_move_absolute(struct seat *seat, struct wlr_input_device *device,
|
||||||
wlr_seat_pointer_notify_frame(seat->seat);
|
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
|
void
|
||||||
cursor_emulate_button(struct seat *seat, uint32_t button,
|
cursor_emulate_button(struct seat *seat, uint32_t button,
|
||||||
enum wl_pointer_button_state state, uint32_t time_msec)
|
enum wl_pointer_button_state state, uint32_t time_msec)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue