seat: add serials to touch up events

master
Ilia Bozhinov 7 months ago committed by Simon Ser
parent 2f82c92307
commit 75ecba444a

@ -126,7 +126,7 @@ struct wlr_seat_touch_grab;
struct wlr_touch_grab_interface { struct wlr_touch_grab_interface {
uint32_t (*down)(struct wlr_seat_touch_grab *grab, uint32_t time_msec, uint32_t (*down)(struct wlr_seat_touch_grab *grab, uint32_t time_msec,
struct wlr_touch_point *point); struct wlr_touch_point *point);
void (*up)(struct wlr_seat_touch_grab *grab, uint32_t time_msec, uint32_t (*up)(struct wlr_seat_touch_grab *grab, uint32_t time_msec,
struct wlr_touch_point *point); struct wlr_touch_point *point);
void (*motion)(struct wlr_seat_touch_grab *grab, uint32_t time_msec, void (*motion)(struct wlr_seat_touch_grab *grab, uint32_t time_msec,
struct wlr_touch_point *point); struct wlr_touch_point *point);
@ -618,7 +618,7 @@ uint32_t wlr_seat_touch_send_down(struct wlr_seat *seat,
* event. This will remove the touch point. This function does not respect touch * event. This will remove the touch point. This function does not respect touch
* grabs: you probably want wlr_seat_touch_notify_up() instead. * grabs: you probably want wlr_seat_touch_notify_up() instead.
*/ */
void wlr_seat_touch_send_up(struct wlr_seat *seat, uint32_t time_msec, uint32_t wlr_seat_touch_send_up(struct wlr_seat *seat, uint32_t time_msec,
int32_t touch_id); int32_t touch_id);
/** /**
@ -653,7 +653,7 @@ uint32_t wlr_seat_touch_notify_down(struct wlr_seat *seat,
* Notify the seat that the touch point given by `touch_id` is up. Defers to any * Notify the seat that the touch point given by `touch_id` is up. Defers to any
* grab of the touch device. * grab of the touch device.
*/ */
void wlr_seat_touch_notify_up(struct wlr_seat *seat, uint32_t time_msec, uint32_t wlr_seat_touch_notify_up(struct wlr_seat *seat, uint32_t time_msec,
int32_t touch_id); int32_t touch_id);
/** /**

@ -261,11 +261,11 @@ static uint32_t drag_handle_touch_down(struct wlr_seat_touch_grab *grab,
return 0; return 0;
} }
static void drag_handle_touch_up(struct wlr_seat_touch_grab *grab, static uint32_t drag_handle_touch_up(struct wlr_seat_touch_grab *grab,
uint32_t time, struct wlr_touch_point *point) { uint32_t time, struct wlr_touch_point *point) {
struct wlr_drag *drag = grab->data; struct wlr_drag *drag = grab->data;
if (drag->grab_touch_id != point->touch_id) { if (drag->grab_touch_id != point->touch_id) {
return; return 0;
} }
if (drag->focus_client) { if (drag->focus_client) {
@ -273,6 +273,7 @@ static void drag_handle_touch_up(struct wlr_seat_touch_grab *grab,
} }
drag_destroy(drag); drag_destroy(drag);
return 0;
} }
static void drag_handle_touch_motion(struct wlr_seat_touch_grab *grab, static void drag_handle_touch_motion(struct wlr_seat_touch_grab *grab,

@ -13,9 +13,9 @@ static uint32_t default_touch_down(struct wlr_seat_touch_grab *grab,
point->touch_id, point->sx, point->sy); point->touch_id, point->sx, point->sy);
} }
static void default_touch_up(struct wlr_seat_touch_grab *grab, uint32_t time, static uint32_t default_touch_up(struct wlr_seat_touch_grab *grab, uint32_t time,
struct wlr_touch_point *point) { struct wlr_touch_point *point) {
wlr_seat_touch_send_up(grab->seat, time, point->touch_id); return wlr_seat_touch_send_up(grab->seat, time, point->touch_id);
} }
static void default_touch_motion(struct wlr_seat_touch_grab *grab, static void default_touch_motion(struct wlr_seat_touch_grab *grab,
@ -205,16 +205,16 @@ uint32_t wlr_seat_touch_notify_down(struct wlr_seat *seat,
return serial; return serial;
} }
void wlr_seat_touch_notify_up(struct wlr_seat *seat, uint32_t time, uint32_t wlr_seat_touch_notify_up(struct wlr_seat *seat, uint32_t time,
int32_t touch_id) { int32_t touch_id) {
clock_gettime(CLOCK_MONOTONIC, &seat->last_event); clock_gettime(CLOCK_MONOTONIC, &seat->last_event);
struct wlr_seat_touch_grab *grab = seat->touch_state.grab; struct wlr_seat_touch_grab *grab = seat->touch_state.grab;
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id); struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
if (!point) { if (!point) {
return; return 0;
} }
grab->interface->up(grab, time, point); return grab->interface->up(grab, time, point);
touch_point_destroy(point); touch_point_destroy(point);
} }
@ -340,11 +340,11 @@ uint32_t wlr_seat_touch_send_down(struct wlr_seat *seat,
return serial; return serial;
} }
void wlr_seat_touch_send_up(struct wlr_seat *seat, uint32_t time, int32_t touch_id) { uint32_t wlr_seat_touch_send_up(struct wlr_seat *seat, uint32_t time, int32_t touch_id) {
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id); struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
if (!point) { if (!point) {
wlr_log(WLR_ERROR, "got touch up for unknown touch point"); wlr_log(WLR_ERROR, "got touch up for unknown touch point");
return; return 0;
} }
uint32_t serial = wlr_seat_client_next_serial(point->client); uint32_t serial = wlr_seat_client_next_serial(point->client);
@ -357,6 +357,7 @@ void wlr_seat_touch_send_up(struct wlr_seat *seat, uint32_t time, int32_t touch_
} }
point->client->needs_touch_frame = true; point->client->needs_touch_frame = true;
return serial;
} }
void wlr_seat_touch_send_motion(struct wlr_seat *seat, uint32_t time, int32_t touch_id, void wlr_seat_touch_send_motion(struct wlr_seat *seat, uint32_t time, int32_t touch_id,

@ -151,9 +151,9 @@ static uint32_t xdg_touch_grab_down(struct wlr_seat_touch_grab *grab,
point->touch_id, point->sx, point->sy); point->touch_id, point->sx, point->sy);
} }
static void xdg_touch_grab_up(struct wlr_seat_touch_grab *grab, static uint32_t xdg_touch_grab_up(struct wlr_seat_touch_grab *grab,
uint32_t time, struct wlr_touch_point *point) { uint32_t time, struct wlr_touch_point *point) {
wlr_seat_touch_send_up(grab->seat, time, point->touch_id); return wlr_seat_touch_send_up(grab->seat, time, point->touch_id);
} }
static void xdg_touch_grab_motion(struct wlr_seat_touch_grab *grab, static void xdg_touch_grab_motion(struct wlr_seat_touch_grab *grab,

Loading…
Cancel
Save