StandardSystemView.st
changeset 7416 bd3b9e9edd9e
parent 7398 6d085e759693
child 7541 39940e2446a5
child 7562 217cc7ec5656
--- a/StandardSystemView.st	Sat Jul 16 18:24:24 2016 +0200
+++ b/StandardSystemView.st	Tue Jul 19 21:44:36 2016 +0200
@@ -9,6 +9,8 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
+'From Smalltalk/X, Version:6.2.3.0 on 19-03-2014 at 15:29:39'                   !
+
 "{ Package: 'stx:libview' }"
 
 "{ NameSpace: Smalltalk }"
@@ -490,8 +492,8 @@
     |b|
 
     (b := TimedRaiseAction) notNil ifTrue:[
-        TimedRaiseAction := nil.
-        Processor removeTimeoutWithID:b.
+	TimedRaiseAction := nil.
+	Processor removeTimeoutWithID:b.
     ].
 !
 
@@ -692,29 +694,29 @@
      depends on good-will of window manager"
 
     |id|
-    
+
     maxExtent ~= max ifTrue:[
-        maxExtent := max.
-        maxExtent x isNil ifTrue:[
-            maxExtent := 99999 @ maxExtent y.
-        ].
-        maxExtent y isNil ifTrue:[
-            maxExtent := maxExtent x @ 99999.
-        ].
+	maxExtent := max.
+	maxExtent x isNil ifTrue:[
+	    maxExtent := 99999 @ maxExtent y.
+	].
+	maxExtent y isNil ifTrue:[
+	    maxExtent := maxExtent x @ 99999.
+	].
 
-        (id := self drawableId) notNil ifTrue:[
-            device setWindowMinExtent:nil maxExtent:max in:id
-        ].
+	(id := self drawableId) notNil ifTrue:[
+	    device setWindowMinExtent:nil maxExtent:max in:id
+	].
 
-        "/ if my current extent is larger than the new
-        "/ maxExtent, adjust.
+	"/ if my current extent is larger than the new
+	"/ maxExtent, adjust.
 
-        (width notNil and:[height notNil]) ifTrue:[
-            ((width > (max x)) or:
-             [height > (max y)]) ifTrue: [
-                self extent:(max min:self extent)
-            ]
-        ]
+	(width notNil and:[height notNil]) ifTrue:[
+	    ((width > (max x)) or:
+	     [height > (max y)]) ifTrue: [
+		self extent:(max min:self extent)
+	    ]
+	]
     ].
 !
 
@@ -731,20 +733,20 @@
     |id|
 
     minExtent ~= min ifTrue:[
-        minExtent := min.
-        (id := self drawableId) notNil ifTrue:[
-            device setWindowMinExtent:min maxExtent:nil in:id
-        ].
+	minExtent := min.
+	(id := self drawableId) notNil ifTrue:[
+	    device setWindowMinExtent:min maxExtent:nil in:id
+	].
 
-        "/ if my current extent is smaller than the new
-        "/ minExtent, adjust.
+	"/ if my current extent is smaller than the new
+	"/ minExtent, adjust.
 
-        (width notNil and:[height notNil]) ifTrue:[
-            ((width < (min x)) or:
-             [height < (min y)]) ifTrue: [
-                self extent:(min max:self extent)
-            ]
-        ]
+	(width notNil and:[height notNil]) ifTrue:[
+	    ((width < (min x)) or:
+	     [height < (min y)]) ifTrue: [
+		self extent:(min max:self extent)
+	    ]
+	]
     ]
 ! !
 
@@ -764,15 +766,15 @@
     icon := aFormOrImage.
     iconValue := icon value.
     iconValue notNil ifTrue:[
-        self drawableId notNil ifTrue:[
-            i := device convertedIcon:iconValue.
-            (i notNil and:[i id notNil]) ifTrue:[
-                (m := iconValue mask) notNil ifTrue:[
-                    m := device convertedIconMask:m.
-                ].
-                device setWindowIcon:i mask:m in:self drawableId
-            ]
-        ]
+	self drawableId notNil ifTrue:[
+	    i := device convertedIcon:iconValue.
+	    (i notNil and:[i id notNil]) ifTrue:[
+		(m := iconValue mask) notNil ifTrue:[
+		    m := device convertedIconMask:m.
+		].
+		device setWindowIcon:i mask:m in:self drawableId
+	    ]
+	]
     ]
 
     "Modified: / 30-10-2007 / 16:39:15 / cg"
@@ -790,14 +792,14 @@
     |newLabel|
 
     (newLabel := aString string) ~= iconLabel ifTrue:[
-        iconLabel := newLabel.
-        self drawableId notNil ifTrue:[
-            device setIconName:newLabel in:self drawableId.
-            "
-             unbuffered - to make it visible right NOW
-            "
-            self flush.
-        ]
+	iconLabel := newLabel.
+	self drawableId notNil ifTrue:[
+	    device setIconName:newLabel in:self drawableId.
+	    "
+	     unbuffered - to make it visible right NOW
+	    "
+	    self flush.
+	]
     ]
 !
 
@@ -811,9 +813,9 @@
 
     "/ only images possibly have iconMasks
     icon notNil ifTrue:[
-        (mask := icon value mask) notNil ifTrue:[
-            ^ device convertedIconMask:mask
-        ]
+	(mask := icon value mask) notNil ifTrue:[
+	    ^ device convertedIconMask:mask
+	]
     ].
 
     ^ nil
@@ -842,9 +844,9 @@
 
     iconView := aView.
     self drawableId notNil ifTrue:[
-        aView create.
-        device setWindowIconWindow:aView in:self drawableId.
-        aView setRealized:true.
+	aView create.
+	device setWindowIconWindow:aView in:self drawableId.
+	aView setRealized:true.
     ]
 
     "Modified: 4.4.1997 / 16:21:37 / cg"
@@ -867,18 +869,18 @@
     newLabel := aString.
     newLabel notNil ifTrue:[newLabel := newLabel string].
     newLabel ~= label ifTrue:[
-        label := newLabel.
-        "/ fix: cg: realized is a bad test here - could still be unmapped...
-        self drawableId notNil "realized" ifTrue: [
-            expandedLabel := self windowLabelFor:label.
-            self windowName:(expandedLabel ? '').
-            shown ifTrue:[
-                "
-                 unbuffered - to make it visible right NOW
-                "
-                self flush.
-            ]
-        ]
+	label := newLabel.
+	"/ fix: cg: realized is a bad test here - could still be unmapped...
+	self drawableId notNil "realized" ifTrue: [
+	    expandedLabel := self windowLabelFor:label.
+	    self windowName:(expandedLabel ? '').
+	    shown ifTrue:[
+		"
+		 unbuffered - to make it visible right NOW
+		"
+		self flush.
+	    ]
+	]
     ]
 
     "Created: / 08-09-1995 / 19:37:06 / claus"
@@ -967,14 +969,14 @@
     and:[ wg isInModalLoop not
     and:[ wg mainGroup isInModalLoop not
     and:[ self isModal not ]]]) ifTrue:[
-        self sensor anyButtonPressed ifFalse:[
-            "/ if I have an application, let it decide
-            (app := self application) notNil ifTrue:[
-                app delayedAutoRaiseEventFor:self
-            ] ifFalse:[
-                self raise.
-            ].
-        ]
+	self sensor anyButtonPressed ifFalse:[
+	    "/ if I have an application, let it decide
+	    (app := self application) notNil ifTrue:[
+		app delayedAutoRaiseEventFor:self
+	    ] ifFalse:[
+		self raise.
+	    ].
+	]
     ]
 !
 
@@ -986,75 +988,75 @@
     |viewToGetFocus viewUnderMousePointer ms|
 
     windowGroup notNil ifTrue:[
-        "/ a hack for window managers, which do not honor the
-        "/ WMTransientFor attribute (i.e. XQuartz).
-        "/ This flag would prevent a popup (dialog or notification) from being
-        "/ covered by its underlying regular view. But on MAC, it does not.
-        "/ However, focus is coming in, when doing this, so we manually fix this
-        "/ here. Should not hurt on other systems, where the view is already on top.
-        "/ if it does, add some conditional check here (device WMTransientForBroken or similar)
-        "/ You can check for you WM to be correct, by disabling the line below,
-        "/ then click on a smallLint-note icon, to see the smallLint info,
-        "/ then click on the underlying codeView, to raise it.
-        "/ if the smallLint view can be covered, your WM is broken.
-        "/ cg: turns out to be a bad idea - it does help solve the above problem (on mac),
-        "/ but raises unwanted topViews (for example, if a modal dialog's popup menu closes)
-        "/ windowGroup topViews first raise.
+	"/ a hack for window managers, which do not honor the
+	"/ WMTransientFor attribute (i.e. XQuartz).
+	"/ This flag would prevent a popup (dialog or notification) from being
+	"/ covered by its underlying regular view. But on MAC, it does not.
+	"/ However, focus is coming in, when doing this, so we manually fix this
+	"/ here. Should not hurt on other systems, where the view is already on top.
+	"/ if it does, add some conditional check here (device WMTransientForBroken or similar)
+	"/ You can check for you WM to be correct, by disabling the line below,
+	"/ then click on a smallLint-note icon, to see the smallLint info,
+	"/ then click on the underlying codeView, to raise it.
+	"/ if the smallLint view can be covered, your WM is broken.
+	"/ cg: turns out to be a bad idea - it does help solve the above problem (on mac),
+	"/ but raises unwanted topViews (for example, if a modal dialog's popup menu closes)
+	"/ windowGroup topViews first raise.
 
-        "/ I got the focus - tell the current focus-windowgroup
-        "/ that its focus is gone elsewhere ...
-        "/ 'focusIn ' print. windowGroup process name printCR.
-        "/ 'focusView is ' print. windowGroup focusView printCR.
+	"/ I got the focus - tell the current focus-windowgroup
+	"/ that its focus is gone elsewhere ...
+	"/ 'focusIn ' print. windowGroup process name printCR.
+	"/ 'focusView is ' print. windowGroup focusView printCR.
 
-        "/ although the foucs has usually already been taken (see focusOut),
-        "/ there are situations where this does not happen;
-        "/ I am not sure if that is a WM bug or an ST/X bug, but sometimes (with popups),
-        "/ I only get a focus in. Could be a race, when the loosing view is already destroyed,
-        "/ at the time the focus event arrives.
-        "/ Anyway: it should not matter to take it again...
-        WindowGroup takeFocusFromDevice:device.
+	"/ although the foucs has usually already been taken (see focusOut),
+	"/ there are situations where this does not happen;
+	"/ I am not sure if that is a WM bug or an ST/X bug, but sometimes (with popups),
+	"/ I only get a focus in. Could be a race, when the loosing view is already destroyed,
+	"/ at the time the focus event arrives.
+	"/ Anyway: it should not matter to take it again...
+	WindowGroup takeFocusFromDevice:device.
 
-        windowGroup isInModalLoop ifTrue:[
-            windowGroup allTopViewsDo:[:t |
-                t ~~ self ifTrue:[
-                    t focusIn.
-                    t raise.
-                    ^ self.
-                ].
-            ]
-        ].
+	windowGroup isInModalLoop ifTrue:[
+	    windowGroup allTopViewsDo:[:t |
+		t ~~ self ifTrue:[
+		    t focusIn.
+		    t raise.
+		    ^ self.
+		].
+	    ]
+	].
 
-        "/ Transcript show:self; show:' focus in '; showCR:windowGroup isInModalLoop.
+	"/ Transcript show:self; show:' focus in '; showCR:windowGroup isInModalLoop.
 
-        viewToGetFocus := windowGroup focusView.
-        viewToGetFocus isNil ifTrue:[
-            UserPreferences current focusFollowsMouse ~~ false ifTrue:[
-                viewUnderMousePointer := windowGroup pointerView.
-                "/ 'viewUnderMousePointer is ' print. viewUnderMousePointer printCR.
-                (viewUnderMousePointer notNil
-                and:[viewUnderMousePointer isKeyboardConsumer
-                and:[viewUnderMousePointer wantsFocusWithPointerEnter]]) ifTrue:[
-                    viewToGetFocus := viewUnderMousePointer.
-                ]
-            ].
-        ].
-        viewToGetFocus isNil ifTrue:[
-            windowGroup focusBackToPreviousFocusView.
-            windowGroup focusView isNil ifTrue:[
-                self assignInitialKeyboardFocus.
-            ].
-        ] ifFalse:[
-            "/ v requestFocus.  - will be denied; but we must force it here
-            "/ to force a change...
-            windowGroup setFocusView:nil.
-            windowGroup focusView:viewToGetFocus byTab:nil.
-        ].
+	viewToGetFocus := windowGroup focusView.
+	viewToGetFocus isNil ifTrue:[
+	    UserPreferences current focusFollowsMouse ~~ false ifTrue:[
+		viewUnderMousePointer := windowGroup pointerView.
+		"/ 'viewUnderMousePointer is ' print. viewUnderMousePointer printCR.
+		(viewUnderMousePointer notNil
+		and:[viewUnderMousePointer isKeyboardConsumer
+		and:[viewUnderMousePointer wantsFocusWithPointerEnter]]) ifTrue:[
+		    viewToGetFocus := viewUnderMousePointer.
+		]
+	    ].
+	].
+	viewToGetFocus isNil ifTrue:[
+	    windowGroup focusBackToPreviousFocusView.
+	    windowGroup focusView isNil ifTrue:[
+		self assignInitialKeyboardFocus.
+	    ].
+	] ifFalse:[
+	    "/ v requestFocus.  - will be denied; but we must force it here
+	    "/ to force a change...
+	    windowGroup setFocusView:nil.
+	    windowGroup focusView:viewToGetFocus byTab:nil.
+	].
 
-        "/ optionally bring the window to the front after some delay.
-        "/ but not, if my windowGroup is in a modal or popup action
-        (ms := UserPreferences current autoRaiseOnFocusInDelay) notNil ifTrue:[
-            self scheduleAutoRaiseAfter:ms
-        ].
+	"/ optionally bring the window to the front after some delay.
+	"/ but not, if my windowGroup is in a modal or popup action
+	(ms := UserPreferences current autoRaiseOnFocusInDelay) notNil ifTrue:[
+	    self scheduleAutoRaiseAfter:ms
+	].
     ].
     super focusIn
 
@@ -1070,13 +1072,13 @@
     "/ 'fout ' print. self printCR.
 
     (wg := windowGroup) notNil ifTrue:[
-        "/ '  fout-focusView: ' print. windowGroup focusView printCR.
-        (v := wg focusView) notNil ifTrue:[
-            "/ wg focusView:nil.  "/ -- let windowGroup do it.
-            v showNoFocus:(windowGroup explicitFocusView == v).
-            "/ '  send-has-nofocus to: ' print. v printCR.
-            v hasKeyboardFocus:false.
-        ]
+	"/ '  fout-focusView: ' print. windowGroup focusView printCR.
+	(v := wg focusView) notNil ifTrue:[
+	    "/ wg focusView:nil.  "/ -- let windowGroup do it.
+	    v showNoFocus:(windowGroup explicitFocusView == v).
+	    "/ '  send-has-nofocus to: ' print. v printCR.
+	    v hasKeyboardFocus:false.
+	]
     ].
     super focusOut
 
@@ -1088,7 +1090,7 @@
      shortcut key defined, process the shortcut and return true - otherwise false."
 
     application notNil ifTrue:[
-        (application processShortcut:aKeyEvent) ifTrue:[ ^ true ]
+	(application processShortcut:aKeyEvent) ifTrue:[ ^ true ]
     ].
     ^super processShortcut:aKeyEvent
 
@@ -1103,22 +1105,22 @@
     |wg actionID|
 
     (wg := self windowGroup) isNil ifTrue:[^ self].
-    wg isInModalLoop ifTrue:[^ self].  
+    wg isInModalLoop ifTrue:[^ self].
     wg mainGroup isInModalLoop ifTrue:[^ self].
     "/ self isModal ifTrue:[^ self].
 
     TimedRaiseAction notNil ifTrue:[
-        Processor removeTimeoutWithID:TimedRaiseAction.
+	Processor removeTimeoutWithID:TimedRaiseAction.
     ].
-    TimedRaiseAction := actionID := Processor 
-                            addTimedBlock:
-                                [
-                                    TimedRaiseAction == actionID ifTrue:[
-                                        TimedRaiseAction := nil.
-                                        self sensor pushUserEvent: #delayedAutoRaiseEvent for: self 
-                                    ].     
-                                ]
-                            afterMilliseconds:ms.
+    TimedRaiseAction := actionID := Processor
+			    addTimedBlock:
+				[
+				    TimedRaiseAction == actionID ifTrue:[
+					TimedRaiseAction := nil.
+					self sensor pushUserEvent: #delayedAutoRaiseEvent for: self
+				    ].
+				]
+			    afterMilliseconds:ms.
 !
 
 showActivity:someMessage
@@ -1168,9 +1170,9 @@
 
     "/ self setBorderWidth:2.         "- notice: many window managers ignore this"
     device isWindowsPlatform ifTrue:[
-        minExtent := 0 @ 0.
+	minExtent := 0 @ 0.
     ] ifFalse:[
-        minExtent := 10 @ 10.
+	minExtent := 10 @ 10.
     ].
 
     label isNil ifTrue:[label := self class defaultLabel].
@@ -1183,10 +1185,10 @@
 mapped
     super mapped.
     device isWindowsPlatform ifTrue:[
-        "don't do this in X11 - switching between 
-         virtual desktops would change the window stacking all the time"
-        self setForegroundWindow.
-        self activate.
+	"don't do this in X11 - switching between
+	 virtual desktops would change the window stacking all the time"
+	self setForegroundWindow.
+	self activate.
     ].
 
     "Created: / 01-12-2010 / 15:57:22 / cg"
@@ -1207,8 +1209,8 @@
     limitBottom := graphicsDevice usableHeight - dY.
     ((self left > limitRight) or:[
       self top > limitBottom]) ifTrue:[
-        'StandardSystemView [info]: moving view into visible area' infoPrintCR.
-        self origin:limitRight @ limitBottom
+	'StandardSystemView [info]: moving view into visible area' infoPrintCR.
+	self origin:limitRight @ limitBottom
     ]
 
     "Modified: 10.1.1997 / 15:12:19 / cg"
@@ -1224,7 +1226,7 @@
 
     "if I have already been reinited - return"
     self drawableId notNil ifTrue:[
-        ^ self
+	^ self
     ].
 
     "have to kludge with the controller
@@ -1238,13 +1240,13 @@
 
     "if I was iconified (not realized), remap iconified"
     device
-        mapView:self id:self drawableId iconified:(realized "shown" not)
-        atX:left y:top width:width height:height
-        minExtent:minExtent maxExtent:maxExtent.
+	mapView:self id:self drawableId iconified:(realized "shown" not)
+	atX:left y:top width:width height:height
+	minExtent:minExtent maxExtent:maxExtent.
 
     "and restart the window-group process"
     windowGroup notNil ifTrue:[
-        windowGroup restart
+	windowGroup restart
     ].
 
     "restore controller"
@@ -1354,47 +1356,47 @@
 windowLabelFor:labelString
     "return an expanded labelString, according to the hostName-in-window setting.
      The labelString may include positional parameters:
-        %1 - the actual label
-        %2 - the hostname
-        %3 - the userName
-        %4 - the processId
-        %5 - the TOP-directories name
-        %6 - the TOP-directories path
+	%1 - the actual label
+	%2 - the hostname
+	%3 - the userName
+	%4 - the processId
+	%5 - the TOP-directories name
+	%6 - the TOP-directories path
     "
 
     |wg proc id pidString lbl windowLabelFormat stxPackageDirectory topDirectory|
 
     (IncludeHostNameInLabel == true
     and:[(windowLabelFormat := self class windowLabelFormat) notNil]) ifTrue:[
-        (wg := self windowGroup) notNil ifTrue:[
-            (proc := wg process) notNil ifTrue:[
-                (id := proc id) notNil ifTrue:[
-                    pidString := id printString
-                ]
-            ]
-        ].
-        stxPackageDirectory := Smalltalk getPackageDirectoryForPackage:'stx'.
-        stxPackageDirectory isNil ifTrue:[
-            'StdSysView [info]: cannot figure out stx package directory.' infoPrintCR.
-            stxPackageDirectory := OperatingSystem pathOfSTXExecutable asFilename.
-        ].
-        stxPackageDirectory isNil ifTrue:[
-            topDirectory := OperatingSystem getHomeDirectory asFilename.
-        ] ifFalse:[
-            topDirectory := stxPackageDirectory directory.
-            "/ a hack to make it look nicer on mac... (shows Packages otherwise)
-            topDirectory baseName = 'Packages' ifTrue:[
-                topDirectory := topDirectory directory
-            ].
-        ].
-        lbl := windowLabelFormat
-                bindWith:labelString
-                with:[OperatingSystem getHostName]
-                with:[OperatingSystem getLoginName]
-                with:pidString
-                with:[topDirectory baseName]
-                with:[topDirectory pathName].
-        ^ lbl
+	(wg := self windowGroup) notNil ifTrue:[
+	    (proc := wg process) notNil ifTrue:[
+		(id := proc id) notNil ifTrue:[
+		    pidString := id printString
+		]
+	    ]
+	].
+	stxPackageDirectory := Smalltalk getPackageDirectoryForPackage:'stx'.
+	stxPackageDirectory isNil ifTrue:[
+	    'StdSysView [info]: cannot figure out stx package directory.' infoPrintCR.
+	    stxPackageDirectory := OperatingSystem pathOfSTXExecutable asFilename.
+	].
+	stxPackageDirectory isNil ifTrue:[
+	    topDirectory := OperatingSystem getHomeDirectory asFilename.
+	] ifFalse:[
+	    topDirectory := stxPackageDirectory directory.
+	    "/ a hack to make it look nicer on mac... (shows Packages otherwise)
+	    topDirectory baseName = 'Packages' ifTrue:[
+		topDirectory := topDirectory directory
+	    ].
+	].
+	lbl := windowLabelFormat
+		bindWith:labelString
+		with:[OperatingSystem getHostName]
+		with:[OperatingSystem getLoginName]
+		with:pidString
+		with:[topDirectory baseName]
+		with:[topDirectory pathName].
+	^ lbl
     ].
     ^ labelString
 
@@ -1424,18 +1426,18 @@
     "iconify the receiver"
 
     shown ifTrue:[
-        self unmap.
+	self unmap.
 
-        "if it was iconified, try to remap iconified"
-        device
-            mapView:self id:self drawableId iconified:true
-            atX:left y:top width:width height:height
-            minExtent:minExtent maxExtent:maxExtent.
+	"if it was iconified, try to remap iconified"
+	device
+	    mapView:self id:self drawableId iconified:true
+	    atX:left y:top width:width height:height
+	    minExtent:minExtent maxExtent:maxExtent.
 
-        shown ifTrue:[
-            shown := false.
-            dependents notNil ifTrue:[ self changed:#visibility ].
-        ].
+	shown ifTrue:[
+	    shown := false.
+	    dependents notNil ifTrue:[ self changed:#visibility ].
+	].
     ].
 
     "
@@ -1459,12 +1461,12 @@
     super create.
 
     iconView notNil ifTrue:[
-        iconView create.
-        device setWindowIconWindow:iconView in:self drawableId.
-        iconView setRealized:true.
+	iconView create.
+	device setWindowIconWindow:iconView in:self drawableId.
+	iconView setRealized:true.
     ].
     iconLabel notNil ifTrue:[
-        device setIconName:iconLabel string in:self drawableId
+	device setIconName:iconLabel string in:self drawableId
     ]
 
     "Modified: 10.6.1996 / 20:14:50 / cg"
@@ -1474,13 +1476,13 @@
     "de-iconify the receiver at its old position"
 
     shown ifFalse:[
-        self unmap.
+	self unmap.
 
-        "if it was iconified, try to remap non-iconified"
-        device
-            mapView:self id:self drawableId iconified:false
-            atX:left y:top width:width height:height
-            minExtent:minExtent maxExtent:maxExtent.
+	"if it was iconified, try to remap non-iconified"
+	device
+	    mapView:self id:self drawableId iconified:false
+	    atX:left y:top width:width height:height
+	    minExtent:minExtent maxExtent:maxExtent.
     ].
 
     "
@@ -1505,33 +1507,33 @@
     dev := device.
     currentUserPrefs := UserPreferences current.
     currentUserPrefs forceWindowsIntoMonitorBounds ifTrue:[
-        "/ MULTI SCREEN support
-        devBounds := dev monitorBoundsAt:( left @ top ).
-        "/ adjust origin, if too large
-        left + width > devBounds right ifTrue:[
-            left := devBounds right - width.
-        ].
-        top + height > devBounds bottom ifTrue:[
-            top := devBounds bottom - height.
-        ].
-        top  := top  max:(devBounds top).
-        left := left max:(devBounds left).
+	"/ MULTI SCREEN support
+	devBounds := dev monitorBoundsAt:( left @ top ).
+	"/ adjust origin, if too large
+	left + width > devBounds right ifTrue:[
+	    left := devBounds right - width.
+	].
+	top + height > devBounds bottom ifTrue:[
+	    top := devBounds bottom - height.
+	].
+	top  := top  max:(devBounds top).
+	left := left max:(devBounds left).
     ].
 
     dev isWindowsPlatform ifTrue:[
-        top := top + dev captionHeight.
+	top := top + dev captionHeight.
     ].
     org := (left @ top) rounded.
     lbl := self windowLabelFor:label.
 
     icon notNil ifTrue:[
-        iconValue := icon value.
-        icn := dev convertedIcon:iconValue.
-        (icnMask := iconValue mask) notNil ifTrue:[
-            icnMask := dev convertedIconMask:icnMask.
-        ].
-        "this is to keep the references"
-        deviceIcon := Array with:icn with:icnMask.
+	iconValue := icon value.
+	icn := dev convertedIcon:iconValue.
+	(icnMask := iconValue mask) notNil ifTrue:[
+	    icnMask := dev convertedIconMask:icnMask.
+	].
+	"this is to keep the references"
+	deviceIcon := Array with:icn with:icnMask.
     ].
 
     "/ give global eventListeners a chance to intercept windowCreation
@@ -1554,8 +1556,6 @@
       icon:icn iconMask:icnMask
       iconView:iconView.
 
-    Lobby registerChange:self.
-
     "/ give global listeners a chance to track views
     WindowSensor postViewCreateNotification:self.
 
@@ -1574,52 +1574,52 @@
 "/  ].
 
     viewShape notNil ifTrue:[
-        self setViewShape
+	self setViewShape
     ].
 
     (backed notNil and:[backed ~~ false]) ifTrue:[
-        self backingStore:backed.
+	self backingStore:backed.
     ].
     self saveUnder ifTrue:[
-        self saveUnder:true.
+	self saveUnder:true.
     ].
     cursor notNil ifTrue:[
-        self setCursor
+	self setCursor
     ].
 
     "/JV@2012-11-11: Updated to be ICCCM 2.0 Compliant - some modern Window managers
     "/               provide better UX when application behave nicely. Being
     "/               conformant should not hurt as St/X don't depend on X resources anyway :-)
     "/               See:
-    "/  
+    "/
     "/               http://tronche.com/gui/x/icccm/sec-4.html
 
     (currentUserPrefs icccm20Compliant == true) ifTrue:[
-        "/ICCCM 2.0 compliant name & class. See ICCCM 2.0 section 4.1.2.5.
+	"/ICCCM 2.0 compliant name & class. See ICCCM 2.0 section 4.1.2.5.
 
-        | commandName lastSepIndex |
+	| commandName lastSepIndex |
 
-        commandName := Smalltalk commandName.
-        lastSepIndex := commandName lastIndexOf: Filename separator.
-        windowNameString := commandName copyFrom: lastSepIndex + 1.
-        windowClassNameString := windowNameString asUppercaseFirst.
+	commandName := Smalltalk commandName.
+	lastSepIndex := commandName lastIndexOf: Filename separator.
+	windowNameString := commandName copyFrom: lastSepIndex + 1.
+	windowClassNameString := windowNameString asUppercaseFirst.
 
-        "/ Also, set _NET_WM_PID
-        self setWindowPid: nil.
+	"/ Also, set _NET_WM_PID
+	self setWindowPid: nil.
     ] ifFalse:[
-        "/ Old code..."
-        application notNil ifTrue:[
-            windowClassNameString := application class name.
-        ] ifFalse:[
-            (self class == StandardSystemView and:[subViews size == 1]) ifTrue:[
-                "This is a subclass of SimpleView wrapped into a StandardSystemView"
-                windowClassNameString := subViews first class name.
-            ] ifFalse:[
-                windowClassNameString := self class name.
-            ]
-        ].
-        windowClassNameString := 'Stx.', windowClassNameString.
-        windowNameString := 'main'.
+	"/ Old code..."
+	application notNil ifTrue:[
+	    windowClassNameString := application class name.
+	] ifFalse:[
+	    (self class == StandardSystemView and:[subViews size == 1]) ifTrue:[
+		"This is a subclass of SimpleView wrapped into a StandardSystemView"
+		windowClassNameString := subViews first class name.
+	    ] ifFalse:[
+		windowClassNameString := self class name.
+	    ]
+	].
+	windowClassNameString := 'Stx.', windowClassNameString.
+	windowNameString := 'main'.
     ].
 
     self windowClass:windowClassNameString name:windowNameString.
@@ -1638,9 +1638,9 @@
     "/ let the application add its views to the current project
     "/
     application notNil ifTrue:[
-        application opened:self.
+	application opened:self.
     ] ifFalse:[
-        self addToCurrentProject.
+	self addToCurrentProject.
     ].
 
     "Created: 24.7.1997 / 18:11:26 / cg"
@@ -1663,17 +1663,17 @@
     super recreate.
 
     iconView notNil ifTrue:[
-        iconView recreate.
-        device setWindowIconWindow:iconView in:self drawableId.
-        iconView setRealized:true.
+	iconView recreate.
+	device setWindowIconWindow:iconView in:self drawableId.
+	iconView setRealized:true.
     ] ifFalse:[
-        icon notNil ifTrue:[
-            self icon:(device convertedIcon:icon).
-        ].
+	icon notNil ifTrue:[
+	    self icon:(device convertedIcon:icon).
+	].
     ].
 
     iconLabel notNil ifTrue:[
-        device setIconName:iconLabel in:self drawableId
+	device setIconName:iconLabel in:self drawableId
     ]
 
     "Modified: / 30-10-2007 / 16:39:42 / cg"