[ENH] [BUG] focusFollowsMouse

Steve Elkins sgelkins at bellsouth.net
Tue Nov 23 20:01:15 UTC 1999


An enhancement and an interesting bug.  
Please see the change set preamble.

-----------8<---------------->8-------------

'From Squeak2.7alpha of 13 November 1999 [latest update: #1633] on 23 November 1999 at 6:10:22 pm'!
"Change Set:		focusFollowsMouse
Date:			23 November 1999
Author:			Steve Elkins

This change set adds a focusFollowsMouse preference for SystemWindows.  When true, windows are activated upon mouse entry and raised by clicking on the title bar.  When false, windows can only be activated by clicking within them, anywhere is fine.  The preference default is false.

This change set won't work in a 2.6 image and it won't work without update 1573 (at least).

This change set originated from a message to the Squeak list from Marcus Denker.  I tweaked the behavior and Bert Freudenberg asked me to make it a preference.

WARNING
When focusFollowsMouse is true and fastDragWindowForMorphic is true, it's hard (impossible?) to bring a partially covered window to the front.  To see this for yourself, open a few windows and make both preferences true.  Then try to manipulate the windows.  When you're tired of trying, change either or both to false.  I usually have fastDrag turned off, but I discovered this by accident when I loaded these changes into a freshly updated image.  The default value for fastDrag is true, so when I made focusFollows true I spotted the bug.  

I'll be looking into this, but I'm a morphic newbie, so people who are impatient for an answer should look elsewhere."!


!Preferences class methodsFor: 'help' stamp: 'sge 11/22/1999 22:23'!
initHelpMsgsA
	"Automatically called whenever you call

   	Preferences initializeHelpMessages
		or
	Preferences callHelpMessageInitializers

by virtue of its being in the 'help' category of Preferences class"

	#((menuColorFromWorld
			'Governs whether the colors used in morphic menus should be derived from the color of the world background.')
	(focusFollowsMouse
			'If true, activates windows (without raising them) on mouse entry.  To raise them, click on the title bar.  If false, click to change focus.')
	(roundedWindowCorners
			'Governs whether morphic system windows should have rounded corners')) do:

		[:pair | HelpDictionary at: pair first put: 
			(pair first, ':
', pair last)]
! !

!Preferences class methodsFor: 'standard preferences' stamp: 'programmatic 11/22/1999 22:25'!
focusFollowsMouse
	^ self valueOfFlag: #focusFollowsMouse! !

!Preferences class methodsFor: 'initial values' stamp: 'sge 11/22/1999 22:13'!
initialValuesA
	"Another lot of initial values for prefs.  Simply placing methods of this sort here will assure that the initial values provided are ascribed to the preference when prefs are initialized"

	^#(	(conversionMethodsAtFileOut			false)
		(menuColorFromWorld				false)
		(viewersInFlaps						true)
		(oneViewerFlapAtATime				true)
		(optionalMorphicButtons				false)
		(preserveTrash						true)
		(caseSensitiveFinds					false)
		(smartUpdating						true)
		(colorWhenPrettyPrinting			false)
		(changeSetVersionNumbers			true)
		(focusFollowsMouse					false)
		(twentyFourHourFileStamps			true) )


! !


!SystemWindow methodsFor: 'top window' stamp: 'sge 11/22/1999 22:07'!
activateWithoutBringingToFront
	"Bring me to the front and make me able to respond to mouse and keyboard"
	"sge 11/22/1999 22:06 - this is #activate without the code that puts the window
	on top of any overlapping windows."

	| oldTop outerMorph sketchEditor pal |
	outerMorph _ self topRendererOrSelf.
	outerMorph owner ifNil: [^ self "avoid spurious activate when drop in trash"].
	oldTop _ TopWindow.
	TopWindow _ self.
	oldTop ifNotNil: [oldTop passivate].

	self submorphsDo: [:m | m unlock].
	self setStripeColorsFrom: self paneColorToUse.
	self isCollapsed ifFalse:
		[model modelWakeUpIn: self.
		self positionSubmorphs].

	(sketchEditor _ self extantSketchEditor) ifNotNil:
		[sketchEditor comeToFront.
		(pal _ self world findA: PaintBoxMorph) ifNotNil:
			[pal comeToFront]]! !

!SystemWindow methodsFor: 'events' stamp: 'sge 11/23/1999 05:15'!
handlesMouseOver: evt
	^ Preferences focusFollowsMouse! !

!SystemWindow methodsFor: 'events' stamp: 'sge 11/22/1999 23:20'!
mouseEnter: evt
	^ self activateWithoutBringingToFront! !


"Postscript:
Add the new focusFollowsMouse preference without disturbing existing ones.
Add a help message, too."
Preferences initializeAddedPreferences.
Preferences initializeHelpMessages.
!





More information about the Squeak-dev mailing list