Do we need a mouse trap?

Peter Achten peter88@cs.kun.nl
Fri, 05 Mar 1999 11:28:53 +0100


Hello Adrian,

At 11:59 AM 3/4/99 +0000, you wrote:
>I hope you'll excuse me if I disagree with your explanation, because
>the one mysterious thing about my mouse_trap is that is _does_ work for
>MouseMove, but _not_ MouseDrag. (Although, as I stated above, I don't
>think it should be necessary at all).
>
>If nobody else has noticed this problem, and you say that on your Mac the
>mouse trap works, I wonder if it could be some wierd bug to associated with
>my particular machine or MacOS version. I'm pretty sure thats what it is...
>*A BUG* (apologies in advance if I'm wrong!), so its probably worth sorting
>it out.
Oops! In my enthousiasm to check your bug report I missed the detail that you are refering to the Mac platform. My reply concerned the Windows platform. Apology, apology. 
So I have checked it once more, but this time on the Mac, and you're right. In your original posting you wrote:

>What makes me suspicious about the bug hypothesis is that this is
>such a basic utility I find it hard to believe nobody has noticed this
>before, unless I'm the only person using ObjectIO 1.0.1 on a Mac
>(which I doubt). How can anybody get their programs to work if this
>really is a bug in ObjectIO?  

You're actually not the only person using ObjectIO 1.0.1 on a Mac, but you probably receive the honour to be the first person who actually used the setWindowMouseStateFilter function inside the MouseFunction. The reason that MouseMove events do seem to get filtered but MouseDrag events not, is caused by the way they are generated. I have fixed the bug, and an updated Mac version will appear soon on the net.

>> >The problem seems to be that I get multiple MouseMove and
>> >MouseDrag up calls, even if the mouse state hasn't changed.
>> >Is this supposed to happen?
>
>I suppose one of my questions is should ObjectIO issue multiple
>(I.E. ~hundreds per second) calls to the mouse function even if the
>mouse hasn't moved or clicked or changed state in any way? I can't
>see what possible use this is so I would expect ObjectIO not to do it.
>If this assumption is correct then my mouse_trap function should be
>unnecessary. Hence the question: Do we need mouse traps?

The object I/O library should not make (to many) assumptions on application requirements. In most cases I guess you are right. In fact my favourite mouse filter is (\m->getMouseStateButtonState m==ButtonDown). For this reason the MouseStateFilter has been introduced to give programmers an easy means to filter out uninteresting mouse events, as your example elegantly illustrates. 

Greetings, Peter