the OLPC XO grab button (triggering mouse scrolling using a keypress)

Peter Hutterer peter.hutterer at who-t.net
Wed Jul 9 16:53:25 PDT 2008


On Wed, Jul 09, 2008 at 05:12:51PM -0400, Erik Garrison wrote:
> This is the path which I have followed.
> 
> I am using the following calls to grab and ungrab the pointer:
> 
>   XGrabPointer( display,
>                 window,
>                 False,
>                 0,
>                 GrabModeAsync,
>                 GrabModeAsync,
>                 None,
>                 None,
>                 CurrentTime );
> 
>   XUngrabPointer(display, CurrentTime);
> 
> 
> These calls issue a fake button 4 event:
> 
>   XTestFakeButtonEvent(display, button_num, True, CurrentTime);
>   XTestFakeButtonEvent(display, button_num, False, CurrentTime);
>   XFlush(display);
> 
> 
> I spent a long time attempting to send the fake button events *while* I
> am grabbing the pointer.  I have not found a configuration of
> XGrabPointer which allows this to occur.  Is such a scheme even
> possible?  Currently I have to ungrab the pointer, issue the fake button
> press/release, and then re-grab.

if you have an async grab, you are guaranteed to be the only client that
receives the event, no matter where it occurs.
You need to issue a SyncGrab and then call XAllowEvents with ReplayPointer to
replay the event on the next window. Only this way can you get events to other
clients than the currently grabbing one.

Cheers,
  Peter



More information about the xorg mailing list