aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput/keyboard.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-06-08 17:21:07 +0200
committerSimon Ser <contact@emersion.fr>2023-06-14 15:20:41 +0200
commit2d9659d765b9da1a0ad3d7ea4a064ba08eee6260 (patch)
treef3bdab537823ee6ad7849f558a09b0efd26a9552 /backend/libinput/keyboard.c
parente1c6801b652ff792e54ffee75b0804a185f1cc9d (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.c14
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);
}