[squeak-dev] The Trunk: Morphic-mt.2053.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Nov 21 10:27:06 UTC 2022


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

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

Name: Morphic-mt.2053
Author: mt
Time: 21 November 2022, 11:26:08.284072 am
UUID: e5103676-4f14-f245-8dee-e81e3f692664
Ancestors: Morphic-ct.2052

More commentary for mouse and keyboard events.

=============== Diff against Morphic-ct.2052 ===============

Item was changed:
  ----- Method: Morph>>handleKeyDown: (in category 'events-processing') -----
  handleKeyDown: anEvent
+ 	"System level event handling. AVOID OVERRIDE if possible. Instead, please use #handlesKeyboard: and #keyDown: in your custom morphs."
+ 	
- 	"System level event handling."
  	anEvent wasHandled ifTrue: [^ self].
  	(self handlesKeyboard: anEvent) ifFalse: [^ self].
  	(anEvent hand keyboardFocus ~~ self
  		and: [self handlesKeyboardOnlyOnFocus])
  			ifTrue: [^ self].
  	
  	anEvent wasHandled: true.
  	^ self keyDown: anEvent!

Item was changed:
  ----- Method: Morph>>handleKeyUp: (in category 'events-processing') -----
  handleKeyUp: anEvent
+ 	"System level event handling. AVOID OVERRIDE if possible. Instead, please use #handlesKeyboard: and #keyUp: in your custom morphs."
+ 	
- 	"System level event handling."
  	anEvent wasHandled ifTrue: [^ self].
  	(self handlesKeyboard: anEvent) ifFalse: [^ self].
  	(anEvent hand keyboardFocus ~~ self
  		and: [self handlesKeyboardOnlyOnFocus])
  			ifTrue: [^ self].
  	
  	anEvent wasHandled: true.
  	^ self keyUp: anEvent!

Item was changed:
  ----- Method: Morph>>handleKeystroke: (in category 'events-processing') -----
  handleKeystroke: anEvent 
+ 	"System level event handling. Supports automatically grabbing the keyboard focus via keyboard focus delegate; see #newKeyboardFocus:.
- 	"System level event handling. Has support for automatically grabbing the keyboard focus considering the keyboard focus delegate. See #newKeyboardFocus:"
  	
+ 	AVOID OVERRIDE if possible. Instead, please use #handlesKeyboard: and #keyStroke: in your custom morphs."
+ 	
  	| handler |
  	anEvent wasHandled ifTrue: [^ self].
  	(self handlesKeyboard: anEvent) ifFalse: [^ self].
  	(anEvent hand keyboardFocus ~~ self
  		and: [self handlesKeyboardOnlyOnFocus])
  			ifTrue: [^ self].
  	
  	handler := self wantsKeyboardFocus
  		ifFalse: [self]
  		ifTrue: [(anEvent hand newKeyboardFocus: self) ifNil: [self]].
  	anEvent handler: handler.
  	
  	anEvent wasHandled: true.
  	^ handler keyStroke: anEvent!

Item was changed:
  ----- Method: Morph>>handleMouseDown: (in category 'events-processing') -----
  handleMouseDown: anEvent
+ 	"System level event handling. AVOID OVERRIDE if possible. Instead, please use #handlesMouseDown: and #mouseDown: in your custom morphs. See #handlerForMouseDown: and #mouseDownPriority."
+ 	
- 	"System level event handling."
  	anEvent wasHandled ifTrue:[^self]. "not interested"
  	anEvent hand removePendingBalloonFor: self.
  	anEvent hand removePendingHaloFor: self.
  	anEvent wasHandled: true.
  
  	"Make me modal during mouse transitions"
  	anEvent hand newMouseFocus: self event: anEvent.
  	
  	"this mouse down could be the start of a gesture, or the end of a gesture focus"
  	(self isGestureStart: anEvent)
  		ifTrue: [^ self gestureStart: anEvent].
  
  	self mouseDown: anEvent.
  
  	(self handlesMouseStillDown: anEvent) ifTrue:[
  		self startStepping: #handleMouseStillDown: 
  			at: Time millisecondClockValue + self mouseStillDownThreshold
  			arguments: {anEvent copy resetHandlerFields}
  			stepTime: self mouseStillDownStepRate ].
  !

Item was changed:
  ----- Method: Morph>>handleMouseEnter: (in category 'events-processing') -----
  handleMouseEnter: anEvent
+ 	"System level event handling. AVOID OVERRIDE if possible. Instead, please use #handlesMouseOver: and #mouseEnter: in your custom morphs. Also see/use #handlesMouseOverDragging: and #mouseEnterDragging:."
+ 	
- 	"System level event handling."
  	(anEvent isDraggingEvent) ifTrue:[
  		(self handlesMouseOverDragging: anEvent) ifTrue:[
  			anEvent wasHandled: true.
  			self mouseEnterDragging: anEvent].
  		^self].
  	self wantsHalo "If receiver wants halo and balloon, trigger balloon after halo"
  		ifTrue:[anEvent hand triggerHaloFor: self after: self haloDelayTime]
  		ifFalse:[self wantsBalloon
  			ifTrue:[anEvent hand triggerBalloonFor: self after: self balloonHelpDelayTime]].
  	(self handlesMouseOver: anEvent) ifTrue:[
  		anEvent wasHandled: true.
  		self mouseEnter: anEvent.
  	].!

Item was changed:
  ----- Method: Morph>>handleMouseLeave: (in category 'events-processing') -----
  handleMouseLeave: anEvent
+ 	"System level event handling. AVOID OVERRIDE if possible. Instead, please use #handlesMouseOver: and #mouseLeave: in your custom morphs. Also see/use #handlesMouseOverDragging: and #mouseLeaveDragging:."
+ 	
- 	"System level event handling."
  	anEvent hand removePendingBalloonFor: self.
  	anEvent hand removePendingHaloFor: self.
  	anEvent isDraggingEvent ifTrue:[
  		(self handlesMouseOverDragging: anEvent) ifTrue:[
  			anEvent wasHandled: true.
  			self mouseLeaveDragging: anEvent].
  		^self].
  	(self handlesMouseOver: anEvent) ifTrue:[
  		anEvent wasHandled: true.
  		self mouseLeave: anEvent.
  	].
  !

Item was changed:
  ----- Method: Morph>>handleMouseMove: (in category 'events-processing') -----
  handleMouseMove: anEvent 
+ 	"System level event handling. AVOID OVERRIDE if possible. Instead, please use #handlesMouseMove: and #mouseMove: in your custom morphs. Also see/use #wantsEveryMouseMove."
+ 	
- 	"System level event handling."
  	anEvent wasHandled ifTrue: [ ^ self ].
  	"not interested"
  	(self handlesMouseMove: anEvent) ifFalse: [ ^ self ].
  	anEvent wasHandled: true.
  	self mouseMove: anEvent.
  	(self handlesMouseStillDown: anEvent) ifTrue:
  		[ "Step at the new location"
  		self
  			startStepping: #handleMouseStillDown:
  			at: Time millisecondClockValue
  			arguments: {anEvent copy resetHandlerFields}
  			stepTime: self mouseStillDownStepRate ]!

Item was changed:
  ----- Method: Morph>>handleMouseOver: (in category 'events-processing') -----
  handleMouseOver: anEvent
+ 	"System level event handling. DO NOT OVERRIDE. See #handleMouseMove:, #handleMouseEnter:, #handleMouseLeave:."
+ 	
- 	"System level event handling."
  	anEvent hand mouseFocus == self ifTrue:[
  		"Got this directly through #handleFocusEvent: so check explicitly"
  		(self containsPoint: anEvent position event: anEvent) ifFalse:[^self]].
  	anEvent hand noticeMouseOver: self event: anEvent!

Item was changed:
  ----- Method: Morph>>handleMouseUp: (in category 'events-processing') -----
  handleMouseUp: anEvent
+ 	"System level event handling. Complements #handleMouseDown: (and #mouseDown:). AVOID OVERRIDE if possible. Instead, please use #handlesMouseDown: and #mouseUp: in your custom morphs. See #handlerForMouseDown: and #mouseDownPriority."
+ 	
- 	"System level event handling."
  	anEvent wasHandled ifTrue:[^self]. "not interested"
  	anEvent hand mouseFocus == self ifFalse:[^self]. "Not interested in other parties"
  	anEvent hand releaseMouseFocus: self.
  	anEvent wasHandled: true.
  	self mouseUp: anEvent.
  	self stopSteppingSelector: #handleMouseStillDown:.!

Item was changed:
  ----- Method: Morph>>handleMouseWheel: (in category 'events-processing') -----
  handleMouseWheel: anEvent
+ 	"System level event handling. AVOID OVERRIDE if possible. Instead, please use #handlesMouseWheel: and #mouseWheel: in your custom morphs."
- 	"System level event handling."
  
  	anEvent wasHandled ifTrue: [^self].
  	(self handlesMouseWheel: anEvent) ifFalse: [^ self].
  	anEvent wasHandled: true.
  	^ self mouseWheel: anEvent!

Item was changed:
  ----- Method: Morph>>keyDown: (in category 'event handling') -----
  keyDown: anEvent
+ 	"Handle a key down event. The default response is to let my eventHandler, if any, handle it. Ask anEvent for #key to work with a cross-platform representation of virtual-key presses. DO NOT access #keyValue or #keyCharacter as those are for #keyStroke: only.
+ 	
+ 	For #virtualModifiers, ask for #shiftPressed, #controlKeyPressed, #optionKeyPressed, or #commandKeyPressed. Note that if you want to SHOW platform-specific information about modifiers (e.g., ALT on Windows), see #physicalModifiers. For control-flow expressions (e.g., #ifTrue:), only use #virtualModifiers to remain cross-platform compatible."
- 	"Handle a key down event. The default response is to let my eventHandler, if any, handle it."
  
  	self eventHandler ifNotNil:
  		[self eventHandler keyDown: anEvent fromMorph: self].
  !

Item was changed:
  ----- Method: Morph>>keyStroke: (in category 'event handling') -----
  keyStroke: anEvent
+ 	"Handle a keystroke event.  The default response is to let my eventHandler, if any, handle it. Ask anEvent for #keyCharacter to work with the (Unicode) character the user entered. See class comment in Character.
+ 	
+ 	Please implement keyboard shortcuts via #keyDown: instead. Here, as in #keyDown: and #keyUp, you may ask anEvent for #key but should do that in #keyDown: or #keyUp: if possible.
+ 	
+ 	Please AVOID checking #modifiers (or #virtualModifiers) in combination with #keyCharacter as, for example, #shiftPressed has an effect on #keyCharacter as well. This is not the case for #key (or #virtualKey)."
- 	"Handle a keystroke event.  The default response is to let my eventHandler, if any, handle it."
  
  	self eventHandler ifNotNil:
  		[self eventHandler keyStroke: anEvent fromMorph: self].
  !

Item was changed:
  ----- Method: Morph>>keyUp: (in category 'event handling') -----
  keyUp: anEvent
+ 	"Handle a key up event. The default response is to let my eventHandler, if any, handle it. Ask anEvent for #key to work with a cross-platform representation of virtual-key releases. DO NOT access #keyValue or #keyCharacter as those are for #keyStroke: only.
+ 	
+ 	For #virtualModifiers, ask for #shiftPressed, #controlKeyPressed, #optionKeyPressed, or #commandKeyPressed. Note that if you want to SHOW platform-specific information about modifiers (e.g., ALT on Windows), see #physicalModifiers. For control-flow expressions (e.g., #ifTrue:), only use #virtualModifiers to remain cross-platform compatible."
- 	"Handle a key up event. The default response is to let my eventHandler, if any, handle it."
  
  	self eventHandler ifNotNil:
  		[self eventHandler keyUp: anEvent fromMorph: self].
  !



More information about the Squeak-dev mailing list