the OLPC XO grab button (triggering mouse scrolling using a keypress)
erik at laptop.org
Wed Jul 9 14:12:51 PDT 2008
On Tue, Jul 01, 2008 at 03:52:09PM +0930, Peter Hutterer wrote:
> On Mon, Jun 30, 2008 at 07:35:16PM -0400, Erik Garrison wrote:
> > The keyboard has two buttons which are marked with a hand. The
> > interested may see a schematic at
> > http://wiki.laptop.org/go/OLPC_Keyboard_layouts. It was intended at
> > design time that pressing either of these buttons (Super_L and Super_R)
> > and simultaneously moving the mouse would trigger x and y scrolling in
> > X11 applications.
> > I'm curious if anyone knows of ways in which similar functionality has
> > been implemented elsewhere. In general I'd like some advice about the
> > best place to implement this feature.
> Just put a passive grab on the keys to receive the key press event and then,
> depending on what you mean by scrolling:
> - mouse wheel emulation
> put a (sync) grab on the mouse and use XTestFakeButtonEvent on buttons
> 4/5/6/7 for to scroll. you'll need to mess around a bit with XAllowEvents,
> but it should work.
This is the path which I have followed.
I am using the following calls to grab and ungrab the pointer:
These calls issue a fake button 4 event:
XTestFakeButtonEvent(display, button_num, True, CurrentTime);
XTestFakeButtonEvent(display, button_num, False, CurrentTime);
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.
Any advice would be quite helpful.
More information about the xorg