Path: utzoo!mnetor!uunet!husc6!bbn!uwmcsd1!ig!jade!ucbvax!hoser.berkeley.edu!bryce From: bryce@hoser.berkeley.edu (Bryce Nesbitt) Newsgroups: comp.sys.amiga Subject: Re: Dealing with lots of messages Message-ID: <22427@ucbvax.BERKELEY.EDU> Date: 7 Jan 88 13:39:49 GMT References: <4346@garfield.UUCP> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: bryce@hoser.berkeley.edu (Bryce Nesbitt) Distribution: na Organization: The Logic Foundation Lines: 52 Keywords: messages IDCMP MOUSEMOVE In article <4346@garfield.UUCP> john13@garfield.UUCP (John Russell) writes: >None of the messages on dealing with many messages (esp. mousemove) from one >or more ports has mentioned a very simple technique that can speed up >response time greatly. > >It goes something like this... > > msg = GetMsg(window->UserPort); > .... > case MOUSEMOVE: > if (window->MouseX != x || window->MouseY != y) > /* user has moved the mouse since this message > so I will ignore it */ > break; > else > *YUCK!* This technique combines a timestamped mouse message and compares it syncronously as a crude aproximation of the current mouse position! This also has the potential of getting out of sync. Either method alone is ok. Combining them is asking for problems. The much better way is just to eat all of the mouse messages you don't want. I'll drag an example out of my bag of disks and post it as AmigaLine #5. (Note: anyone is welcome to write an AmigaLine... just send it to me first so the numbers stay straight). The Intuition manual has an example like this, but I consider it defective. It processes "normal" messages before the mouse moves. This means that the user might use the mouse, then pull down a menu. Both messages will be queued to the port. The Intuition manual code would handle the menu THEN handle the mouse move. Potential problems abound.