mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-03-13 05:34:13 -04:00
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:
parent
25f94c5965
commit
884d29e5f3
7 changed files with 179 additions and 89 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue