XTestFakeMotionEvent no longer works on multiple screen displays
Submitted by Karl Runge
Assigned to Xorg Project Team
Description
It appears that sometime in the 2009 time frame the XTEST interface:
XTestFakeMotionEvent(dpy, screen, x, y, delay)
on a multiple screen display stopped flipping to the one specified by the screen argument. The current behavior is that it stays on the screen that has the current focus and does the motion there (i.e. as though screen = -1 were specified.)
The following program can be used on a multiple screen display to reproduce the problem:
/* cc -o flip_screens flip_screens.c -L /usr/X11R6/lib -lX11 -lXtst */
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/extensions/XTest.h>
int main() { int i, s; Display dpy = XOpenDisplay(NULL); if (!dpy) { printf("XOpenDisplay failed.\n"); return 1; } for (i=0; i < 10; i++) { for (s=0; s < 2; s++) { int n = 200+10i; printf("flipping to screen: %d ...\n", s); XTestFakeMotionEvent(dpy, s, n, n, CurrentTime); XFlush(dpy); sleep(1); } } XCloseDisplay(dpy); return 0; }