Grab key scrolling

Marco Pesenti Gritti mpg at redhat.com
Tue Apr 17 05:27:55 EDT 2007


On Tue, 2007-04-17 at 11:09 +0200, Bert Freudenberg wrote:
> On Apr 17, 2007, at 0:07 , Jim Gettys wrote:
> 
> > On Mon, 2007-04-16 at 16:42 +0200, Marco Pesenti Gritti wrote:
> >> Hello,
> >>
> >> we have the grab key on the keyboard which, when pressed, should
> >> activate the scrolling mode. It should work like this:
> >>
> >> 1 The user press the grab key on the keyboard.
> >> 2 The scrollbars of the current view are highlighted.
> >> 3 Movements on the trackpad (both resistive and not resistive)  
> >> scrolls
> >> the view. The mouse pointer is "locked" and does not change position.
> >>
> >> We are having problems with the X side of this but I think Jim  
> >> said to
> >> Eben it was possible. Can someone with more with more X knowledge  
> >> than
> >> me suggest a good way of implementing it?
> >
> > I don't believe I ever claimed this is possible.
> >
> > I think we're going to have to extend X to get these semantics.
> >
> > The closest one can come is to confine the cursor to a window; but  
> > that
> > is different than nailing it to one place and causing the window
> > coordinate system to move.
> >                                         - Jim
> >
> >> What I tried is to detach the pointer device from the core pointer.
> >> (XChangePointerDevice). But then how do I get notified about trackpad
> >> movements?
> 
> 
> How about using scroll events?
> 
> In X, scrolling mice just generate button presses that are mapped to  
> the Y or X axis in the config file. Many apps can deal with that  
> directly. So when pressing the grab key, we'd switch the touchpad  
> driver into "scroll mode" where movement generates those button  
> clicks. And because no actual movement events will be delivered, the  
> pointer would stay in place. As an added benefit, on a regular  
> machine this behavior can easily emulated with the scroll wheel,  
> without introducing a secondary code path.

I thought about that too. The limitations I see with this approach are:

1 Scroll events can only be horizontal or vertical, you can't move
diagonally for example.
2 The precision is limited since you can only move of a certain step.

The fact that they are already supported by applications it's clearly a
big plus though. Maybe for Gen1 we could implement something using
scrolling events and for later releases aim to add better semantics to
X. Eben what do you think?

Marco




More information about the Devel mailing list