Grab key scrolling

Marco Pesenti Gritti mpg at redhat.com
Thu Apr 19 05:47:22 EDT 2007


On Thu, 2007-04-19 at 01:41 -0400, Zephaniah E. Hull wrote:
> 2: This is where you have choices and tradeoffs.
>     You can simply grab the core pointer events and let the pointer move
>     around, this has the problem of not being able to scroll in one
>     direction once the pointer has reached the edge of the screen.

Yeah, this won't work.

>     You can do a full pointer grab, as many games do, usually making the
>     pointer invisible at the same time.  This allows you to scroll
>     around however you want, but without some tricks to save/restore
>     pointer position, this leaves the pointer in the middle of the
>     screen when you let go.
> 

What do you mean with full pointer grab exactly? This is what SDL does:

XGrabPointer(SDL_Display, SDL_Window, True, 0,
	     GrabModeAsync, GrabModeAsync,
             SDL_Window, None, CurrentTime);

I tried it out with neverball and once you reach the edge you can't move in that
direction anymore.

>     Both of those methods only work on things that move the core pointer
>     around as a relative device.  This doesn't allow the PT to be
>     used.
> 
> 3: With the newer input code in X, you have another option.
>     Go through the list of input devices, set the ones you want to grab
>     to not send core events, open them, depending on usage you may want
>     to switch the PT to rel mode, as above treat the incoming X/Y data
>     as scrolling control.
> 
>     I'd probably select devices on the simple basis that anything that's
>     sending core events and is a pointer is fair game.
> 
>     Just remember on release that you close, and restore the settings
>     you changed (send core events, rel vs abs).
> 
>     You can't currently do this in X because you can't do that to the
>     device that's the core pointer, it _is_ possible to hack around that
>     to do this in the current X server by adding a null driver acting as
>     a mouse, but that adds to the work involved by some amount, if
>     that's worth it for gen1 is someone else's call.

How much work would it be to add the null driver?
If that's the only possibility to get an acceptable behavior for the
drag key IHMO we should do it.

Thanks!

Marco




More information about the Devel mailing list