Injecting mouse events into the X server

John Klingler john at jupiter.com
Tue Nov 7 15:08:39 PST 2006


Erik,

I use XTest to allow clients to send both pointer and keyboard
events to the X server. I'm not sure what you are trying to do
so I do not know why you would want to write a driver.

In any case, your X server has to support the XTest extension.
(Most do.) You can use xdpyinfo to determine this. You'll get
something like:

    number of extensions:    16
        BIG-REQUESTS
        ...
        XTEST
        XTestExtension1
        ...

Programmatically, use XTestQueryExtension. Next you need to
determine if the server is going to allow you to grab control.
Use XTestGrabControl for this. After that, depending on what
you want to so, use:
XTestFakeMotionEvent   (pointer motion)
XTestFakeButtonEvent   (mouse button press/release)
XTestFakeKeyEvent      (keyboard key press/release)

I didn't find any man pages on XTest but am sure there are some
floating around somewhere. In any case, the code is pretty
straightforward: xc/lib/Xtst/XTest.c.

John

Erik de Castro Lopo wrote:

>Hi all,
>
>I'm writing a driver for a touch screen device and need a way
>to get X events into the X server with as little effor on my
>part as possible.
>
>This is mainly for testing. Eventually I intend to either write
>a proper kernel level driver of an X input diver.
>
>Any advice or pointers?
>
>Thanks,
>Erik
>  
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg/attachments/20061107/ce86b395/attachment.html>


More information about the xorg mailing list