[ENH] positioning of new windows by mouse
Stephan Rudlof
sr at evolgo.de
Mon Dec 6 05:47:50 UTC 1999
--------------B878515262D6DF87E81F7280
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
"Change Set: posNewWindowsByMouse
Date: 6 December 1999
Author: Stephan Rudlof
Enables positioning of new windows by mouse; useful for displays with
multiple virtual screens (e.g. managed by fvwm2 under Linux).
For enabling this feature evaluate
Preferences enable: #windowOriginByMouse.
for disabling it
Preferences disable: #windowOriginByMouse.
This isn't done automatically (no postscript)!"
--------------B878515262D6DF87E81F7280
Content-Type: text/plain; charset=us-ascii;
name="posNewWindowsByMouse.1.cs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="posNewWindowsByMouse.1.cs"
'From Squeak2.7alpha of 1 December 1999 [latest update: #1671] on 6 December 1999 at 6:42:07 am'!
"Change Set: posNewWindowsByMouse
Date: 6 December 1999
Author: Stephan Rudlof
Enables positioning of new windows by mouse; useful for displays with multiple virtual screens (e.g. managed by fvwm2 under Linux).
For enabling this feature evaluate
Preferences enable: #windowOriginByMouse.
for disabling it
Preferences disable: #windowOriginByMouse.
This isn't done automatically (no postscript)!!"
!
!RealEstateAgent class methodsFor: 'as yet unclassified' stamp: 'sr 12/6/1999 06:24'!
initialFrameFor: aView initialExtent: initialExtent
"Find a plausible initial screen area for the supplied view, which should
be a StandardSystemView, taking into account the
'reverseWindowStagger' Preference, the size needed, and other windows
currently on the screen."
| allOrigins screenRight screenBottom putativeOrigin putativeFrame allowedArea staggerOrigin otherFrames |
(Preferences valueOfFlag: #windowOriginByMouse)
ifTrue: [^ Rectangle originFromUser: initialExtent].
Preferences reverseWindowStagger ifTrue: [^ self strictlyStaggeredInitialFrameFor: aView initialExtent: initialExtent].
allowedArea _ self maximumUsableArea.
screenRight _ allowedArea right.
screenBottom _ allowedArea bottom.
otherFrames _ Smalltalk isMorphic
ifTrue: [(SystemWindow windowsIn: World satisfying: [:w | w isCollapsed not])
collect: [:w | w bounds]]
ifFalse: [ScheduledControllers scheduledWindowControllers select: [:aController | aController view ~~ nil]
thenCollect: [:aController | aController view isCollapsed
ifTrue: [aController view expandedFrame]
ifFalse: [aController view displayBox]]].
allOrigins _ otherFrames collect: [:f | f origin].
self standardPositions do: [:aPosition | "First see if one of the standard positions is free"
(allOrigins includes: aPosition)
ifFalse: [^ (aPosition extent: initialExtent)
squishedWithin: allowedArea]].
staggerOrigin _ self standardPositions first.
"Fallback: try offsetting from top left"
putativeOrigin _ staggerOrigin.
[putativeOrigin _ putativeOrigin + StaggerOffset.
putativeFrame _ putativeOrigin extent: initialExtent.
putativeFrame bottom < screenBottom and: [putativeFrame right < screenRight]]
whileTrue: [(allOrigins includes: putativeOrigin)
ifFalse: [^ (putativeOrigin extent: initialExtent)
squishedWithin: allowedArea]].
^ (self scrollBarSetback @ self screenTopSetback extent: initialExtent)
squishedWithin: allowedArea! !
--------------B878515262D6DF87E81F7280--
More information about the Squeak-dev
mailing list
|