summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2014-04-01 21:57:45 +0200
committerJonas Ådahl <jadahl@gmail.com>2014-04-23 00:07:40 +0200
commit604f22eb795c6ba6faff15ba53e00ae0109cda33 (patch)
tree7b8c759a543924b7ae447f564ca372fd1a043513 /tools
parentdbbc09112383a1dac6b39d9d9e9099c8898d5ee4 (diff)
downloadlibinput-604f22eb795c6ba6faff15ba53e00ae0109cda33.tar.gz
Introduce seat wide button and key count API
Compositors will need to keep provide virtual devices of supported generic device types (pointer, keyboard, touch etc). Events from each device capable of a certain device type abstraction should be combined as if it was only one device. For key and button events this means counting presses of every key or button. With this patch, libinput provides two new API for doing just this; libinput_event_pointer_get_seat_button_count() and libinput_event_keyboard_get_seat_key_count(). With these functions, a compositor can sort out what key or button events that should be ignored for a virtual device. This could for example look like: event = libinput_get_event(libinput); switch (libinput_event_get_type(event)) { ... case LIBINPUT_EVENT_POINTER_BUTTON: device = libinput_event_get_device(event); seat = libinput_event_get_seat(device); pevent = libinput_event_get_pointer_event(event); if (libinput_event_pointer_get_button_state(pevent) && libinput_event_pointer_get_seat_button_count(pevent) == 1) notify_pointer_button_press(seat); else if (libinput_event_pointer_get_button_state(pevent) && libinput_event_pointer_get_seat_button_count(pevent) == 0) notify_pointer_button_release(seat); break; ... } Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/event-debug.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/event-debug.c b/tools/event-debug.c
index c0a08a7a..6cb57ff2 100644
--- a/tools/event-debug.c
+++ b/tools/event-debug.c
@@ -287,9 +287,10 @@ print_button_event(struct libinput_event *ev)
print_event_time(libinput_event_pointer_get_time(p));
state = libinput_event_pointer_get_button_state(p);
- printf("%3d %s\n",
+ printf("%3d %s, seat count: %u\n",
libinput_event_pointer_get_button(p),
- state == LIBINPUT_POINTER_BUTTON_STATE_PRESSED ? "pressed" : "released");
+ state == LIBINPUT_POINTER_BUTTON_STATE_PRESSED ? "pressed" : "released",
+ libinput_event_pointer_get_seat_button_count(p));
}
static void