backend/libinput: use struct initializers for events

This is more readable and consistent with the rest of wlroots.
This commit is contained in:
Simon Ser 2023-06-08 17:21:07 +02:00
parent e1c6801b65
commit 2d9659d765
6 changed files with 98 additions and 100 deletions

View file

@ -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);
}