Grab key scrolling

Marco Pesenti Gritti mpg at redhat.com
Thu Apr 19 06:11:14 EDT 2007


On Thu, 2007-04-19 at 05:51 -0400, Zephaniah E. Hull wrote:
> On Thu, Apr 19, 2007 at 11:47:22AM +0200, Marco Pesenti Gritti wrote:
> > 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.
> 
> Extra work is needed, specificly you have to move the pointer to the
> center of the screen, and on each movement move the pointer back to the
> center of the screen.
> 
> It's ugly, but it's also how X applications have stolen the pointer for
> ages.
> > 

OK, sounds like a reasonable approach for Gen1 to me. The only downside
I can think of is that we have to hide the pointer.

Marco




More information about the Devel mailing list