Xlib and mouse events - Xwindows

This is a discussion on Xlib and mouse events - Xwindows ; Hi, I want to make a C program which capture all mouse events, not only those from a given window, is it possible ? If yes, how ? I tried a XSelectInput(dpy, DefaultRootWindow(dpy), myMASK) but It didn't work. Thanks in ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: Xlib and mouse events

  1. Xlib and mouse events

    Hi,

    I want to make a C program which capture all mouse events, not only
    those from a given window, is it possible ?
    If yes, how ?

    I tried a XSelectInput(dpy, DefaultRootWindow(dpy), myMASK) but It
    didn't work.

    Thanks in advance,

  2. Re: Xlib and mouse events

    On Aug 20, 1:50*am, Benjamin BOUCHER wrote:
    > Hi,
    >
    > I want to make a C program which capture all mouse events, not only
    > those from a given window, is it possible ?
    > If yes, how ?
    >
    > I tried a XSelectInput(dpy, DefaultRootWindow(dpy), myMASK) but It
    > didn't work.
    >
    > Thanks in advance,


    XGrabPointer()

    --
    Fred Kleinschmidt

  3. Re: Xlib and mouse events

    I tried XGrabPointer but the events are not sent to their default
    clients which is not what I want.
    It seems that the X11 XTrap extension is more adapted.

  4. Re: Xlib and mouse events

    Benjamin BOUCHER wrote:
    > I tried XGrabPointer but the events are not sent to their default
    > clients which is not what I want.
    > It seems that the X11 XTrap extension is more adapted.



    My TkXext code may be of use:
    http://www.xmission.com/~georgeps/im...3.6.12.tar.bz2

    There's some code for capturing events via the X Record extension in:
    src/TkXext.record.c

    The rest of the code uses the XTest extension to playback scripts.

    The TUTORIAL (in the tarball) has an example of recording user X11
    events to a script, and then playing them back.

    XTrap is probably not what you want. From what I understand XRecord and
    XTest came after it. I've used XTrap though for a daemon I wrote years
    ago.

    Also, if you get deeply involved with XRecord, be aware that the async
    contexts (last I checked) are broken in X.org, and XFree86. I don't
    know what breaks them yet, but it was strange, because it must be
    something fairly deeply rooted. The behavior was an endless loop and
    the async context stops supplying events. It happened oddly everytime
    after I started up the gnome control center.

    The implementation of the async context used with
    XRecordEnableContextAsync is also a big bizarre, which could have
    something to do with it. In any case, the synchronous contexts seem to
    work just fine.


    George

  5. Re: Xlib and mouse events

    Thanks,

    Actually, XTrap do the same but XRecord seems to be more simple, as I
    only need to get the mouse events, I think using one or another
    solution is equivalent (structures looks alike,callbacks, etc...)

  6. Re: Xlib and mouse events

    Benjamin BOUCHER writes:
    > Hi,


    > I want to make a C program which capture all mouse events, not only
    > those from a given window, is it possible ?
    > If yes, how ?


    Xevie[1] might help.

    [1] - http://freedesktop.org/wiki/Software/XEvIE

    Ashish Shukla
    --
    ·-- ·- ···· ·--- ·- ···- ·- ·--·-· --· -- ·- ·· ·-·· ·-·-·- -·-· --- --

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.9 (GNU/Linux)

    iEYEARECAAYFAkivHPEACgkQHy+EEHYuXnTtxACgxVLhYM00q+ vbzenDX9dNWrQK
    57sAoI4kuITb61O4P4ijVlZ4O9B5cLbs
    =vAOF
    -----END PGP SIGNATURE-----

+ Reply to Thread