Re: Does exist a method to....

J. P. Mellor (jpmellor@ai.mit.edu)
Fri, 29 Nov 1996 18:28:52 -0500

To subscribers of the xforms list from "J. P. Mellor" <jpmellor@ai.mit.edu> :

> Does exist a method (a function of xform or xlib call) that enables the
> mouse pointer to move only on a grid, namely a two-dimensional integer
> coordinate space ?

I've done something similar to what I think you're after. I wanted to
constrain the cursor to a line in an image. You can do everything
with xlib. Basically you,

1) turn off the hardware cursor, alternately you can change the cursor
to something different.
2) initialize the cursor's position
3) save the area that will be under the cursor
4) draw the cursor
5) process x events and calculate new cursor location
6) restore the area under the cursor
7) save the area under the new cursor position
8) until done, go to 5)
9) restore the area under the cursor
10) turn the hardware cursor back on

jp

To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html