raster pushed a commit to branch master.

commit 7df54da4c4e1a8fb6a3f180ac557c5e5a0741b6b
Author: Deon 'PrinceAMD' Thomas <[email protected]>
Date:   Thu Apr 18 12:07:26 2013 +0900

    Ecore Pointer get root x,y position without ecore_x_window.
---
 src/lib/ecore_x/Ecore_X.h      |  1 +
 src/lib/ecore_x/xlib/ecore_x.c | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h
index 16fc338..ddd21a2 100644
--- a/src/lib/ecore_x/Ecore_X.h
+++ b/src/lib/ecore_x/Ecore_X.h
@@ -1927,6 +1927,7 @@ EAPI void             ecore_x_focus_reset(void);
 EAPI void             ecore_x_events_allow_all(void);
 EAPI void             ecore_x_pointer_last_xy_get(int *x, int *y);
 EAPI void             ecore_x_pointer_xy_get(Ecore_X_Window win, int *x, int 
*y);
+EAPI void             ecore_x_pointer_root_xy_get(int *x, int *y);
 
 /* ecore_x_region.c */
 EAPI Ecore_X_XRegion *ecore_x_xregion_new(void);
diff --git a/src/lib/ecore_x/xlib/ecore_x.c b/src/lib/ecore_x/xlib/ecore_x.c
index 8f578d7..40d6c24 100644
--- a/src/lib/ecore_x/xlib/ecore_x.c
+++ b/src/lib/ecore_x/xlib/ecore_x.c
@@ -2116,6 +2116,32 @@ ecore_x_pointer_xy_get(Ecore_X_Window win,
    if (y) *y = wy;
 }
 
+EAPI void
+ecore_x_pointer_root_xy_get(int *x, int *y)
+{
+   Ecore_X_Window *root;
+   Window rwin, cwin;
+   int rx, ry, wx, wy, ret;
+   int i, num;
+   unsigned int mask;
+
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+   root = ecore_x_window_root_list(&num);
+   for (i = 0; i < num; i++) 
+     {
+        ret = XQueryPointer(_ecore_x_disp, root[i], &rwin, &cwin,
+                            &rx, &ry, &wx, &wy, &mask);
+        if (ret) break;
+     }
+
+   if (!ret)
+     rx = ry = -1;
+
+   if (x) *x = rx;
+   if (y) *y = ry;
+   free(root);
+}
+
 /**
  * Retrieve the Visual ID from a given Visual.
  *

-- 

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter

Reply via email to