Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!att!cbnewsh!warren From: warren@cbnewsh.att.com (warren.a.montgomery) Newsgroups: comp.windows.x Subject: How to constrain pointer movement Keywords: movement, Xlib Message-ID: <1991Jan21.151609.934@cbnewsh.att.com> Date: 21 Jan 91 15:16:09 GMT Distribution: na Organization: AT&T Bell Laboratories Lines: 26 Is there a way using Xlib of constraining the mouse motion so that it will be entirely horizontal or vertial? In other words, if the mouse is moved 5 pixels up and 15 pixels to the right, the pointer image and reported position should be 0 pixels up and 15 pixels right. Whichever direction, horizontal or vertical, had the lesser movement since last observation is locked at 0. I have ported an application that did this on an AT&T 5620 graphics terminal to run under X, and the naive port of the pointer handling code that was used to achieve the above effect simply did a lot of calls to XWarpPointer to keep it from moving off course. Aside from being rather inefficient, this causes trouble if there is any signifcant delay in the reporting and processing of events, as the user's pointer motions keep getting wiped out by moving the pointer back to an obsolete position. Getting this behavior to work would really seem to require constraining the motion at the server. I can't off hand see how to do this, though the motion constraint is useful for many applications that require the user to make precise horizontal or vertical movements and I suspect that there may be some subtle way of achieving this result. Any suggestions? -- Warren Montgomery att!ihlpf!warren