diff options
author | Simon Ser <contact@emersion.fr> | 2023-06-08 17:21:07 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-06-14 15:20:41 +0200 |
commit | 2d9659d765b9da1a0ad3d7ea4a064ba08eee6260 (patch) | |
tree | f3bdab537823ee6ad7849f558a09b0efd26a9552 /backend/libinput/keyboard.c | |
parent | e1c6801b652ff792e54ffee75b0804a185f1cc9d (diff) |
backend/libinput: use struct initializers for events
This is more readable and consistent with the rest of wlroots.
Diffstat (limited to 'backend/libinput/keyboard.c')
-rw-r--r-- | backend/libinput/keyboard.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/backend/libinput/keyboard.c b/backend/libinput/keyboard.c index 789260d5..2e5e6ef1 100644 --- a/backend/libinput/keyboard.c +++ b/backend/libinput/keyboard.c @@ -36,13 +36,12 @@ void handle_keyboard_key(struct libinput_event *event, struct wlr_keyboard *kb) { struct libinput_event_keyboard *kbevent = libinput_event_get_keyboard_event(event); - struct wlr_keyboard_key_event wlr_event = { 0 }; - wlr_event.time_msec = - usec_to_msec(libinput_event_keyboard_get_time_usec(kbevent)); - wlr_event.keycode = libinput_event_keyboard_get_key(kbevent); - enum libinput_key_state state = - libinput_event_keyboard_get_key_state(kbevent); - switch (state) { + struct wlr_keyboard_key_event wlr_event = { + .time_msec = usec_to_msec(libinput_event_keyboard_get_time_usec(kbevent)), + .keycode = libinput_event_keyboard_get_key(kbevent), + .update_state = true, + }; + switch (libinput_event_keyboard_get_key_state(kbevent)) { case LIBINPUT_KEY_STATE_RELEASED: wlr_event.state = WL_KEYBOARD_KEY_STATE_RELEASED; break; @@ -50,6 +49,5 @@ void handle_keyboard_key(struct libinput_event *event, wlr_event.state = WL_KEYBOARD_KEY_STATE_PRESSED; break; } - wlr_event.update_state = true; wlr_keyboard_notify_key(kb, &wlr_event); } |