Hi! I've just compiled your code and I get a lot "1" keys pressed dusrng 5 seconds, so your code does the job... or do I miss something? This is how I compiled (on GNU/Linux (Debian) + XFree86 + gcc): gcc testx.c -o testx -L/usr/X11R6/lib -lXtst -lX11 ./testx and yes, I called your snippet of code testx.c What X server etc are you running? What is not working? Isn't the key repeated? Don't you want the key to repeat? /hesa On Wed, 2003-11-19 at 19:59, Christoffer Sawicki wrote: > Hello, > I'm writing a program that turns joystick button presses and axis movements > into "X events" via XTestFakeKeyEvent(). What I need to know is how to make > the code snippet below act exactly like if I had held the "1" key (keycode > 10) for 5 seconds. Any help appreciated. And yes, the code below is ugly. > > Please CC me, I'm not on the list. > > --8<-- > #include <X11/Xlib.h> > #include <X11/extensions/XTest.h> > > int main() > { > Display *display = XOpenDisplay(NULL); > XTestFakeKeyEvent(display, 10, True, 0); > XFlush(display); > sleep(5); > XTestFakeKeyEvent(display, 10, False, 0); > XFlush(display); > XCloseDisplay(display); > > return 0; > } > --8<-- > > */ Christoffer Sawicki <qerub@xxxxxxx> > > _______________________________________________ > XFree86 mailing list > XFree86@xxxxxxxxxxx > http://XFree86.Org/mailman/listinfo/xfree86 _______________________________________________ XFree86 mailing list XFree86@xxxxxxxxxxx http://XFree86.Org/mailman/listinfo/xfree86