XTestFakeKeyEvent() and key repetition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [X Forum]     [Xorg]     [XFree86 Newbie]     [IETF Announce]     [Security]     [Font Config]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux Kernel]

  Powered by Linux