e_input: generate only one mouse move event from pointer warp request 08/214508/7
authorjeon <jhyuni.kang@samsung.com>
Mon, 23 Sep 2019 11:10:50 +0000 (20:10 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Mon, 30 Sep 2019 03:10:01 +0000 (03:10 +0000)
Change-Id: Iad1053cd9fb6eecc81358d3481a596627e5075ba

src/bin/e_input_device.c

index a5b0d6c27d491b1e94cf64f4c38c7e60e362cc21..5aa72b2e01faf79ed7840cc7d0368330c0d38be3 100644 (file)
@@ -315,23 +315,43 @@ E_API Eina_Bool
 e_input_device_pointer_warp(E_Input_Device *dev, int x, int y)
 {
    E_Input_Seat *seat;
-   E_Input_Evdev *edev;
+   E_Input_Evdev *edev, *warp_dev;
    Eina_List *l, *ll;
    Eina_Bool found = EINA_FALSE;
+   char *device_name = NULL, *device_path = NULL;
 
    if (!dev)
      dev = _e_input_device_default_get();
 
+   if (e_devicemgr && e_devicemgr->last_device_ptr)
+     {
+        device_name = (char *)e_devicemgr->last_device_ptr->name;
+        device_path = (char *)e_devicemgr->last_device_ptr->identifier;
+     }
+
    /* check for valid device */
    EINA_SAFETY_ON_TRUE_RETURN_VAL(!dev, EINA_FALSE);
    EINA_LIST_FOREACH(dev->seats, l, seat)
      {
+        warp_dev = NULL;
         EINA_LIST_FOREACH(seat->devices, ll, edev)
           {
              if (!libinput_device_has_capability(edev->device,
                                                  LIBINPUT_DEVICE_CAP_POINTER))
                continue;
 
+             if (!e_util_strcmp(libinput_device_get_name(edev->device), device_name) &&
+                 !e_util_strcmp(edev->path, device_path))
+               {
+                  warp_dev = edev;
+                  break;
+               }
+
+             if (!warp_dev) warp_dev = edev;
+          }
+
+        if (warp_dev)
+          {
              seat->ptr.dx = seat->ptr.ix = x;
              seat->ptr.dy = seat->ptr.iy = y;
              _e_input_pointer_motion_post(edev);