e_input_evdev: change touch event's slot id to 0 if it is -1 94/218194/3
authorjeon <jhyuni.kang@samsung.com>
Wed, 20 Nov 2019 07:54:20 +0000 (16:54 +0900)
committerjeon <jhyuni.kang@samsung.com>
Thu, 12 Dec 2019 08:26:23 +0000 (17:26 +0900)
  - Touch event's slot id is always -1, if this device is single touch device
  - So change this slot id to 0 to support single touch devices

Change-Id: I2149960d02ec6a5199973700b39f2b7338da8ecd

src/bin/e_input_evdev.c

index eb2030bb7da8acf7d8e967a2263f691809e4d762..bb99d949281811ef3f9ef876b5823cbca425a602 100644 (file)
@@ -1125,6 +1125,21 @@ _device_handle_touch_down(struct libinput_device *device, struct libinput_event_
      libinput_event_touch_get_y_transformed(event, h);
 
    edev->mt_slot = libinput_event_touch_get_slot(event);
+   if (edev->mt_slot < 0)
+     {
+        /* FIXME: The single touch device return slot id -1
+         *        But currently we have no API to distinguish multi touch or single touch
+         *        After libinput 1.11 version, libinput provides get_touch_count API,
+         *        so we can distinguish multi touch device or single touch device.
+         */
+        if (edev->mt_slot == -1)
+          edev->mt_slot = 0;
+        else
+          {
+             WRN("%d slot touch down events are not supported\n", edev->mt_slot);
+             return;
+          }
+     }
 
    if (edev->mt_slot < E_INPUT_MAX_SLOTS)
      {
@@ -1168,6 +1183,21 @@ _device_handle_touch_motion(struct libinput_device *device, struct libinput_even
    edev->seat->ptr.iy = edev->seat->ptr.dy;
 
    edev->mt_slot = libinput_event_touch_get_slot(event);
+   if (edev->mt_slot < 0)
+     {
+        /* FIXME: The single touch device return slot id -1
+         *        But currently we have no API to distinguish multi touch or single touch
+         *        After libinput 1.11 version, libinput provides get_touch_count API,
+         *        so we can distinguish multi touch device or single touch device.
+         */
+        if (edev->mt_slot == -1)
+          edev->mt_slot = 0;
+        else
+          {
+             WRN("%d slot touch motion events are not supported\n", edev->mt_slot);
+             return;
+          }
+     }
 
    if (edev->mt_slot < E_INPUT_MAX_SLOTS)
      {
@@ -1190,6 +1220,21 @@ _device_handle_touch_up(struct libinput_device *device, struct libinput_event_to
      }
 
    edev->mt_slot = libinput_event_touch_get_slot(event);
+   if (edev->mt_slot < 0)
+     {
+        /* FIXME: The single touch device return slot id -1
+         *        But currently we have no API to distinguish multi touch or single touch
+         *        After libinput 1.11 version, libinput provides get_touch_count API,
+         *        so we can distinguish multi touch device or single touch device.
+         */
+        if (edev->mt_slot == -1)
+          edev->mt_slot = 0;
+        else
+          {
+             WRN("%d slot touch up events are not supported\n", edev->mt_slot);
+             return;
+          }
+     }
 
    if (edev->mt_slot < E_INPUT_MAX_SLOTS)
      {