diff options
author | Manuel Stoeckl <code@mstoeckl.com> | 2019-06-29 20:40:45 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-06-30 15:01:05 -0400 |
commit | c2fb8a84a28c4bdfb5fa1f81ab19127e3e5b8a29 (patch) | |
tree | 22fc75038b2388409179ba371f6e8236045e3f59 | |
parent | 1ef0c03a46dc715aebc02402ec6b19007ecfd355 (diff) |
wlr_seat: special-case first serial set use
-rw-r--r-- | types/seat/wlr_seat.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/types/seat/wlr_seat.c b/types/seat/wlr_seat.c index 82859e0f..9605df32 100644 --- a/types/seat/wlr_seat.c +++ b/types/seat/wlr_seat.c @@ -142,9 +142,6 @@ static void seat_handle_bind(struct wl_client *client, void *_wlr_seat, wl_signal_init(&seat_client->events.destroy); wl_list_insert(&wlr_seat->clients, &seat_client->link); - - // ensure first entry will have index zero - seat_client->serials.end = WLR_SERIAL_RINGSET_SIZE - 1; } wl_resource_set_implementation(wl_resource, &seat_impl, @@ -378,7 +375,12 @@ uint32_t wlr_seat_client_next_serial(struct wlr_seat_client *client) { uint32_t serial = wl_display_next_serial(wl_client_get_display(client->client)); struct wlr_serial_ringset *set = &client->serials; - if (set->count == 0 || set->data[set->end].max_incl + 1 != serial) { + if (set->count == 0) { + set->data[0].min_incl = serial; + set->data[0].max_incl = serial; + set->count = 1; + set->end = 0; + } else if (set->data[set->end].max_incl + 1 != serial) { if (set->count < WLR_SERIAL_RINGSET_SIZE) { set->count++; } |