Updated 2012-09-02 17:38:51 by LarrySmith

The standard reference for "pointer warping" for Tk has been the "usage FAQ" [1] (2004-12-19: link dead) [oooo; we do need to fix that link ...]. It briefly mentions that pointer warping is a bad idea (don't do that), supplies source for an extension which implements warping, and also points to [fill in the details here ...], with its implementation of the same as ... The FAQ doesn't seem to be current ...

As "Changes in Tcl/Tk 8.3" hints, release 8.3's event command builds in pointer warping.

Here is a simple example of pointer warping:
 event generate . <Motion> -warp 1 -x 50 -y 50.

(Move the cursor to the '.' window, inset 50 pixels from top left corner)

Among the legitimate uses of pointer warping are test automations, including Android, and for pedagogic purposes (Android can also help build demonstrations).

Another legitimate use of pointer warping was the GUI design of Interleaf Version <= 5. The GUI was mainly context-menu driven and remembered the last menu choice in the cascading tree of sub-menus. With a delay of about 300ms, the next cascade opened with mouse pointer on appropriate entry. It was not the worst GUI I've worked with. (wdb)

Larry Smith Open Look also would warp the mouse if it improved the GUI. As I recall, choosing the "resize" entry from the window control menu would not only put you in resize mode, it would warp the point to the handle at the lower right.

kroc - Here's a trick to move the mouse cursor with keyboard arrows. It could be useful when mouse is broken. Someone should add mouse click with spacebar or enter.
 bind . <Up> { event generate . <Motion> -warp 1 -x [expr %x+0] -y [expr %y-10] }
 bind . <Down> { event generate . <Motion> -warp 1 -x [expr %x+0] -y [expr %y+10] }
 bind . <Left> { event generate . <Motion> -warp 1 -x [expr %x-10] -y [expr %y+0] }
 bind . <Right> { event generate . <Motion> -warp 1 -x [expr %x+10] -y [expr %y+0] }

Larry Smith This is just a handy trick, this is something every program should have if it relied on positioning with the mouse. Change the 10 to a 1 to get the kind of "nudge" functionality every graphical editor really should have.

Also see "Moving the mouse".