Path: utzoo!attcan!uunet!tektronix!tekecs!nobody From: nobody@tekecs.TEK.COM (-for inetd server command) Newsgroups: comp.windows.x Subject: Re: too many motion notify events Message-ID: <10759@tekecs.TEK.COM> Date: 19 Dec 88 16:20:33 GMT Reply-To: antoniof@af.UUCP (Antonio Freixas) Organization: Tektronix, Inc., Wilsonville, OR Lines: 48 In article <214@tityus.UUCP> you write: >... > In my own personal case I have taken out usage of MouseMotion >events. If I wish to track what the user is going I go into a (ugghh) >polling loop while the mouse button is down of doing XQueryPointers(). >The numbers are always current and there is no latency problem after >the button is released. > > I didn't originally do this, but scrollbars and popups work a >lot better with this type of logic. And the user has Full control! > >-Jim Becker An alternative approach is the following: case MotionNotify: /* Find the latest motion event on the queue. Discard all the others */ while (XCheckMaskEvent(dpy, PointerMotionMask, &e_temp)) { e = e_temp; } I perform 'e = e_temp' because I am paranoid of what XCheckMaskEvent does to the returned event when the result is "False". This procedure works for me, but it may not be totally correct since it will skip over events on the queue that don't match the pattern. So the pattern motion ... button press ... motion .. last motion event will be processed as last motion event ... button press which is not exactly correct. What I'd like to do would be to have a function which like XCheckMaskEvent which returns False if the queue is empty OR if the next event on the queue fails to match the mask. Are there better ways to do this? -- antoniof@af.GWD.TEK.COM -- antoniof@af x2433