aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/wayland/seat.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/backend/wayland/seat.c b/backend/wayland/seat.c
index 4b97bd48..dadc2356 100644
--- a/backend/wayland/seat.c
+++ b/backend/wayland/seat.c
@@ -235,11 +235,12 @@ static void keyboard_handle_leave(void *data, struct wl_keyboard *wl_keyboard,
uint32_t time = get_current_time_msec();
- uint32_t pressed[dev->keyboard->num_keycodes + 1];
+ size_t num_keycodes = dev->keyboard->num_keycodes;
+ uint32_t pressed[num_keycodes + 1];
memcpy(pressed, dev->keyboard->keycodes,
- dev->keyboard->num_keycodes * sizeof(uint32_t));
+ num_keycodes * sizeof(uint32_t));
- for (size_t i = 0; i < sizeof(pressed)/sizeof(pressed[0]); ++i) {
+ for (size_t i = 0; i < num_keycodes; ++i) {
uint32_t keycode = pressed[i];
struct wlr_event_keyboard_key event = {