void FocusScreen(int scr) { EX_Window xwin; EX_Time t; int x, y; if (scr < 0 || scr >= ScreenCount(disp)) return; /* IIRC warping to a different screen once did cause * LeaveNotify's on the current root window. This does not * happen in xorg 1.5.3 (and probably other versions). * So, send LeaveNotify to current root and EnterNotify * to new root. */ t = EGetTimestamp(); /* Report LeaveNotify on current root window */ xwin = WinGetXwin(VROOT); EXQueryPointer(xwin, &x, &y, NULL, NULL); _FocusScreenSendEvent(xwin, x, y, t, 0); /* Do warp and report EnterNotify on new root window */ xwin = RootWindow(disp, scr); x = DisplayWidth(disp, scr) / 2; y = DisplayHeight(disp, scr) / 2; EXWarpPointer(xwin, x, y); _FocusScreenSendEvent(xwin, x, y, t, 1); }
Bool EQueryPointer(Win win, int *px, int *py, Window * pchild, unsigned int *pmask) { Window xwin; xwin = (win) ? win->xwin : WinGetXwin(VROOT); return EXQueryPointer(xwin, px, py, pchild, pmask); }