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

commits at source.squeak.org commits at source.squeak.org
Sat Aug 13 11:54:05 UTC 2016


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

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

Name: Morphic-mt.1275
Author: mt
Time: 13 August 2016, 1:53:31.042735 pm
UUID: a619070a-afa4-844f-b11f-27b54d59c771
Ancestors: Morphic-mt.1274

Due to the previous fix, restore the original keyboard focus again when dismissing the pop-up menu.

=============== Diff against Morphic-mt.1274 ===============

Item was changed:
  Morph subclass: #MenuMorph
+ 	instanceVariableNames: 'defaultTarget selectedItem stayUp popUpOwner activeSubMenu originalFocusHolder'
- 	instanceVariableNames: 'defaultTarget selectedItem stayUp popUpOwner activeSubMenu'
  	classVariableNames: 'CloseBoxImage CloseBoxImageFlat CloseBoxImageGradient GradientMenu MenuBorderColor MenuBorderWidth MenuColor MenuLineColor MenuSelectionColor MenuTitleBorderColor MenuTitleBorderWidth MenuTitleColor PushPinImage RoundedMenuCorners'
  	poolDictionaries: ''
  	category: 'Morphic-Menus'!
  
  !MenuMorph commentStamp: '<historical>' prior: 0!
  Instance variables:
  	defaultTarget 	<Object>				The default target for creating menu items
  	selectedItem		<MenuItemMorph> 	The currently selected item in the receiver
  	stayUp 			<Boolean>			True if the receiver should stay up after clicks
  	popUpOwner 	<MenuItemMorph>	The menu item that automatically invoked the receiver, if any.
  	activeSubMenu 	<MenuMorph>		The currently active submenu.!

Item was changed:
  ----- Method: MenuMorph>>deactivate: (in category 'events') -----
  deactivate: evt
  
  	"If a stand-alone menu, just delete it"
  	popUpOwner ifNil: [ 
+ 		self deleteIfPopUp: evt.
- 		self delete.
  		^true ].
  	"If a sub-menu, then deselect, and return focus to outer menu"
  	self selectItem: nil event: evt.
  	evt hand newMouseFocus: popUpOwner owner.
  	evt hand newKeyboardFocus: popUpOwner owner!

Item was changed:
  ----- Method: MenuMorph>>deleteIfPopUp: (in category 'control') -----
  deleteIfPopUp: evt
  	"Remove this menu from the screen if stayUp is not true. If it is a submenu, also remove its owning menu."
  
  	stayUp ifFalse: [self topRendererOrSelf delete].
  	(popUpOwner notNil) ifTrue: [
  		popUpOwner isSelected: false.
  		popUpOwner deleteIfPopUp: evt].
+ 	evt ifNotNil: [
+ 		evt hand releaseMouseFocus: self.
+ 		originalFocusHolder ifNotNil: [
+ 			evt hand newKeyboardFocus: originalFocusHolder.
+ 			originalFocusHolder := nil]].!
- 	evt ifNotNil:[evt hand releaseMouseFocus: self].!

Item was changed:
  ----- Method: MenuMorph>>popUpAt:forHand:in:allowKeyboard: (in category 'control') -----
  popUpAt: aPoint forHand: hand in: aWorld allowKeyboard: aBoolean 
  	"Present this menu at the given point under control of the given 
  	hand."
  	| evt |
  	aWorld submorphs
  		select: [:each | (each isKindOf: MenuMorph)
  				and: [each stayUp not]]
  		thenCollect: [:menu | menu delete].
  	self items isEmpty
  		ifTrue: [^ self].
  	MenuIcons decorateMenu: self.
  	(self submorphs
  		select: [:m | m isKindOf: UpdatingMenuItemMorph])
  		do: [:m | m updateContents].
  	"precompute width"
  	self
  		positionAt: aPoint
  		relativeTo: (selectedItem
  				ifNil: [self items first])
  		inWorld: aWorld.
  	aWorld addMorphFront: self.
  	"Acquire focus for valid pop up behavior"
  	hand newMouseFocus: self.
  	aBoolean
+ 		ifTrue: [
+ 			originalFocusHolder := hand keyboardFocus.
+ 			hand newKeyboardFocus: self.
- 		ifTrue: [hand newKeyboardFocus: self.
  			self showKeyboardHelp].
  	evt := hand lastEvent.
  	(evt isKeyboard
  			or: [evt isMouse
  					and: [evt anyButtonPressed not]])
  		ifTrue: ["Select first item if button not down"
  			self moveSelectionDown: 1 event: evt
  			"Select first item if button not down"].
  	self updateColor.
  	self changed!

Item was changed:
  ----- Method: MenuMorph>>stayUp: (in category 'accessing') -----
  stayUp: aBoolean
  
  	stayUp := aBoolean.
+ 	aBoolean ifTrue: [ self removeStayUpBox ].
+ 	originalFocusHolder := nil. "Not needed anymore."!
- 	aBoolean ifTrue: [ self removeStayUpBox ].!



More information about the Squeak-dev mailing list