mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-19 08:40:33 +01:00
tools/debug-events: move the event type str to a helper function
This isn't really necessary for the code as-is it makes debugging things easier. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1044>
This commit is contained in:
parent
e8495b8d36
commit
33612fb37c
1 changed files with 17 additions and 8 deletions
|
|
@ -55,16 +55,12 @@ static bool is_tty = false;
|
|||
|
||||
#define printq(...) ({ if (!be_quiet) printf(__VA_ARGS__); })
|
||||
|
||||
static void
|
||||
print_event_header(struct libinput_event *ev, size_t event_count)
|
||||
static const char *
|
||||
event_type_to_str(enum libinput_event_type evtype)
|
||||
{
|
||||
/* use for pointer value only, do not dereference */
|
||||
static void *last_device = NULL;
|
||||
struct libinput_device *dev = libinput_event_get_device(ev);
|
||||
const char *type = NULL;
|
||||
char prefix;
|
||||
const char *type;
|
||||
|
||||
switch(libinput_event_get_type(ev)) {
|
||||
switch(evtype) {
|
||||
case LIBINPUT_EVENT_NONE:
|
||||
abort();
|
||||
case LIBINPUT_EVENT_DEVICE_ADDED:
|
||||
|
|
@ -168,6 +164,19 @@ print_event_header(struct libinput_event *ev, size_t event_count)
|
|||
break;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
print_event_header(struct libinput_event *ev, size_t event_count)
|
||||
{
|
||||
/* use for pointer value only, do not dereference */
|
||||
static void *last_device = NULL;
|
||||
struct libinput_device *dev = libinput_event_get_device(ev);
|
||||
char prefix;
|
||||
|
||||
const char *type = event_type_to_str(libinput_event_get_type(ev));
|
||||
|
||||
prefix = (last_device != dev) ? '-' : ' ';
|
||||
|
||||
printq("%c%-7s %-23s ",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue