Screen damage logic
dway at mat.net
Fri Mar 24 01:29:18 UTC 2000
On Thu, 23 Mar 2000, Jim Benson wrote:
> I'm fortunate, Bob Arning already guided me as I stalked through the
> tall brush hunting Morphs. The close box is a SimpleButtonMorph. When
> you click it and hold the mouse down, you receive #mouseMove:
> repeatedly. Even when the mouse is not moving, it generates mouseMove
> events. Morphic seems to generate these as some sort of idle event.
This sure seems like it should be a bug, but I don't know enough to say
for sure. Maybe "side effect" would be a better term.
I looked into it a bit, and it looks like mouseMove events are generated
all the time, as you say. I'm not sure why this is really necessary.
Anyway, with a little evil hackery, I modified HandMorph>>handleEvent: in
my image so that the mouseMove events are no longer generated while the
mouse remains still. Oddly enough, Morphic still seems to work just fine,
although I haven't tested everything.
To try this, insert this code at the beginning of HandMorph>>handleEvent:
(evt isMouse and: [evt isMouseMove]) ifTrue:
["If the previous event was a mouseMove at the same location, do
(lastEvent isMouseMove and: [evt cursorPoint = lastEvent
ifTrue: [^ self]].
"Transcript show: 'last event = ', lastEvent printString, ' current
event = ', evt printString; cr."
(rest of handleEvent code...)
Try uncommenting the Transcript statement to see the events in action.
Of course, this probably isn't the ideal way to fix this, but it does seem
unneccesary to generate mouseMove events all the time while the mouse is
not moving, and well goshdarnit it just ain't right. :) This fix should
fix the close box problem you mention. There are probably other subtle
problems or slownesses caused by these extra mouseMove events.
Also, I think the moral of this thread so far is that there are still
*lots* of opportunities to speed up Morphic, just by fixing things in the
image. (Of course, at this stage we don't want to add significant
complexity when doing such optimizing, since Morphic isn't fully mature.)
- Doug Way
EAI/Transom Technologies, Ann Arbor, MI
dway at mat.net, @eai.com
More information about the Squeak-dev