added:
authorClaus Gittinger <cg@exept.de>
Wed, 03 Feb 2010 18:28:36 +0100
changeset 5552 5524e2ba96c0
parent 5551 7574a9f6f7a3
child 5553 5d324e95ec8d
added: #height #numberOfMonitors #usableHeightAt: #width changed: #usableExtent care for different-height multi-screen systems
WinWorkstation.st
--- a/WinWorkstation.st	Wed Feb 03 18:28:08 2010 +0100
+++ b/WinWorkstation.st	Wed Feb 03 18:28:36 2010 +0100
@@ -7316,6 +7316,14 @@
     "Modified: / 08-09-2006 / 15:40:18 / cg"
 !
 
+numberOfMonitors
+    ^ self getSystemMetrics:#SM_CMONITORS
+
+    "
+     Display numberOfMonitors
+    "
+!
+
 preferredIconSize
     "Get the preferrered icon size.
      Here, workaround windows (bug?) which returns 32@32
@@ -7432,19 +7440,19 @@
     w := wSingle := self getSystemMetrics:#SM_CXFULLSCREEN.
     h := hSingle := self getSystemMetrics:#SM_CYFULLSCREEN.
 
-    (self getSystemMetrics:#SM_CMONITORS) > 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.
-	].
+    (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 @ h.
 
@@ -7457,6 +7465,27 @@
     "
 
     "Modified: / 08-09-2006 / 18:19:22 / cg"
+!
+
+usableHeightAt: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"
+
+    |info|
+
+    (self numberOfMonitors) > 1 ifTrue:[
+        info := self monitorInfoFor:(self monitorHandleForPoint:aPoint).
+        ^ info workHeight
+    ].
+    ^ self usableHeight
+
+    "
+     Display usableHeightAt:100@100
+     Display usableHeightAt:2000@100
+    "
 ! !
 
 !WinWorkstation methodsFor:'bitmap/window creation'!
@@ -18846,11 +18875,11 @@
 !WinWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.419 2010-02-03 17:03:37 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.420 2010-02-03 17:28:36 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.419 2010-02-03 17:03:37 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.420 2010-02-03 17:28:36 cg Exp $'
 ! !
 
 WinWorkstation initialize!