Constraining mouse cursor globally in xorg

Peter Hutterer peter.hutterer at who-t.net
Mon Jan 4 21:27:11 PST 2010


On Tue, Jan 05, 2010 at 04:00:48PM +1100, Russell Shaw wrote:
> Alex White wrote:
> > Hi,
> > 
> > Not sure if this is the right place for this question, but here goes..
> > 
> > I need to constrain the mouse cursor in xorg, to prevent it reaching an  
> > area of screen that is not visible to the user (don't ask).
> > 
> > I've noticed that there is support for this within the x server using the  
> > ConstrainCursor function. What this function provides is exactly what I  
> > need.
> > 
> > What's not clear to me is how I can access this function from the  
> > application level. (or is it internal only?). None of the pScreen member  
> > functions appear to be exposed in the libraries I've searched.
> > 
> > Do I need to write a simple xorg module to do this?
> > 
> > Any suggestions on how to proceed?
> 
> How about:
>    http://tronche.com/gui/x/xlib/input/XGrabPointer.html
>    http://tronche.com/gui/x/xlib/input/XWarpPointer.html
> 
> To make it global could be done in the window manager maybe.

Grabbing the pointer would stop event delivery to other clients though and
would only work provided it's a single client that the pointer needs to be
constrained within.

Cheers,
  Peter



More information about the xorg mailing list