Multi Screen Support
authorMichael Beyl <mb@exept.de>
Mon, 11 Oct 2010 11:07:07 +0200
changeset 5615 b1cfd445cef6
parent 5614 7c75195a84c1
child 5616 58aca56e8491
Multi Screen Support
WinWorkstation.st
--- a/WinWorkstation.st	Mon Oct 11 11:06:49 2010 +0200
+++ b/WinWorkstation.st	Mon Oct 11 11:07:07 2010 +0200
@@ -7293,23 +7293,27 @@
     "Modified: / 08-09-2006 / 15:40:18 / cg"
 !
 
-monitorInfoAtPoint:aPoint
-    "returns the usable height of the display (in pixels) at a given point
-     Normally, the same as height, but may be smaller, in
-     case some menu space is taken up by the window manager (windows).
-     On multi-display systems with different sized screens, this should care for
-     which display is at the given x-position"
-
-    |monitorHandle|
+monitorBoundsAt:aPoint
+    "answer the bounds of the monitor the point is contained in"
+
+    |monitorHandle monitorInfo|
 
     self numberOfMonitors > 1 ifTrue:[
-        monitorHandle := self monitorHandleForPoint:( aPoint max:(0@0) ).
-        ^ self monitorInfoFor:monitorHandle.
-    ].
-    ^ nil
-    "
-     Display monitorInfoAtPoint:100@100
-     Display monitorInfoAtPoint:2000@100
+"/ ******* MULTI SCREEN ******
+	monitorHandle := self monitorHandleForPoint:aPoint.
+
+	monitorHandle notNil ifTrue:[
+	    monitorInfo := self monitorInfoFor:monitorHandle.
+	    monitorInfo notNil ifTrue:[
+		^ monitorInfo bounds
+	    ].
+	].
+    ].
+    ^ super monitorBoundsAt:aPoint
+    "
+     Display monitorBoundsAt:100@100
+     Display monitorBoundsAt:2000@100
+     Display monitorBoundsAt:-200@100
     "
 !
 
@@ -7439,18 +7443,18 @@
     h := hSingle := self getSystemMetrics:#SM_CYFULLSCREEN.
 
     (self numberOfMonitors) > 1 ifTrue:[
-        w := self getSystemMetrics:#SM_CXVIRTUALSCREEN.
-        h := self getSystemMetrics:#SM_CYVIRTUALSCREEN.
-        (w isNil or:[h isNil]) ifTrue:[
-            "/ not supported under win95 and win-nt4 - fallback to real extent
-            w := wSingle.
-            h := hSingle.
-        ] ifFalse:[
-            dx := (self getSystemMetrics:#SM_CXSCREEN) - wSingle.
-            dy := (self getSystemMetrics:#SM_CYSCREEN) - hSingle.
-            w := w - dx.
-            h := h - dy - 8.
-        ].
+	w := self getSystemMetrics:#SM_CXVIRTUALSCREEN.
+	h := self getSystemMetrics:#SM_CYVIRTUALSCREEN.
+	(w isNil or:[h isNil]) ifTrue:[
+	    "/ not supported under win95 and win-nt4 - fallback to real extent
+	    w := wSingle.
+	    h := hSingle.
+	] ifFalse:[
+	    dx := (self getSystemMetrics:#SM_CXSCREEN) - wSingle.
+	    dy := (self getSystemMetrics:#SM_CYSCREEN) - hSingle.
+	    w := w - dx.
+	    h := h - dy - 8.
+	].
     ].
     ^ w @ h.
 
@@ -7475,7 +7479,10 @@
     |info|
 
     (self numberOfMonitors) > 1 ifTrue:[
-	info := self monitorInfoFor:(self monitorHandleForPoint:(aPoint max:(0@0))).
+
+"/ ******* MULTI SCREEN ******
+
+	info := self monitorInfoFor:(self monitorHandleForPoint:aPoint).
 	info notNil ifTrue:[ ^ info workHeight ].
     ].
     ^ self usableHeight
@@ -7483,6 +7490,7 @@
     "
      Display usableHeightAt:100@100
      Display usableHeightAt:2000@100
+     Display usableHeightAt:-200@100
     "
 ! !
 
@@ -7715,7 +7723,9 @@
       aView setId:windowId.
     ] valueUninterruptably.
 
-    windowId notNil ifTrue:[self addKnownView:aView withId:windowId].
+    windowId notNil ifTrue:[
+	self addKnownView:aView withId:windowId
+    ].
     ^ windowId
 !
 
@@ -8360,14 +8370,17 @@
     lI->mouseX = lI->mouseY = -9999;
 
     if (isTopWindow) {
+/****** MULTI SCREEN *********
 	if (rec.left < 0) {
 	    rec.left = 0;
 	    rec.right = w;
 	}
+****** MULTI SCREEN *********/
 	if (rec.top < 0) {
 	    rec.top = 0;
 	    rec.bottom = h;
 	}
+
 	lI->flag |= LI_TOPWIN;
     } else {
 	if (bw) {
@@ -18800,6 +18813,18 @@
 
 !WinWorkstation::MonitorInfo methodsFor:'accessing'!
 
+bounds
+     "return a rectangle representing the displays bounding box of the monitor"
+
+"/ ******* MULTI SCREEN ******
+
+    ^ Rectangle
+	left:screenX
+	top:screenY
+	width:screenW - 1
+	height:screenH - 1
+!
+
 isPrimary
     ^ isPrimary
 !
@@ -18887,11 +18912,11 @@
 !WinWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.435 2010-10-05 15:53:58 mb Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.436 2010-10-11 09:07:07 mb Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.435 2010-10-05 15:53:58 mb Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.436 2010-10-11 09:07:07 mb Exp $'
 ! !
 
 WinWorkstation initialize!