backend/libinput: guard against new enum entries

When libinput introduces new enum entries, we'd abort or send bogus
events to the compositor. Instead, log a message and ignore the
event.

Keep all enums without a default case so that the compiler warns
when we're missing a case.
This commit is contained in:
Simon Ser 2026-02-12 22:37:41 +01:00 committed by Simon Zeni
parent 25f94c5965
commit 884d29e5f3
7 changed files with 179 additions and 89 deletions

View file

@ -249,3 +249,15 @@ void handle_libinput_event(struct wlr_libinput_backend *backend,
break;
}
}
bool button_state_from_libinput(enum libinput_button_state state, enum wlr_button_state *out) {
switch (state) {
case LIBINPUT_BUTTON_STATE_RELEASED:
*out = WLR_BUTTON_RELEASED;
return true;
case LIBINPUT_BUTTON_STATE_PRESSED:
*out = WLR_BUTTON_PRESSED;
return true;
}
return false;
}