Mantis - Squeak
Viewing Issue Advanced Details
6600 Morphic minor always 08-09-07 04:52 08-09-07 04:52
wiz  
 
normal  
new  
open  
none    
none  
0006600: HandMorph>initForEvents sets lastMouseEvent to an incorrect mouse move event
In perusing the code I came across this

'tk 8/9/2001 16:55 HandMorph initForEvents {initialization}'

initForEvents
    mouseOverHandler _ nil.
    lastMouseEvent _ MouseEvent new setType: #mouseMove position: 0@0 buttons: 0 hand: self.
    lastEventBuffer _ {1. 0. 0. 0. 0. 0. nil. nil}.
    self resetClickState.
    
please note that this isn't a proper MouseMoveEvent
something receiving this and asking for mousemove specific info will lose bigtime. And the consequences that deep in the gui. Hmmm.

proposed fix:
initForEventsNew
    mouseOverHandler := nil.
    
    "insure we have a modern mouse move"
    lastMouseEvent := (MouseEvent new
                setType: nil
                position: 0 @ 0
                buttons: 0
                hand: self) asMouseMove.
    
    lastEventBuffer := {1. 0. 0. 0. 0. 0. nil. nil}.
    self resetClickState
    
Thoughts on installing

alternatively

gradual
read in the new method
write tests
patch callers of old method one by one.

big bang
read in the new method
write tests

save under old method name.

-----

Does this cause problems?

the method is called whenever a new project is installed.
new gui events will correct things quickly.

I haven't the foggiest idea how the first lastEvent is used or when it is discarded.

Still I consider it cheap insurance to correct the event format.

And my curiosity would like to see a good probe to answer this question.

My image from time to time quits on me spontaneously. (7137) on an old iMac. Problems may be due to nothing more than age and spiders tripping over the address lines. On the other hand it may not.

I recently found out I could hard crash my system by doing funny things in squeak (see 0006591) and one of the things going on there is a move handler the relies on startpoint being present in a mouse move.

Thus my heightened vigilance.
 HandMorph-initForEventsNew.st [^] (440 bytes) 08-09-07 04:52

There are no notes attached to this issue.