[Pkg] The Trunk: Morphic-mt.1401.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Mar 27 14:50:55 UTC 2018


Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1401.mcz

==================== Summary ====================

Name: Morphic-mt.1401
Author: mt
Time: 27 March 2018, 4:50:25.366732 pm
UUID: 7db07362-382c-c94c-b78b-0c4181f5e2e6
Ancestors: Morphic-eem.1400

Fixes two regressions regarding Morphic halo invocation and event handling: 1) do not make halo-invoked morphs come to front, 2) support regular event dispatch while a halo is visible.

Note that I realized that we needed another kind of event dispatch for focused morphs. I called it "all-over dispatch" in addition to "full dispatch". If the full event dispatch around the focused morph was not successful, try regular dispatch to give, for example, sibling morphs a chance. The focused morph, however, will be locked during that attempt to not (unsuccessfully) handle the event again. Now, the global halo morph is an example for the use of this all-over dispatch. Maybe you can think of a better name for it. Let me know.

=============== Diff against Morphic-eem.1400 ===============

Item was added:
+ ----- Method: MorphicEventDispatcher>>dispatchFocusEventAllOver:with: (in category 'focus events') -----
+ dispatchFocusEventAllOver: evt with: focusMorph
+ 	"Like a full event dispatch BUT adds regular dispatch if the focus morph did nothing with the event. This is useful for letting the focusMorph's siblings handle the events instead. Take halo invocation as an example. See senders of me."
+ 	
+ 	| result hand mouseFocus |
+ 	result := self dispatchFocusEventFully: evt with: focusMorph.
+ 	
+ 	result == #rejected ifTrue: [^ result].
+ 	result wasIgnored ifTrue: [^ result].
+ 	result wasHandled ifTrue: [^ result].
+ 
+ 	hand := evt hand.
+ 	mouseFocus := hand mouseFocus.
+ 
+ 	[
+ 		"Avoid re-dispatching the event to the focus morph. See Morph >> #rejectsEvent:."
+ 		focusMorph lock.
+ 		
+ 		"Handle side effect for mouse-enter and mouse-leave events."
+ 		self flag: #hacky. "mt: Maybe we find a better way to synthesize enter/leave events in the future."
+ 		hand newMouseFocus: nil.
+ 		hand mouseOverHandler processMouseOver: hand lastEvent.
+ 		
+ 		"Give the morph's world a chance to normally dispatch the event."
+ 		^ focusMorph world processEvent: evt using: self
+ 	] ensure: [
+ 		focusMorph unlock.
+ 		evt hand newMouseFocus: mouseFocus].!

Item was changed:
  ----- Method: PasteUpMorph>>tryInvokeHalo: (in category 'events-processing') -----
  tryInvokeHalo: anEvent
  
  	| innerMost target |
  	anEvent hand halo ifNotNil: [^ self "No invocation needed. Halo will handle transfer itself."].
  	Preferences noviceMode ifTrue: [^ self "No halo in novice mode."].
  	Preferences cmdGesturesEnabled ifFalse: [^ self].
  	
  	innerMost := (self morphsAt: anEvent position unlocked: true) first.
  	
  	"1) Try to use innermost morph but skip all the ones that do not want to show a halo along the owner chain."
  	target := innerMost.
  	[target isNil or: [target wantsHaloFromClick]]
  		whileFalse: [target := target owner].
  	target ifNil: [^ self].
  	
  	"2) Without a modifier, which is normal, find the outermost container for that inner morph."
  	(innerMost == self or: [anEvent shiftPressed]) ifFalse: [
  		| previousTargets |
  		previousTargets := OrderedCollection new.
  		[target notNil and: [target owner ~~ self]] whileTrue: [
  			previousTargets add: target.
  			target := target owner].
  		target ifNil: [^ self].
  		[previousTargets isEmpty or: [target wantsHaloFromClick]] whileFalse: [
  			target := previousTargets removeLast].
  		target wantsHaloFromClick ifFalse: [^ self]].
+ 		
+ 	"3) Now that we have the target, show the halo. Abort event dispatching, too, to avoid confusion."
- 	
- 	"3) Show the container of that nested structure, which is usually my direct submorph."
- 	target withAllOwnersDo: [:ea | ea owner == self ifTrue: [ea comeToFront]].
- 	
- 	"4) Now that we have the target, show the halo. Abort event dispatching, too, to avoid confusion."
  	anEvent hand newMouseFocus: target event: anEvent.
  	target invokeHaloOrMove: anEvent.
  	anEvent ignore.!

Item was changed:
  ----- Method: SimpleHaloMorph>>processFocusEvent:using: (in category 'events') -----
  processFocusEvent: evt using: dispatcher
  
+ 	^ dispatcher dispatchFocusEventAllOver: evt with: self!
- 	^ dispatcher dispatchFocusEventFully: evt with: self!



More information about the Packages mailing list