aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-11-16 17:34:38 -0500
committerTony Crisci <tony@dubstepdish.com>2017-11-16 17:44:10 -0500
commitfb18e345a6e4546fe87729962b54cce61759bc71 (patch)
treec7d5037b3b23cb3daa611fe80ebbce1b4ddba8fd
parent4434be835d6aaf6314f2596181295fabd883eac9 (diff)
wlr-seat: return serial from touch down interface
-rw-r--r--include/wlr/types/wlr_seat.h6
-rw-r--r--rootston/cursor.c5
-rw-r--r--types/wlr_data_device.c3
-rw-r--r--types/wlr_seat.c26
4 files changed, 23 insertions, 17 deletions
diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h
index 109e9be9..dbd03401 100644
--- a/include/wlr/types/wlr_seat.h
+++ b/include/wlr/types/wlr_seat.h
@@ -72,7 +72,7 @@ struct wlr_keyboard_grab_interface {
struct wlr_seat_touch_grab;
struct wlr_touch_grab_interface {
- void (*down)(struct wlr_seat_touch_grab *grab, uint32_t time,
+ uint32_t (*down)(struct wlr_seat_touch_grab *grab, uint32_t time,
struct wlr_touch_point *point);
void (*up)(struct wlr_seat_touch_grab *grab, uint32_t time,
struct wlr_touch_point *point);
@@ -422,7 +422,7 @@ struct wlr_touch_point *wlr_seat_touch_get_point(struct wlr_seat *seat,
* Notify the seat of a touch down on the given surface. Defers to any grab of
* the touch device.
*/
-void wlr_seat_touch_notify_down(struct wlr_seat *seat,
+uint32_t wlr_seat_touch_notify_down(struct wlr_seat *seat,
struct wlr_surface *surface, uint32_t time, int32_t touch_id, double sx,
double sy);
@@ -465,7 +465,7 @@ void wlr_seat_touch_point_clear_focus(struct wlr_seat *seat, uint32_t time,
* Coordinates are surface-local. Compositors should use
* `wlr_seat_touch_notify_down()` to respect any grabs of the touch device.
*/
-void wlr_seat_touch_send_down(struct wlr_seat *seat,
+uint32_t wlr_seat_touch_send_down(struct wlr_seat *seat,
struct wlr_surface *surface, uint32_t time, int32_t touch_id, double sx,
double sy);
diff --git a/rootston/cursor.c b/rootston/cursor.c
index 35fe9c25..40618fe7 100644
--- a/rootston/cursor.c
+++ b/rootston/cursor.c
@@ -234,12 +234,13 @@ void roots_cursor_handle_touch_down(struct roots_cursor *cursor,
double sx, sy;
view_at(desktop, lx, ly, &surface, &sx, &sy);
+ uint32_t serial = 0;
if (surface) {
- wlr_seat_touch_notify_down(cursor->seat->seat, surface,
+ serial = wlr_seat_touch_notify_down(cursor->seat->seat, surface,
event->time_msec, event->slot, sx, sy);
}
- if (wlr_seat_touch_num_points(cursor->seat->seat) == 1) {
+ if (serial && wlr_seat_touch_num_points(cursor->seat->seat) == 1) {
cursor->seat->touch_id = event->slot;
cursor->seat->touch_x = lx;
cursor->seat->touch_y = ly;
diff --git a/types/wlr_data_device.c b/types/wlr_data_device.c
index bac8dbf3..eb8a3503 100644
--- a/types/wlr_data_device.c
+++ b/types/wlr_data_device.c
@@ -526,9 +526,10 @@ wlr_pointer_grab_interface wlr_data_device_pointer_drag_interface = {
.cancel = pointer_drag_cancel,
};
-static void touch_drag_down(struct wlr_seat_touch_grab *grab,
+uint32_t touch_drag_down(struct wlr_seat_touch_grab *grab,
uint32_t time, struct wlr_touch_point *point) {
// eat the event
+ return 0;
}
static void touch_drag_up(struct wlr_seat_touch_grab *grab, uint32_t time,
diff --git a/types/wlr_seat.c b/types/wlr_seat.c
index 6566d397..4438f5cc 100644
--- a/types/wlr_seat.c
+++ b/types/wlr_seat.c
@@ -300,10 +300,10 @@ static const struct wlr_keyboard_grab_interface default_keyboard_grab_impl = {
.cancel = default_keyboard_cancel,
};
-static void default_touch_down(struct wlr_seat_touch_grab *grab, uint32_t time,
+static uint32_t default_touch_down(struct wlr_seat_touch_grab *grab, uint32_t time,
struct wlr_touch_point *point) {
- wlr_seat_touch_send_down(grab->seat, point->surface, time, point->touch_id,
- point->sx, point->sy);
+ return wlr_seat_touch_send_down(grab->seat, point->surface, time,
+ point->touch_id, point->sx, point->sy);
}
static void default_touch_up(struct wlr_seat_touch_grab *grab, uint32_t time,
@@ -658,7 +658,7 @@ uint32_t wlr_seat_pointer_notify_button(struct wlr_seat *wlr_seat,
struct wlr_seat_pointer_grab *grab = wlr_seat->pointer_state.grab;
uint32_t serial = grab->interface->button(grab, time, button, state);
- if (wlr_seat->pointer_state.button_count == 1) {
+ if (serial && wlr_seat->pointer_state.button_count == 1) {
wlr_seat->pointer_state.grab_serial = serial;
}
@@ -989,7 +989,7 @@ struct wlr_touch_point *wlr_seat_touch_get_point(
return NULL;
}
-void wlr_seat_touch_notify_down(struct wlr_seat *seat,
+uint32_t wlr_seat_touch_notify_down(struct wlr_seat *seat,
struct wlr_surface *surface, uint32_t time, int32_t touch_id, double sx,
double sy) {
clock_gettime(CLOCK_MONOTONIC, &seat->last_event);
@@ -998,15 +998,17 @@ void wlr_seat_touch_notify_down(struct wlr_seat *seat,
touch_point_create(seat, touch_id, surface, sx, sy);
if (!point) {
wlr_log(L_ERROR, "could not create touch point");
- return;
+ return 0;
}
- grab->interface->down(grab, time, point);
+ uint32_t serial = grab->interface->down(grab, time, point);
- if (wl_list_length(&seat->touch_state.touch_points) == 1) {
- seat->touch_state.grab_serial = wl_display_get_serial(seat->display);
+ if (serial && wlr_seat_touch_num_points(seat) == 1) {
+ seat->touch_state.grab_serial = serial;
seat->touch_state.grab_id = touch_id;
}
+
+ return serial;
}
void wlr_seat_touch_notify_up(struct wlr_seat *seat, uint32_t time,
@@ -1100,19 +1102,21 @@ void wlr_seat_touch_point_clear_focus(struct wlr_seat *seat, uint32_t time,
touch_point_clear_focus(point);
}
-void wlr_seat_touch_send_down(struct wlr_seat *seat,
+uint32_t wlr_seat_touch_send_down(struct wlr_seat *seat,
struct wlr_surface *surface, uint32_t time, int32_t touch_id, double sx,
double sy) {
struct wlr_touch_point *point = wlr_seat_touch_get_point(seat, touch_id);
if (!point) {
wlr_log(L_ERROR, "got touch down for unknown touch point");
- return;
+ return 0;
}
uint32_t serial = wl_display_next_serial(seat->display);
wl_touch_send_down(point->client->touch, serial, time, surface->resource,
touch_id, wl_fixed_from_double(sx), wl_fixed_from_double(sy));
wl_touch_send_frame(point->client->touch);
+
+ return serial;
}
void wlr_seat_touch_send_up(struct wlr_seat *seat, uint32_t time, int32_t touch_id) {