I wrote a test program that shall simulate a user typing "test" on the keyboard. I am using your Xtest extension for that. The program simulates "ttes" instead of "test". The same problem can be seen in Xautomation from http://hoopajoo.net/projects/xautomation.html Here is my test program simkey.c: // This program demonstrates a bug in the X test extension // Compile and link this program like this: gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o simkey simkey.c -lX11 -lXtst #include <X11/extensions/XTest.h> #include <X11/keysym.h> #include <stdio.h> int main(int argc, char *argv[]) { Display* disp = XOpenDisplay(NULL); { char *t="test"; char *s; int i; for (i=0;i<=3;i++) { strncpy(s,&t[i],1); XTestFakeKeyEvent( disp, XKeysymToKeycode (disp, *s), True, CurrentTime); XTestFakeKeyEvent( disp, XKeysymToKeycode (disp, *s), False, CurrentTime); } } XCloseDisplay(disp); }
product shift, xorg -> xtest.
does flushing xlib's buffer -- XFlush(dpy, FALSE); -- after each character, help? if not, does using XSync instead of XFlush help?
Time has passed, my compiler has changed to GCC 4. Here's my adapted test program: /* This program demonstrates a bug in the X test extension Compile and link this program like this: gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o simkey simkey.c -lX11 -lXtst */ #include <X11/extensions/XTest.h> #include <X11/keysym.h> #include <stdio.h> int main(int argc, char *argv[]) { Display* disp = XOpenDisplay(NULL); { char *t="test"; char *s; int i; for (i=0;i<=3;i++) { s=&t[i]; XTestFakeKeyEvent( disp, XKeysymToKeycode (disp, *s), True, CurrentTime); XTestFakeKeyEvent( disp, XKeysymToKeycode (disp, *s), False, CurrentTime); } } XCloseDisplay(disp); }
XFlush(disp) brings the solution.
err... thanks, you really made my day !!!
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.