From: <enl...@li...> - 2005-08-07 20:33:28
|
Enlightenment CVS committal Author : kwo Project : e16 Module : e Dir : e16/e/src Modified Files: edge.c ewins.c focus.c hiwin.c ipc.c menus.c pager.c screen.c tooltips.c warp.c x.c xwin.h zoom.c Log Message: Wrap XWarpPointer and XQueryPointer. =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/edge.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- edge.c 16 Jul 2005 16:57:40 -0000 1.18 +++ edge.c 7 Aug 2005 20:33:16 -0000 1.19 @@ -41,7 +41,7 @@ return; /* Quit if pointer has left screen */ - if (!PointerAt(NULL, NULL)) + if (!EQueryPointer(None, NULL, NULL, NULL, NULL)) return; /* Quit if in fullscreen window */ @@ -92,7 +92,7 @@ Mode.py = Mode.y; Mode.x += dx; Mode.y += dy; - XWarpPointer(disp, None, VRoot.win, 0, 0, 0, 0, Mode.x, Mode.y); + EWarpPointer(VRoot.win, Mode.x, Mode.y); Mode.flipp = 1; MoveCurrentAreaBy(dax, day); Mode.flipp = 0; =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/ewins.c,v retrieving revision 1.91 retrieving revision 1.92 diff -u -3 -r1.91 -r1.92 --- ewins.c 7 Aug 2005 14:06:51 -0000 1.91 +++ ewins.c 7 Aug 2005 20:33:16 -0000 1.92 @@ -307,29 +307,22 @@ EWin * GetEwinByCurrentPointer(void) { - Window rt, ch; - int dum, x, y; - unsigned int mr; + Window child; - XQueryPointer(disp, DeskGetWin(DesksGetCurrent()), &rt, &ch, &x, &y, &dum, - &dum, &mr); + EQueryPointer(DeskGetWin(DesksGetCurrent()), NULL, NULL, &child, NULL); - return EwinFindByFrame(ch); + return EwinFindByFrame(child); } EWin * GetEwinPointerInClient(void) { - Window rt, ch; - int dum, px, py, desk; + int px, py, desk; EWin *const *lst, *ewin; int i, num; desk = DesktopAt(Mode.x, Mode.y); - XQueryPointer(disp, DeskGetWin(desk), &rt, &ch, &dum, &dum, &px, &py, - (unsigned int *)&dum); - px -= DeskGetX(desk); - py -= DeskGetY(desk); + EQueryPointer(DeskGetWin(desk), &px, &py, NULL, NULL); lst = EwinListGetForDesk(&num, desk); for (i = 0; i < num; i++) @@ -747,9 +740,7 @@ /* Place the window below the mouse pointer */ if (Conf.place.manual_mouse_pointer) { - int rx, ry, wx, wy; - unsigned int mask; - Window junk, root_return; + int rx, ry; int newWinX = 0, newWinY = 0; /* if the loser has manual placement on and the app asks to be on */ @@ -757,8 +748,7 @@ /* the window there */ DeskGoto(desk); - XQueryPointer(disp, VRoot.win, &root_return, &junk, &rx, &ry, &wx, - &wy, &mask); + EQueryPointer(VRoot.win, &rx, &ry, NULL, NULL); Mode.x = rx; Mode.y = ry; ewin->state.placed = 1; @@ -801,17 +791,14 @@ /* if we should slide it in and are not currently in the middle of a slide */ if ((manplace) && (!ewin->state.placed)) { - int rx, ry, wx, wy; - unsigned int mask; - Window junk, root_return; + int rx, ry; /* if the loser has manual placement on and the app asks to be on */ /* a desktop, then send E to that desktop so the user can place */ /* the window there */ DeskGoto(desk); - XQueryPointer(disp, VRoot.win, &root_return, &junk, &rx, &ry, &wx, &wy, - &mask); + EQueryPointer(VRoot.win, &rx, &ry, NULL, NULL); Mode.x = rx; Mode.y = ry; ewin->state.placed = 1; =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/focus.c,v retrieving revision 1.115 retrieving revision 1.116 diff -u -3 -r1.115 -r1.116 --- focus.c 4 Aug 2005 16:01:54 -0000 1.115 +++ focus.c 7 Aug 2005 20:33:16 -0000 1.116 @@ -371,8 +371,7 @@ do_warp = 1; if (do_warp && ewin != Mode.mouse_over_ewin) { - XWarpPointer(disp, None, EoGetWin(ewin), 0, 0, 0, 0, EoGetW(ewin) / 2, - EoGetH(ewin) / 2); + EWarpPointer(EoGetWin(ewin), EoGetW(ewin) / 2, EoGetH(ewin) / 2); Mode.mouse_over_ewin = ewin; } @@ -401,7 +400,7 @@ ICCCM_Cmap(ewin); /* Quit if pointer is not on our screen */ - if (!PointerAt(NULL, NULL)) + if (!EQueryPointer(None, NULL, NULL, NULL, NULL)) { Mode.focuswin = NULL; return; =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/hiwin.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- hiwin.c 6 Aug 2005 10:25:55 -0000 1.2 +++ hiwin.c 7 Aug 2005 20:33:16 -0000 1.3 @@ -447,7 +447,7 @@ EoMoveResize(phi, xx, yy, ww, hh); pz->draw(phi); - PointerAt(&px, &py); + EQueryPointer(None, &px, &py, NULL, NULL); if ((px < x) || (py < y) || (px >= (x + w)) || (py >= (y + h))) { pz->fini(phi, 0); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/ipc.c,v retrieving revision 1.225 retrieving revision 1.226 diff -u -3 -r1.225 -r1.226 --- ipc.c 4 Aug 2005 16:01:56 -0000 1.225 +++ ipc.c 7 Aug 2005 20:33:16 -0000 1.226 @@ -1255,31 +1255,31 @@ x = y = 0; if (!strcmp(params, "?")) { - PointerAt(&x, &y); + EQueryPointer(None, &x, &y, NULL, NULL); IpcPrintf("Pointer location: %d %d\n", x, y); } else if (!strncmp(params, "abs", 3)) { sscanf(params, "%*s %i %i", &x, &y); - XWarpPointer(disp, None, VRoot.win, 0, 0, 0, 0, x, y); + EWarpPointer(VRoot.win, x, y); } else if (!strncmp(params, "rel", 3)) { sscanf(params, "%*s %i %i", &x, &y); - XWarpPointer(disp, None, None, 0, 0, 0, 0, x, y); + EWarpPointer(None, x, y); } else if (!strncmp(params, "scr", 3)) { x = (VRoot.scr + 1) % ScreenCount(disp); sscanf(params, "%*s %i", &x); if (x >= 0 && x < ScreenCount(disp)) - XWarpPointer(disp, None, RootWindow(disp, x), 0, 0, 0, 0, - DisplayWidth(disp, x) / 2, DisplayHeight(disp, x) / 2); + EWarpPointer(RootWindow(disp, x), DisplayWidth(disp, x) / 2, + DisplayHeight(disp, x) / 2); } else { sscanf(params, "%i %i", &x, &y); - XWarpPointer(disp, None, None, 0, 0, 0, 0, x, y); + EWarpPointer(None, x, y); } } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v retrieving revision 1.206 retrieving revision 1.207 diff -u -3 -r1.206 -r1.207 --- menus.c 7 Aug 2005 17:58:48 -0000 1.206 +++ menus.c 7 Aug 2005 20:33:19 -0000 1.207 @@ -1460,8 +1460,7 @@ Conf.shadespeed); if (((xdist != 0) || (ydist != 0)) && (Conf.menus.warp)) - XWarpPointer(disp, None, None, 0, 0, 0, 0, xdist, - ydist); + EWarpPointer(None, xdist, ydist); #ifdef HAS_XINERAMA } #endif @@ -1583,8 +1582,7 @@ MenusSetEvents(1); if (Conf.menus.warp) - XWarpPointer(disp, None, mi->win, 0, 0, 0, 0, - mi->text_w / 2, mi->text_h / 2); + EWarpPointer(mi->win, mi->text_w / 2, mi->text_h / 2); } } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v retrieving revision 1.171 retrieving revision 1.172 diff -u -3 -r1.171 -r1.172 --- pager.c 6 Aug 2005 10:21:59 -0000 1.171 +++ pager.c 7 Aug 2005 20:33:20 -0000 1.172 @@ -1084,15 +1084,12 @@ static void PagerHandleMotion(Pager * p, int x, int y) { - int hx, hy; - unsigned int mr; - Window rw, cw; EWin *ewin; if (!Conf_pagers.enable) return; - XQueryPointer(disp, p->win, &rw, &cw, &hx, &hy, &x, &y, &mr); + EQueryPointer(p->win, &x, &y, NULL, NULL); if (x >= 0 && x < p->w && y >= 0 && y < p->h) ewin = EwinInPagerAt(p, x, y); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/screen.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- screen.c 16 Jul 2005 16:57:43 -0000 1.11 +++ screen.c 7 Aug 2005 20:33:20 -0000 1.12 @@ -23,6 +23,7 @@ */ #include "E.h" #include "ewins.h" +#include "xwin.h" #ifdef HAS_XINERAMA static XineramaScreenInfo *screens = NULL; @@ -149,13 +150,9 @@ int GetPointerScreenGeometry(int *px, int *py, int *pw, int *ph) { - Window rt, ch; int pointer_x, pointer_y; - int d; - unsigned int ud; - XQueryPointer(disp, VRoot.win, &rt, &ch, &pointer_x, &pointer_y, &d, &d, - &ud); + EQueryPointer(VRoot.win, &pointer_x, &pointer_y, NULL, NULL); return ScreenGetGeometry(pointer_x, pointer_y, px, py, pw, ph); } @@ -163,13 +160,9 @@ int GetPointerScreenAvailableArea(int *px, int *py, int *pw, int *ph) { - Window rt, ch; int pointer_x, pointer_y; - int d; - unsigned int ud; - XQueryPointer(disp, VRoot.win, &rt, &ch, &pointer_x, &pointer_y, &d, &d, - &ud); + EQueryPointer(VRoot.win, &pointer_x, &pointer_y, NULL, NULL); return ScreenGetAvailableArea(pointer_x, pointer_y, px, py, pw, ph); } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/tooltips.c,v retrieving revision 1.80 retrieving revision 1.81 diff -u -3 -r1.80 -r1.81 --- tooltips.c 2 Aug 2005 16:50:40 -0000 1.80 +++ tooltips.c 7 Aug 2005 20:33:20 -0000 1.81 @@ -711,16 +711,15 @@ static void ToolTipTimeout(int val __UNUSED__, void *data __UNUSED__) { - int x, y, dum; + int x, y; unsigned int mask; - Window win, rt, ch; + Window win; ActionClass *ac; const char *tts; /* In the case of multiple screens, check to make sure * the root window is still where the mouse is... */ - if (False == - XQueryPointer(disp, VRoot.win, &rt, &ch, &dum, &dum, &x, &y, &mask)) + if (!EQueryPointer(VRoot.win, &x, &y, NULL, &mask)) return; /* In case this is a virtual root */ =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/warp.c,v retrieving revision 1.75 retrieving revision 1.76 diff -u -3 -r1.75 -r1.76 --- warp.c 19 Jul 2005 20:24:37 -0000 1.75 +++ warp.c 7 Aug 2005 20:33:21 -0000 1.76 @@ -295,8 +295,7 @@ if (Conf.focus.warp_on_next) if (ewin != Mode.mouse_over_ewin && !ewin->state.iconified) { - XWarpPointer(disp, None, EoGetWin(ewin), 0, 0, 0, 0, - EoGetW(ewin) / 2, EoGetH(ewin) / 2); + EWarpPointer(EoGetWin(ewin), EoGetW(ewin) / 2, EoGetH(ewin) / 2); Mode.mouse_over_ewin = ewin; } if (Conf.warplist.warpfocused) @@ -342,8 +341,7 @@ if (Conf.warplist.warp_on_select) if (ewin != Mode.mouse_over_ewin) { - XWarpPointer(disp, None, EoGetWin(ewin), 0, 0, 0, 0, - EoGetW(ewin) / 2, EoGetH(ewin) / 2); + EWarpPointer(EoGetWin(ewin), EoGetW(ewin) / 2, EoGetH(ewin) / 2); Mode.mouse_over_ewin = ewin; } FocusToEWin(ewin, FOCUS_SET); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/x.c,v retrieving revision 1.103 retrieving revision 1.104 diff -u -3 -r1.103 -r1.104 --- x.c 7 Aug 2005 10:51:07 -0000 1.103 +++ x.c 7 Aug 2005 20:33:21 -0000 1.104 @@ -846,6 +846,35 @@ } void +EWarpPointer(Window win, int x, int y) +{ + XWarpPointer(disp, None, win, 0, 0, 0, 0, x, y); +} + +Bool +EQueryPointer(Window win, int *px, int *py, Window * pchild, + unsigned int *pmask) +{ + Window root, child; + int root_x, root_y; + unsigned int mask; + + if (win == None) + win = VRoot.win; + if (!px) + px = &root_x; + if (!py) + py = &root_y; + if (!pchild) + pchild = &child; + if (!pmask) + pmask = &mask; + + return XQueryPointer(disp, win, &root, pchild, &root_x, &root_y, px, py, + pmask); +} + +void ESelectInputAdd(Window win, long mask) { XWindowAttributes xwa; @@ -1458,20 +1487,6 @@ return VRoot.win; } -Bool -PointerAt(int *x, int *y) -{ - Window dw; - int dd; - unsigned int mm; - - if (!x || !y) - x = y = ⅆ - - /* Return True if pointer is on "our" screen */ - return XQueryPointer(disp, VRoot.win, &dw, &dw, &dd, &dd, x, y, &mm); -} - Display * EDisplayOpen(const char *dstr, int scr) { =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/xwin.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- xwin.h 16 Jul 2005 16:57:44 -0000 1.1 +++ xwin.h 7 Aug 2005 20:33:21 -0000 1.2 @@ -78,6 +78,9 @@ int *dest_x_return, int *dest_y_return, Window * child_return); +void EWarpPointer(Window win, int x, int y); +Bool EQueryPointer(Window win, int *px, int *py, Window * pchild, + unsigned int *pmask); #define ESelectInput(win, mask) XSelectInput(disp, win, mask) #define EGetWindowAttributes(win, attr) XGetWindowAttributes(disp, win, attr) @@ -114,7 +117,6 @@ Window WindowAtXY_0(Window base, int bx, int by, int x, int y); Window WindowAtXY(int x, int y); -Bool PointerAt(int *x, int *y); void EDrawableDumpImage(Drawable draw, const char *txt); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/zoom.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -3 -r1.30 -r1.31 --- zoom.c 4 Aug 2005 16:02:02 -0000 1.30 +++ zoom.c 7 Aug 2005 20:33:21 -0000 1.31 @@ -218,8 +218,8 @@ if (zoom_mask_4) EDestroyWindow(zoom_mask_4); SwitchRes(0, 0, 0, 0, 0); - XWarpPointer(disp, None, _EwinGetClientXwin(ewin), 0, 0, 0, 0, - ewin->client.w / 2, ewin->client.h / 2); + EWarpPointer(_EwinGetClientXwin(ewin), ewin->client.w / 2, + ewin->client.h / 2); ESync(); zoom_last_ewin = NULL; } @@ -250,8 +250,8 @@ EwinMove(ewin, -ewin->border->border.left + x1, -ewin->border->border.top + y1); FocusToEWin(ewin, FOCUS_SET); - XWarpPointer(disp, None, _EwinGetClientXwin(ewin), 0, 0, 0, 0, - ewin->client.w / 2, ewin->client.h / 2); + EWarpPointer(_EwinGetClientXwin(ewin), ewin->client.w / 2, + ewin->client.h / 2); #if 0 /* Doesn't work as intended */ XGrabPointer(disp, _EwinGetClientXwin(ewin), True, ButtonPressMask | ButtonReleaseMask | |