aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput/switch.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/switch.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/switch.c')
-rw-r--r--backend/libinput/switch.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/backend/libinput/switch.c b/backend/libinput/switch.c
index e8c68bef..61bb887f 100644
--- a/backend/libinput/switch.c
+++ b/backend/libinput/switch.c
@@ -28,7 +28,9 @@ void handle_switch_toggle(struct libinput_event *event,
struct wlr_switch *wlr_switch) {
struct libinput_event_switch *sevent =
libinput_event_get_switch_event (event);
- struct wlr_switch_toggle_event wlr_event = { 0 };
+ struct wlr_switch_toggle_event wlr_event = {
+ .time_msec = usec_to_msec(libinput_event_switch_get_time_usec(sevent)),
+ };
switch (libinput_event_switch_get_switch(sevent)) {
case LIBINPUT_SWITCH_LID:
wlr_event.switch_type = WLR_SWITCH_TYPE_LID;
@@ -45,7 +47,5 @@ void handle_switch_toggle(struct libinput_event *event,
wlr_event.switch_state = WLR_SWITCH_STATE_ON;
break;
}
- wlr_event.time_msec =
- usec_to_msec(libinput_event_switch_get_time_usec(sevent));
wl_signal_emit_mutable(&wlr_switch->events.toggle, &wlr_event);
}