changed: #makeFullyVisible - multiple screens
authorMichael Beyl <mb@exept.de>
Tue, 05 Oct 2010 17:57:16 +0200
changeset 5608 283f9270bf76
parent 5607 0c93f7103308
child 5609 5da09aa47da2
changed: #makeFullyVisible - multiple screens
SimpleView.st
--- a/SimpleView.st	Tue Oct 05 17:53:58 2010 +0200
+++ b/SimpleView.st	Tue Oct 05 17:57:16 2010 +0200
@@ -2852,19 +2852,31 @@
      into the visible screen area if nescessary.
      This method will be moved to StandardSystemView ..."
 
-    |devBot devRight newTop newLeft|
+    |devBot devRgt devLft devTop newTop newLeft monitorInfoAtPoint|
 
     newTop := top.
     newLeft := left.
 
-    "/ notice, the position-dependent query: if there is a higher secondary screen,
-    "/ this makes a difference in where a popUpMenu is allowed...
-    ((top + height) > (devBot := (device usableHeightAt:(left@top))-2)) ifTrue:[
-        newTop := devBot - height
-    ].
-    ((left + width) > (devRight := device usableWidth)) ifTrue:[
-        newLeft := devRight - width
-    ].
+    monitorInfoAtPoint := device monitorInfoAtPoint:(left@top).
+
+    monitorInfoAtPoint notNil ifTrue:[
+        devLft := monitorInfoAtPoint screenX.
+        devRgt := monitorInfoAtPoint screenWidth + devLft.
+        devTop := monitorInfoAtPoint screenY.       
+        devBot := monitorInfoAtPoint screenHeight + devTop.
+    ] ifFalse:[
+        devLft := 0.
+        devRgt := device usableExtent x.
+        devTop := 0.
+        devBot := device usableExtent y.
+    ].
+    (top + height) > devBot ifTrue:[
+        newTop := (devBot - height) max:devTop.
+    ].
+    (left + width) > devRgt ifTrue:[
+        newLeft := (devRgt - width) max:devLft.
+    ].
+
     (newTop < 0) ifTrue:[
         newTop := 0.
     ].
@@ -7696,25 +7708,25 @@
     newLeft := origin x.
     newTop := origin y.
     ((newTop ~~ top) or:[newLeft ~~ left]) ifTrue:[
-	top := newTop.
-	left := newLeft.
-
-	"
-	 if the receiver is visible, or is a topView, perform the
-	 operation right away - otherwise, simply remember that the
-	 origin has changed - will tell the display once we get realized
-	"
+        top := newTop.
+        left := newLeft.
+
+        "
+         if the receiver is visible, or is a topView, perform the
+         operation right away - otherwise, simply remember that the
+         origin has changed - will tell the display once we get realized
+        "
 "/        (shown
 "/        or:[superView isNil and:[drawableId notNil]]) ifTrue:[
 
-	"/ no, have to do it if drawableId is there
-	"/ (otherwise, we could not move unmapped views around ...
-	"/
-	drawableId notNil ifTrue:[
-	    device moveWindow:drawableId x:left y:top
-	] ifFalse:[
-	    self originChangedFlag:true
-	]
+        "/ no, have to do it if drawableId is there
+        "/ (otherwise, we could not move unmapped views around ...
+        "/
+        drawableId notNil ifTrue:[
+            device moveWindow:drawableId x:left y:top
+        ] ifFalse:[
+            self originChangedFlag:true
+        ]
     ]
 !
 
@@ -10646,11 +10658,11 @@
 !SimpleView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.665 2010-09-17 16:39:39 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.666 2010-10-05 15:57:16 mb Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.665 2010-09-17 16:39:39 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.666 2010-10-05 15:57:16 mb Exp $'
 ! !
 
 SimpleView initialize!