diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/event-debug.c | 31 | ||||
-rw-r--r-- | tools/event-gui.c | 2 |
2 files changed, 33 insertions, 0 deletions
diff --git a/tools/event-debug.c b/tools/event-debug.c index a3e460a..779b54a 100644 --- a/tools/event-debug.c +++ b/tools/event-debug.c @@ -133,6 +133,9 @@ print_event_header(struct libinput_event *ev) case LIBINPUT_EVENT_TABLET_PAD_STRIP: type = "TABLET_PAD_STRIP"; break; + case LIBINPUT_EVENT_SWITCH_TOGGLE: + type = "SWITCH_TOGGLE"; + break; } prefix = (last_device != dev) ? '-' : ' '; @@ -194,6 +197,9 @@ print_device_notify(struct libinput_event *ev) if (libinput_device_has_capability(dev, LIBINPUT_DEVICE_CAP_TABLET_PAD)) printf("P"); + if (libinput_device_has_capability(dev, + LIBINPUT_DEVICE_CAP_SWITCH)) + printf("S"); if (libinput_device_get_size(dev, &w, &h) == 0) printf(" size %.0fx%.0fmm", w, h); @@ -706,6 +712,28 @@ print_tablet_pad_strip_event(struct libinput_event *ev) mode); } +static void +print_switch_event(struct libinput_event *ev) +{ + struct libinput_event_switch *sw = libinput_event_get_switch_event(ev); + enum libinput_switch_state state; + const char *which; + + print_event_time(libinput_event_switch_get_time(sw)); + + switch (libinput_event_switch_get_switch(sw)) { + case LIBINPUT_SWITCH_LID: + which = "lid"; + break; + default: + abort(); + } + + state = libinput_event_switch_get_switch_state(sw); + + printf("switch %s state %d\n", which, state); +} + static int handle_and_print_events(struct libinput *li) { @@ -794,6 +822,9 @@ handle_and_print_events(struct libinput *li) case LIBINPUT_EVENT_TABLET_PAD_STRIP: print_tablet_pad_strip_event(ev); break; + case LIBINPUT_EVENT_SWITCH_TOGGLE: + print_switch_event(ev); + break; } libinput_event_destroy(ev); diff --git a/tools/event-gui.c b/tools/event-gui.c index e819901..155cc95 100644 --- a/tools/event-gui.c +++ b/tools/event-gui.c @@ -845,6 +845,8 @@ handle_event_libinput(GIOChannel *source, GIOCondition condition, gpointer data) case LIBINPUT_EVENT_TABLET_PAD_RING: case LIBINPUT_EVENT_TABLET_PAD_STRIP: break; + case LIBINPUT_EVENT_SWITCH_TOGGLE: + break; } libinput_event_destroy(ev); |