devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=28f725a6875951c0500d22c5bca9a393d77507d7

commit 28f725a6875951c0500d22c5bca9a393d77507d7
Author: Chris Michael <cpmich...@osg.samsung.com>
Date:   Wed May 4 10:20:04 2016 -0400

    elput: Add API function to get pointer position on a given seat
    
    Small patch to add an API function that can be used to retrieve
    current pointer position on a given seat name.
    
    @feature
    
    Signed-off-by: Chris Michael <cpmich...@osg.samsung.com>
---
 src/lib/elput/Elput.h       | 13 +++++++++++++
 src/lib/elput/elput_input.c | 25 +++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h
index d629dd4..beee677 100644
--- a/src/lib/elput/Elput.h
+++ b/src/lib/elput/Elput.h
@@ -227,6 +227,19 @@ EAPI Eina_Bool elput_input_init(Elput_Manager *manager, 
const char *seat);
 EAPI void elput_input_shutdown(Elput_Manager *manager);
 
 /**
+ * Get 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_get(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_input.c b/src/lib/elput/elput_input.c
index 6c43f2f..c6d22cb 100644
--- a/src/lib/elput/elput_input.c
+++ b/src/lib/elput/elput_input.c
@@ -275,3 +275,28 @@ elput_input_shutdown(Elput_Manager *manager)
 
    libinput_unref(manager->input.lib);
 }
+
+EAPI void
+elput_input_pointer_xy_get(Elput_Manager *manager, const char *seat, int *x, 
int *y)
+{
+   Elput_Seat *eseat;
+   Eina_List *l;
+
+   if (x) *x = 0;
+   if (y) *y = 0;
+
+   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;
+        if (x) *x = eseat->ptr->x;
+        if (y) *y = eseat->ptr->y;
+        break;
+     }
+}

-- 


Reply via email to