Ecore Pointer get root x,y position without ecore_x_window.

This commit is contained in:
Deon 'PrinceAMD' Thomas 2013-04-18 12:07:26 +09:00 committed by Carsten Haitzler (Rasterman)
parent 10a017dc9b
commit 7df54da4c4
2 changed files with 27 additions and 0 deletions

View File

@ -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);

View File

@ -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.
*