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); }
void EWarpPointer(Win win, int x, int y) { EXWarpPointer(win ? win->xwin : None, x, y); }