Matthew Fulmer uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mtf.499.mcz==================== Summary ====================
Name: Morphic-mtf.499
Author: mtf
Time: 28 December 2010, 7:44:35.089 pm
UUID: 5654782d-30d7-0f40-8c4e-36c106e68ca1
Ancestors: Morphic-ar.498
Import from Cobalt:
Name: Morphic-mka.24
Author: mka
Time: 21 February 2009, 8:39:30 pm
UUID: 087e4594-961d-fc4b-a216-e43a0286f63c
Ancestors: Morphic-jrd.23
HandMorph supports now mouse states where two mouse buttons are pressed simultaneously
=============== Diff against Morphic-ar.498 ===============
Item was changed:
----- Method: HandMorph>>generateMouseEvent: (in category 'private events') -----
generateMouseEvent: evtBuf
"Generate the appropriate mouse event for the given raw event buffer"
| position buttons modifiers type trail stamp oldButtons evtChanged |
evtBuf first = lastEventBuffer first
ifTrue:
["Workaround for Mac VM bug, *always* generating 3 events on clicks"
evtChanged := false.
3 to: evtBuf size
do: [:i | (lastEventBuffer at: i) = (evtBuf at: i) ifFalse: [evtChanged := true]].
evtChanged ifFalse: [^nil]].
stamp := evtBuf second.
stamp = 0 ifTrue: [stamp := Time millisecondClockValue].
position := evtBuf third @ evtBuf fourth.
buttons := evtBuf fifth.
modifiers := evtBuf sixth.
+
type := buttons = 0
+ ifTrue:[
+ lastEventBuffer fifth = 0
+ ifTrue: [#mouseMove] "this time no button and previously no button .. just mouse move"
+ ifFalse: [#mouseUp] "this time no button but previously some button ... therefore button was released"
+ ]
+ ifFalse:[
+ buttons = lastEventBuffer fifth
+ ifTrue: [#mouseMove] "button states are the same .. now and past .. therfore a mouse movement"
+ ifFalse: [ "button states are different .. button was pressed or released"
+ buttons > lastEventBuffer fifth
+ ifTrue: [#mouseDown]
+ ifFalse:[#mouseUp].
+ ].
+ ].
- ifTrue:
- [lastEventBuffer fifth = 0 ifTrue: [#mouseMove] ifFalse: [#mouseUp]]
- ifFalse:
- [lastEventBuffer fifth = 0
- ifTrue: [#mouseDown]
- ifFalse: [#mouseMove]].
buttons := buttons bitOr: (modifiers bitShift: 3).
oldButtons := lastEventBuffer fifth
bitOr: (lastEventBuffer sixth bitShift: 3).
lastEventBuffer := evtBuf.
type == #mouseMove
ifTrue:
[trail := self mouseTrailFrom: evtBuf.
^MouseMoveEvent new
setType: type
startPoint: (self position)
endPoint: trail last
trail: trail
buttons: buttons
hand: self
stamp: stamp].
^MouseButtonEvent new
setType: type
position: position
which: (oldButtons bitXor: buttons)
buttons: buttons
hand: self
stamp: stamp!