ecore-drm: Add function to return the pointer xy of Ecore_Drm_Device
authorChris Michael <cp.michael@samsung.com>
Wed, 4 Mar 2015 16:46:22 +0000 (11:46 -0500)
committerChris Michael <cp.michael@samsung.com>
Wed, 4 Mar 2015 16:49:44 +0000 (11:49 -0500)
Summary: This adds a function (ecore_drm_device_pointer_xy_get) to we
can return the mouse position inside ecore_evas_pointer_xy_get calls.
This is going to be used for centering the mouse when E-Wl starts up.

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/ecore_drm/Ecore_Drm.h
src/lib/ecore_drm/ecore_drm_device.c

index ed76983ea1db7c7427f58eaeefc3e7aa7275826d..10928ed092e7c4b21bcf709dc437944ada261a5e 100644 (file)
@@ -312,4 +312,18 @@ EAPI Eina_Stringshare *ecore_drm_output_model_get(Ecore_Drm_Output *output);
  */
 EAPI Eina_Stringshare *ecore_drm_output_make_get(Ecore_Drm_Output *output);
 
+/**
+ * Get the pointer position of Ecore_Drm_Device
+ *
+ * This function will give the pointer position of Ecore_Drm_Device
+ *
+ * @param dev The Ecore_Drm_Device to get pointer position for
+ * @param *x The parameter in which output x co-ordinate is stored
+ * @param *y The parameter in which output y co-ordinate is stored
+ *
+ * @ingroup Ecore_Drm_Device_Group
+ * @since 1.14
+ */
+EAPI void ecore_drm_device_pointer_xy_get(Ecore_Drm_Device *dev, int *x, int *y);
+
 #endif
index 5d0c0bcfe2e0afee0116141eef3b77cc8cb9d058..89c6b864853a479a91d291377d4bea4a12e3fa7c 100644 (file)
@@ -470,3 +470,32 @@ ecore_drm_device_name_get(Ecore_Drm_Device *dev)
 
    return dev->drm.name;
 }
+
+EAPI void
+ecore_drm_device_pointer_xy_get(Ecore_Drm_Device *dev, int *x, int *y)
+{
+   Ecore_Drm_Seat *seat;
+   Ecore_Drm_Evdev *edev;
+   Eina_List *l, *ll;
+
+   if (x) *x = 0;
+   if (y) *y = 0;
+
+   /* check for valid device */
+   if ((!dev) || (dev->drm.fd < 0)) return;
+
+   EINA_LIST_FOREACH(dev->seats, l, seat)
+     {
+        EINA_LIST_FOREACH(seat->devices, ll, edev)
+          {
+             if (!libinput_device_has_capability(edev->device, 
+                                                 LIBINPUT_DEVICE_CAP_POINTER))
+               continue;
+
+             if (x) *x = edev->mouse.dx;
+             if (y) *y = edev->mouse.dy;
+
+             return;
+          }
+     }
+}