summaryrefslogtreecommitdiff
path: root/src/lib/elput/elput_evdev.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2016-12-08 14:30:41 -0500
committerChris Michael <cp.michael@samsung.com>2016-12-08 14:32:22 -0500
commit8ebf4cd972674406b1fbfc497617996f1d7f4462 (patch)
treefedc1642b1c9ec2b1690838a8ad497400c5be631 /src/lib/elput/elput_evdev.c
parentb66324644c3466bfd58df10631fb82f9a1d4815f (diff)
elput: Improve checks for keyboard & pointer devices
Some devices reported by libinput show up as both keyboard and mouse, even tho they are physically only just a keyboard or just a mouse. When a device gets added, we can verify if it is actually a mouse by checking if the device has BTN_LEFT (and for keyboards, check KEY_ENTER). This stops us from getting multiple mouse pointers reported when we really only have one. @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/elput/elput_evdev.c')
-rw-r--r--src/lib/elput/elput_evdev.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c
index 1b0ca1b183..d191f49110 100644
--- a/src/lib/elput/elput_evdev.c
+++ b/src/lib/elput/elput_evdev.c
@@ -1239,13 +1239,15 @@ _evdev_device_create(Elput_Seat *seat, struct libinput_device *device)
1239 edev->seat = seat; 1239 edev->seat = seat;
1240 edev->device = device; 1240 edev->device = device;
1241 1241
1242 if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD)) 1242 if ((libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD)) &&
1243 (libinput_device_keyboard_has_key(device, KEY_ENTER)))
1243 { 1244 {
1244 _keyboard_init(seat, seat->manager->cached.keymap); 1245 _keyboard_init(seat, seat->manager->cached.keymap);
1245 edev->caps |= EVDEV_SEAT_KEYBOARD; 1246 edev->caps |= EVDEV_SEAT_KEYBOARD;
1246 } 1247 }
1247 1248
1248 if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_POINTER)) 1249 if ((libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_POINTER) &&
1250 (libinput_device_pointer_has_button(device, BTN_LEFT))))
1249 { 1251 {
1250 _pointer_init(seat); 1252 _pointer_init(seat);
1251 edev->caps |= EVDEV_SEAT_POINTER; 1253 edev->caps |= EVDEV_SEAT_POINTER;