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

commits at source.squeak.org commits at source.squeak.org
Wed Jun 1 14:10:07 UTC 2016


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

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

Name: Morphic-mt.1156
Author: mt
Time: 1 June 2016, 4:09:34.015287 pm
UUID: 522ade56-9b2e-f749-bb5c-cb117aa97c56
Ancestors: Morphic-topa.1155

If #mouseOverForKeyboardFocus is disabled, do not highlight (a.k.a. "look focused") background windows on mouse-enter, even if they are active due to the preference "Windows' Contents Are Always Active".

Note that there is still a bug, which I intend to fix if the event filters make it into the trunk. Namely, if you "debug it" and expression via the context menu, the appearing debugger will not be the top window. An additional click is required. Sorry for this inconvenience.

=============== Diff against Morphic-topa.1155 ===============

Item was changed:
  MorphicModel subclass: #SystemWindow
+ 	instanceVariableNames: 'labelString stripes label closeBox collapseBox paneMorphs paneRects collapsedFrame fullFrame isCollapsed isActive isLookingFocused menuBox mustNotClose labelWidgetAllowance updatablePanes allowReframeHandles labelArea expandBox'
- 	instanceVariableNames: 'labelString stripes label closeBox collapseBox paneMorphs paneRects collapsedFrame fullFrame isCollapsed isActive menuBox mustNotClose labelWidgetAllowance updatablePanes allowReframeHandles labelArea expandBox'
  	classVariableNames: 'ClickOnLabelToEdit CloseBoxFrame CloseBoxImageFlat CloseBoxImageGradient CollapseBoxImageFlat CollapseBoxImageGradient DoubleClickOnLabelToExpand ExpandBoxFrame ExpandBoxImageFlat ExpandBoxImageGradient FocusFollowsMouse GradientWindow HideExpandButton MenuBoxFrame MenuBoxImageFlat MenuBoxImageGradient ResizeAlongEdges ReuseWindows TopWindow WindowTitleActiveOnFirstClick WindowsRaiseOnClick'
  	poolDictionaries: ''
  	category: 'Morphic-Windows'!
  
  !SystemWindow commentStamp: '<historical>' prior: 0!
  SystemWindow is the Morphic equivalent of StandardSystemView -- a labelled container for rectangular views, with iconic facilities for close, collapse/expand, and resizing.
  
  The attribute onlyActiveOnTop, if set to true (and any call to activate will set this), determines that only the top member of a collection of such windows on the screen shall be active.  To be not active means that a mouse click in any region will only result in bringing the window to the top and then making it active.!

Item was added:
+ ----- Method: SystemWindow>>activateIfNeeded: (in category 'focus') -----
+ activateIfNeeded: evt
+ 	"Make me the new key window if needed. Ensure that the focus look matches the keyboard focus."
+ 
+ 	(self isKeyWindow not
+ 		and: [self class windowsRaiseOnClick
+ 			or: [self windowDecorations anySatisfy: [:morph | morph bounds containsPoint: evt position]] ])
+ 				ifTrue: [self beKeyWindow]
+ 				ifFalse: [self updateFocusLookForKeyboardFocus].!

Item was changed:
  ----- Method: SystemWindow>>handleMouseDown: (in category 'events') -----
  handleMouseDown: evt 
- 		
- 	"If my submorphs handled the events, we still need to use this hook to raise."
- 	(self isKeyWindow not
- 		and: [self class windowsRaiseOnClick
- 			or: [self windowDecorations anySatisfy: [:morph | morph bounds containsPoint: evt position]] ])
- 				ifTrue: [self beKeyWindow].
  
+ 	self activateIfNeeded: evt.
  	^ super handleMouseDown: evt!

Item was added:
+ ----- Method: SystemWindow>>handleMouseUp: (in category 'events') -----
+ handleMouseUp: evt 
+ 
+ 	self activateIfNeeded: evt.
+ 	^ super handleMouseUp: evt!

Item was added:
+ ----- Method: SystemWindow>>isLookingFocused (in category 'focus') -----
+ isLookingFocused
+ 	
+ 	^ isLookingFocused ifNil: [false]!

Item was added:
+ ----- Method: SystemWindow>>isLookingFocused: (in category 'focus') -----
+ isLookingFocused: aBoolean
+ 	
+ 	isLookingFocused := aBoolean.!

Item was changed:
  ----- Method: SystemWindow>>lookFocused (in category 'focus') -----
  lookFocused
+ 
+ 	"Optimize performance."
+ 	self isLookingFocused ifTrue: [^ self].
+ 	self isLookingFocused: true.
+ 
  	label ifNotNil: [ label color: Color black ].
  	
  	(self isKeyWindow or: [self class windowTitleActiveOnFirstClick])
  		ifTrue: [self undimWindowButtons].
  		
  	self paneColorToUse in: [ : col |
  		self
  			 setStripeColorsFrom: col ;
  			 adoptPaneColor: col].!

Item was changed:
  ----- Method: SystemWindow>>lookUnfocused (in category 'focus') -----
  lookUnfocused
+ 
+ 	"Optimize performance."
+ 	self isLookingFocused ifFalse: [^ self].
+ 	self isLookingFocused: false.
+ 
  	label ifNotNil: [ label color: Color darkGray ].
  	self dimWindowButtons.
  	self paneColorToUseWhenNotActive in: [ : col |
  		self
  			 setStripeColorsFrom: col ;
  			 adoptPaneColor: col ]!

Item was changed:
  ----- Method: SystemWindow>>mouseEnter: (in category 'events') -----
  mouseEnter: anEvent 
  	"Handle a mouseEnter event, meaning the mouse just entered my bounds with no button pressed. The default response is to let my eventHandler, if any, handle it."
  	super mouseEnter: anEvent.
  
+ 	(self isActive and: [Preferences mouseOverForKeyboardFocus])
+ 		ifTrue: [self lookFocused].!
- 	self isActive ifTrue: [self lookFocused].!

Item was changed:
  ----- Method: SystemWindow>>mouseLeave: (in category 'events') -----
  mouseLeave: anEvent 
  	"Handle a mouseEnter event, meaning the mouse just entered my bounds with no button pressed. The default response is to let my eventHandler, if any, handle it."
  	super mouseLeave: anEvent.
  	
+ 	(model windowActiveOnFirstClick and: [Preferences mouseOverForKeyboardFocus
+ 		or: [anEvent hand keyboardFocus notNil and: [anEvent hand keyboardFocus containingWindow ~= self]]])
+ 			ifTrue: [self lookUnfocused].!
- 	model windowActiveOnFirstClick ifTrue: [self lookUnfocused].!

Item was changed:
  ----- Method: SystemWindow>>mouseLeaveDragging: (in category 'events') -----
  mouseLeaveDragging: evt
+ 	"Passivate after drop operations if needed. Unfortunately, we get a leave-dragging event for the system window we want to drag. Watch out for it."
- 	"Passivate after drop operations if needed."
  	
+ 	((model windowActiveOnFirstClick and: [(evt hand submorphs includes: self) not])
+ 		or: [self isKeyWindow not])
+ 			ifTrue: [self lookUnfocused].
+ 	
- 	model windowActiveOnFirstClick ifTrue: [self lookUnfocused].
- 		
  	(self isKeyWindow not and: [evt hand hasSubmorphs]) ifTrue:[
  		self passivateIfNeeded.
  		evt hand removeMouseListener: self. "no more drop completion possible on submorph"
  	].!

Item was changed:
  ----- Method: SystemWindow>>openAsIsIn: (in category 'open/close') -----
  openAsIsIn: aWorld
  	"This msg and its callees result in the window being activeOnlyOnTop"
  	aWorld addMorph: self.
  	self beKeyWindow.
+ 	aWorld startSteppingSubmorphsOf: self.!
- 	aWorld startSteppingSubmorphsOf: self.
- 	self activeHand
- 		releaseKeyboardFocus;
- 		releaseMouseFocus.!

Item was changed:
  ----- Method: SystemWindow>>openInWorld: (in category 'open/close') -----
  openInWorld: aWorld
  	"This msg and its callees result in the window being activeOnlyOnTop"
+ 	^ self anyOpenWindowLikeMe
- 	[^ self anyOpenWindowLikeMe
  		ifEmpty: 
  			[ self 
  				bounds: (RealEstateAgent initialFrameFor: self world: aWorld) ;
  				openAsIsIn: aWorld ]
  		ifNotEmptyDo:
  			[ : windows | 
  			windows anyOne
  				expand ;
  				beKeyWindow ; 
+ 				postAcceptBrowseFor: self ].!
- 				postAcceptBrowseFor: self ].
- 	] ensure: [ 
- 		self activeHand
- 			releaseKeyboardFocus;
- 			releaseMouseFocus. ]!

Item was changed:
  ----- Method: SystemWindow>>openInWorld:extent: (in category 'open/close') -----
  openInWorld: aWorld extent: extent
  	"This msg and its callees result in the window being activeOnlyOnTop"
+ 	^ self anyOpenWindowLikeMe
- 	[^ self anyOpenWindowLikeMe
  		ifEmpty:
  			[ self 
  				position: (RealEstateAgent initialFrameFor: self initialExtent: extent world: aWorld) topLeft ;
  				extent: extent.
  			self openAsIsIn: aWorld ]
  		ifNotEmptyDo:
  			[ : windows | 
  			windows anyOne
  				expand ;
  				beKeyWindow ; 
+ 				postAcceptBrowseFor: self ].!
- 				postAcceptBrowseFor: self ].
- 	] ensure: [ 
- 		self activeHand
- 			releaseKeyboardFocus;
- 			releaseMouseFocus. ]!

Item was changed:
  ----- Method: SystemWindow>>passivate (in category 'focus') -----
  passivate
  	"Reconfigure my focus according to preferences."
  
  	self isActive ifFalse: [^ self].
  	self isActive: false.
  	
  	self isCollapsed ifFalse: [model modelSleep].
  
  	self submorphsDo: [:each | each lock].
  
+ 	self activeHand keyboardFocus ifNotNil: [:morph |
+ 		morph containingWindow == self
+ 			ifTrue: [self activeHand releaseKeyboardFocus]].
+ 
  	self lookUnfocused.!

Item was changed:
  ----- Method: SystemWindow>>updateFocusLookAtHand (in category 'focus') -----
  updateFocusLookAtHand
  	"If there is more than one active window, look for the mouse cursor and update the window focus look accordingly. This method is not on the class-side because we need our world and some active hand."
  	
+ 	(model windowActiveOnFirstClick and: [Preferences mouseOverForKeyboardFocus])
+ 		ifFalse: [self updateFocusLookForKeyboardFocus]
+ 		 ifTrue: [
+ 			((self class windowsIn: self world)
+ 				do: [:window | window lookUnfocused];
+ 				select: [:window | window bounds containsPoint: self activeHand position])
+ 					ifNotEmpty: [:windowsPointed | windowsPointed first lookFocused "only to foremost window"]].!
- 	model windowActiveOnFirstClick ifFalse: [^ self].
- 	
- 	((self class windowsIn: self world)
- 		do: [:window | window lookUnfocused];
- 		select: [:window | window bounds containsPoint: self activeHand position])
- 			ifNotEmpty: [:windowsPointed | windowsPointed first lookFocused "only to foremost window"].!

Item was added:
+ ----- Method: SystemWindow>>updateFocusLookForKeyboardFocus (in category 'focus') -----
+ updateFocusLookForKeyboardFocus
+ 
+ 	| f w |
+ 	(((f := self activeHand keyboardFocus) notNil and: [(w := f containingWindow) notNil])
+ 		and: [w isActive])
+ 			ifTrue: [
+ 				(self class windowsIn: self world) do: [:window | window lookUnfocused].
+ 				w lookFocused]!



More information about the Packages mailing list