[comp.sys.sgi] Constraining cursor to a window

flint@cutmcvax.OZ (Danny Baldoni) (07/18/90)

I'm currently developing a project using multiple windows.  Combined, these
windows cover the entire screen.  What I'd like to know is whether or not
there's any way I can restrict the movement of the cursor so that it can
NEVER (unless I release it) move outside the boundaries of one of those
windows.

Any help would be much appreciated.

	Danny Baldoni
	~~~~~~~~~~~~~

--------------------------------------------+----------------------------------
Phone:  +61-9-351-7450                      | School of Computing Science,
ACSNet: flint@cutmcvax.oz                   | Curtin University of Technology,
UUCP:   ...!uunet!munnari!cutmcvax!flint    | GPO Box U1987,
ARPA:   flint%cutmcvax.oz@uunet.UU.NET      | Perth,
                                            | Western Australia, 6001
--------------------------------------------+----------------------------------
"Any time there's something so ridiculously dangerous that no rational human
 being would even consider trying it, they send for me"
  - Belgarion, "King of the Murgos" by David Eddings
-------------------------------------------------------------------------------

tjh@bucrf11.bu.edu (Tim Hall) (07/18/90)

In article <156@cutmcvax.OZ>, flint@cutmcvax.OZ (Danny Baldoni) writes:
|> 

|>                               What I'd like to know is whether or not
|> there's any way I can restrict the movement of the cursor so that it can
|> NEVER (unless I release it) move outside the boundaries of one of those
|> windows.
|> 

Yes, find the boundaries of your window and then use 'setvaluator' to 
constrain the cursor.  For example if the lower left of your window is
at xmin/ymin and the upper right is at xmax/ymax the following...

	setvaluator( MOUSEX, ( xmax - xmin ) / 2, xmin, xmax );
	setvaluator( MOUSEY, ( ymax - ymin ) / 2, ymin, ymax );

puts the cursor in the center of the window and constrains it within
the window boundaries.  However, if there is another window overlapping 
this window the cursor can enter it.

-Tim Hall
tjh@bu-pub.bu.edu

thant@horus.esd.sgi.com (Thant Tessman) (07/18/90)

In article <156@cutmcvax.OZ>, flint@cutmcvax.OZ (Danny Baldoni) writes:
> 
> I'm currently developing a project using multiple windows.  Combined, these
> windows cover the entire screen.  What I'd like to know is whether or not
> there's any way I can restrict the movement of the cursor so that it can
> NEVER (unless I release it) move outside the boundaries of one of those
> windows.
> 


Yes, you can do a 'setvaluator' on MOUSEX and MOUSEY to restrict it
to your window.

thant