libinput/src
Jonas Ådahl 604f22eb79 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>
2014-04-23 00:07:40 +02:00
..
evdev-mt-touchpad-tap.c touchpad: clean up tap bits on destroy 2014-03-25 16:43:35 +10:00
evdev-mt-touchpad.c touchpad: clean up tap bits on destroy 2014-03-25 16:43:35 +10:00
evdev-mt-touchpad.h touchpad: clean up tap bits on destroy 2014-03-25 16:43:35 +10:00
evdev-touchpad.c Use log_error instead of fprintf in old touchpad code 2014-04-10 11:11:56 +10:00
evdev.c Introduce seat wide button and key count API 2014-04-23 00:07:40 +02:00
evdev.h evdev: Dynamically allocate slot array 2014-04-22 23:44:24 +02:00
filter.c Port evdev code to be used as a shared library 2013-11-12 22:37:20 +01:00
filter.h Port evdev code to be used as a shared library 2013-11-12 22:37:20 +01:00
libinput-private.h Introduce seat wide button and key count API 2014-04-23 00:07:40 +02:00
libinput-util.c Add a customizable log handler 2014-02-19 08:35:25 +10:00
libinput-util.h Fix up ARRAY_FOR_EACH macro 2014-04-10 11:11:56 +10:00
libinput-version.h.in Port evdev code to be used as a shared library 2013-11-12 22:37:20 +01:00
libinput.c Introduce seat wide button and key count API 2014-04-23 00:07:40 +02:00
libinput.h Introduce seat wide button and key count API 2014-04-23 00:07:40 +02:00
libinput.pc.in Add libudev and -lm to Requires.private 2013-12-21 12:10:19 +01:00
Makefile.am touchpad: add support for multi-finger tapping 2014-03-24 14:56:40 +10:00
path.c path: Silence -Wmaybe-uninitialized compiler warning 2014-02-26 19:32:33 +01:00
path.h path: modify backend to allow for more than one device 2014-02-10 11:23:35 +10:00
udev-seat.c udev: factor out device_removed handling 2014-03-24 09:08:06 +10:00
udev-seat.h udev: Drop unused seat_name in struct udev_seat 2014-01-16 20:42:30 +01:00