elput: group tablet input devices into pointer devices

this is consistent with x11 behavior as well as the behavior of other toolkits
under wayland

@feature
This commit is contained in:
Mike Blumenkrantz 2017-05-26 16:34:10 -04:00
parent 859b5a0423
commit 679872a800
2 changed files with 16 additions and 9 deletions

View File

@ -1265,21 +1265,25 @@ _evdev_device_create(Elput_Seat *seat, struct libinput_device *device)
if ((libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_POINTER) && if ((libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_POINTER) &&
(libinput_device_pointer_has_button(device, BTN_LEFT)))) (libinput_device_pointer_has_button(device, BTN_LEFT))))
edev->caps |= EVDEV_SEAT_POINTER;
if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TABLET_TOOL))
edev->caps |= EVDEV_SEAT_POINTER | EVDEV_SEAT_TABLET_TOOL;
if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TABLET_PAD))
edev->caps |= EVDEV_SEAT_POINTER | EVDEV_SEAT_TABLET_PAD;
if (edev->caps & EVDEV_SEAT_POINTER)
{ {
_pointer_init(seat); _pointer_init(seat);
edev->caps |= EVDEV_SEAT_POINTER; edev->caps |= EVDEV_SEAT_POINTER;
} }
if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TOUCH)) if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TOUCH))
{ edev->caps |= EVDEV_SEAT_TOUCH;
_touch_init(seat); if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_GESTURE))
edev->caps |= EVDEV_SEAT_TOUCH; edev->caps |= EVDEV_SEAT_TOUCH | EVDEV_SEAT_GESTURE;
} if (edev->caps & EVDEV_SEAT_TOUCH)
_touch_init(seat);
if (!((edev->caps & EVDEV_SEAT_KEYBOARD) || if (!edev->caps) goto err;
(edev->caps & EVDEV_SEAT_POINTER) ||
(edev->caps & EVDEV_SEAT_TOUCH)))
goto err;
libinput_device_set_user_data(device, edev); libinput_device_set_user_data(device, edev);
libinput_device_ref(edev->device); libinput_device_ref(edev->device);

View File

@ -63,7 +63,10 @@ typedef enum _Elput_Device_Capability
{ {
EVDEV_SEAT_POINTER = (1 << 0), EVDEV_SEAT_POINTER = (1 << 0),
EVDEV_SEAT_KEYBOARD = (1 << 1), EVDEV_SEAT_KEYBOARD = (1 << 1),
EVDEV_SEAT_TOUCH = (1 << 2) EVDEV_SEAT_TOUCH = (1 << 2),
EVDEV_SEAT_TABLET_TOOL = (1 << 3),
EVDEV_SEAT_TABLET_PAD = (1 << 4),
EVDEV_SEAT_GESTURE = (1 << 5),
} Elput_Device_Capability; } Elput_Device_Capability;
typedef struct _Elput_Interface typedef struct _Elput_Interface