tools: print missing event types in the demo client

Instead of aborting, print something useful

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/332>
This commit is contained in:
Peter Hutterer 2025-05-19 15:23:24 +10:00 committed by Marge Bot
parent 2556ad38c6
commit 851f935fe1

View file

@ -320,7 +320,8 @@ int main(int argc, char **argv)
if (!e)
break;
switch(ei_event_get_type(e)) {
enum ei_event_type type = ei_event_get_type(e);
switch(type) {
case EI_EVENT_CONNECT:
colorprint("connected\n");
break;
@ -486,7 +487,7 @@ int main(int argc, char **argv)
case EI_EVENT_TOUCH_MOTION:
{
colorprint("touch %s %u %.2f/%.2f\n",
ei_event_get_type(e) == EI_EVENT_TOUCH_DOWN ? "down" : "motion",
type == EI_EVENT_TOUCH_DOWN ? "down" : "motion",
ei_event_touch_get_id(e),
ei_event_touch_get_x(e),
ei_event_touch_get_y(e));
@ -503,7 +504,11 @@ int main(int argc, char **argv)
}
break;
default:
abort();
{
colorprint("ERROR: Unhandled event type %u (%s)\n",
type, ei_event_type_to_string(type));
}
break;
}
}