devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=54cce990d3fbf607d166294f202b86778709bc7e

commit 54cce990d3fbf607d166294f202b86778709bc7e
Author: Chris Michael <cpmich...@osg.samsung.com>
Date:   Wed May 4 10:43:36 2016 -0400

    elput: Add API function to set pointer position on a given seat
    
    Small patch to add an API function that can be used to set the current
    pointer position on a given seat name. This function (typically) will
    be used inside an Ecore_Evas to "pointer warp".
    
    @feature
    
    Signed-off-by: Chris Michael <cpmich...@osg.samsung.com>
---
 src/lib/elput/Elput.h         | 13 +++++++++++++
 src/lib/elput/elput_evdev.c   |  6 ++++++
 src/lib/elput/elput_input.c   | 34 ++++++++++++++++++++++++++++++++++
 src/lib/elput/elput_private.h |  1 +
 4 files changed, 54 insertions(+)

diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h
index beee677..f3fe16b 100644
--- a/src/lib/elput/Elput.h
+++ b/src/lib/elput/Elput.h
@@ -240,6 +240,19 @@ EAPI void elput_input_shutdown(Elput_Manager *manager);
 EAPI void elput_input_pointer_xy_get(Elput_Manager *manager, const char *seat, 
int *x, int *y);
 
 /**
+ * Set the pointer position on a given seat
+ *
+ * @param manager
+ * @param seat
+ * @param x
+ * @param y
+ *
+ * @ingroup Elput_Input_Group
+ * @since 1.18
+ */
+EAPI void elput_input_pointer_xy_set(Elput_Manager *manager, const char *seat, 
int x, int y);
+
+/**
  * @defgroup Elput_Device_Group
  *
  * Functions that deal with input devices.
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c
index 043e7b6..392a25f 100644
--- a/src/lib/elput/elput_evdev.c
+++ b/src/lib/elput/elput_evdev.c
@@ -1325,6 +1325,12 @@ _evdev_touch_destroy(Elput_Touch *touch)
    free(touch);
 }
 
+void
+_evdev_pointer_motion_send(Elput_Device *edev)
+{
+   _pointer_motion_send(edev);
+}
+
 Elput_Pointer *
 _evdev_pointer_get(Elput_Seat *seat)
 {
diff --git a/src/lib/elput/elput_input.c b/src/lib/elput/elput_input.c
index c6d22cb..d50b023 100644
--- a/src/lib/elput/elput_input.c
+++ b/src/lib/elput/elput_input.c
@@ -300,3 +300,37 @@ elput_input_pointer_xy_get(Elput_Manager *manager, const 
char *seat, int *x, int
         break;
      }
 }
+
+EAPI void
+elput_input_pointer_xy_set(Elput_Manager *manager, const char *seat, int x, 
int y)
+{
+   Elput_Seat *eseat;
+   Elput_Device *edev;
+   Eina_List *l, *ll;
+
+   EINA_SAFETY_ON_NULL_RETURN(manager);
+
+   /* if no seat name is passed in, just use default seat name */
+   if (!seat) seat = "seat0";
+
+   EINA_LIST_FOREACH(manager->input.seats, l, eseat)
+     {
+        if (!eseat->ptr) continue;
+        if ((eseat->name) && (strcmp(eseat->name, seat)))
+          continue;
+
+        eseat->ptr->x = x;
+        eseat->ptr->y = y;
+        eseat->ptr->timestamp = ecore_loop_time_get();
+
+        EINA_LIST_FOREACH(eseat->devices, ll, edev)
+          {
+             if (!libinput_device_has_capability(edev->device,
+                                                 LIBINPUT_DEVICE_CAP_POINTER))
+               continue;
+
+             _evdev_pointer_motion_send(edev);
+             break;
+          }
+     }
+}
diff --git a/src/lib/elput/elput_private.h b/src/lib/elput/elput_private.h
index 3564161..05ee0b1 100644
--- a/src/lib/elput/elput_private.h
+++ b/src/lib/elput/elput_private.h
@@ -240,6 +240,7 @@ void _evdev_device_destroy(Elput_Device *edev);
 void _evdev_keyboard_destroy(Elput_Keyboard *kbd);
 void _evdev_pointer_destroy(Elput_Pointer *ptr);
 void _evdev_touch_destroy(Elput_Touch *touch);
+void _evdev_pointer_motion_send(Elput_Device *edev);
 
 Elput_Pointer *_evdev_pointer_get(Elput_Seat *seat);
 Elput_Keyboard *_evdev_keyboard_get(Elput_Seat *seat);

-- 


Reply via email to