diff options
author | Isaac Freund <ifreund@ifreund.xyz> | 2020-03-13 23:06:21 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-03-13 23:24:56 +0100 |
commit | 7c309ba4d30d5ff99fd52a1124e251203ac80883 (patch) | |
tree | d0c7e66c9044775f15d47facc2f2c238e1431a48 | |
parent | 3f617631cb68c0e90a755b86f9c241caf0080f9a (diff) |
Properly popluate keys array for enter on creation
This corrects an oversight made in 3f617631cb68c0e90a755b86f9c241caf0080f9a
-rw-r--r-- | types/seat/wlr_seat_keyboard.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/types/seat/wlr_seat_keyboard.c b/types/seat/wlr_seat_keyboard.c index 93e259c9..1e567ba1 100644 --- a/types/seat/wlr_seat_keyboard.c +++ b/types/seat/wlr_seat_keyboard.c @@ -421,8 +421,21 @@ void seat_client_create_keyboard(struct wlr_seat_client *seat_client, // Send an enter event if there is a focused client/surface stored if (focused_client != NULL && focused_surface != NULL) { + uint32_t *keycodes = keyboard->keycodes; + size_t num_keycodes = keyboard->num_keycodes; + struct wl_array keys; wl_array_init(&keys); + for (size_t i = 0; i < num_keycodes; ++i) { + uint32_t *p = wl_array_add(&keys, sizeof(uint32_t)); + if (!p) { + wlr_log(WLR_ERROR, "Cannot allocate memory, skipping keycode: %d\n", + keycodes[i]); + continue; + } + *p = keycodes[i]; + } + uint32_t serial = wlr_seat_client_next_serial(focused_client); struct wl_resource *resource; wl_resource_for_each(resource, &focused_client->keyboards) { @@ -434,6 +447,7 @@ void seat_client_create_keyboard(struct wlr_seat_client *seat_client, focused_surface->resource, &keys); } } + wl_array_release(&keys); } } |