aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorManuel Stoeckl <code@mstoeckl.com>2019-06-29 09:15:23 -0400
committerDrew DeVault <sir@cmpwn.com>2019-06-30 15:01:05 -0400
commitded441ffd511e91a469eb8c20e632fcddacbd6f0 (patch)
treef0e099c4d1a9fb814f884d00954e8d564340df1a /include
parentedb30a68283889aeef4ce357609273652cdbb86c (diff)
wlr_seat: Fix edge cases with serial validation
Diffstat (limited to 'include')
-rw-r--r--include/wlr/types/wlr_seat.h30
1 files changed, 16 insertions, 14 deletions
diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h
index f19d4e35..974ca578 100644
--- a/include/wlr/types/wlr_seat.h
+++ b/include/wlr/types/wlr_seat.h
@@ -21,7 +21,6 @@ struct wlr_serial_range {
uint32_t min_incl;
uint32_t max_incl;
};
-
struct wlr_serial_ringset {
struct wlr_serial_range data[WLR_SERIAL_RINGSET_SIZE];
int end;
@@ -29,18 +28,6 @@ struct wlr_serial_ringset {
};
/**
- * Add a new serial number to the set. The number must be larger than
- * all other values already added
- */
-void wlr_serial_add(struct wlr_serial_ringset *set, uint32_t serial);
-
-/**
- * Return false if the serial number is definitely not in the set, true
- * otherwise.
- */
-bool wlr_serial_maybe_valid(struct wlr_serial_ringset *set, uint32_t serial);
-
-/**
* Contains state for a single client's bound wl_seat resource and can be used
* to issue input events to that client. The lifetime of these objects is
* managed by wlr_seat; some may be NULL.
@@ -62,6 +49,7 @@ struct wlr_seat_client {
} events;
// set of serials which were sent to the client on this seat
+ // for use by wlr_seat_client_{next_serial,validate_event_serial}
struct wlr_serial_ringset serials;
};
@@ -652,11 +640,25 @@ bool wlr_seat_validate_touch_grab_serial(struct wlr_seat *seat,
/**
* Return a new serial (from wl_display_serial_next()) for the client, and
* update the seat client's set of valid serials. Use this for all input
- * events.
+ * events; otherwise wlr_seat_client_validate_event_serial() may fail when
+ * handed a correctly functioning client's request serials.
*/
uint32_t wlr_seat_client_next_serial(struct wlr_seat_client *client);
/**
+ * Return true if the serial number could have been produced by
+ * wlr_seat_client_next_serial() and is "older" (by less than UINT32_MAX/2) than
+ * the current display serial value.
+ *
+ * This function should have no false negatives, and the only false positive
+ * responses allowed are for elements that are still "older" than the current
+ * display serial value and also older than all serial values remaining in
+ * the seat client's serial ring buffer, if that buffer is also full.
+ */
+bool wlr_seat_client_validate_event_serial(struct wlr_seat_client *client,
+ uint32_t serial);
+
+/**
* Get a seat client from a seat resource. Returns NULL if inert.
*/
struct wlr_seat_client *wlr_seat_client_from_resource(