WinWorkstation.st
changeset 8909 4d9352a4ca6c
parent 8905 d4525130d743
--- a/WinWorkstation.st	Thu Nov 28 17:52:40 2019 +0100
+++ b/WinWorkstation.st	Thu Nov 28 17:54:42 2019 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
 COPYRIGHT (c) 1996 by Claus Gittinger
 	      All Rights Reserved
@@ -2149,7 +2151,7 @@
 		    }
 		    goto again;
 		}
-		/* fail evtl. später ändern und in st verzögert aufrufen
+		/* fail evtl. später ändern und in st verzögert aufrufen
 		*/
 		console_fprintf(stderr, "WinWorkstation [info]: UnregisterClass %s failed.\n",(char*)ev->ev_arg1);
 	    }
@@ -6641,6 +6643,84 @@
 %}
 ! !
 
+!WinWorkstation class methodsFor:'multi monitor support'!
+
+openViewWithBlock:openAction
+    view:aView  
+    at:origin
+
+    "
+        HACK for multi monitor support.
+        sub views needs to be opened on the same monitor as their top view,
+        so that Windows create/place them into the same virtual resolution/display.
+        after the sub views are opened we can move them within the same virtual resolution/display.
+        to their actually origin
+    "
+
+    |application monitorInfo 
+     originX originY
+     screenX screenY 
+     tmpOriginX tmpOriginY
+     topView|
+
+    aView isNil ifTrue:[
+        ^ super 
+            openViewWithBlock:openAction
+            view:aView  
+            at:origin
+    ].
+
+    aView isMenu ifTrue:[
+        application := aView application.
+        application isNil ifTrue:[
+            ^ super 
+                openViewWithBlock:openAction
+                view:aView  
+                at:origin
+        ].
+
+        topView := application topView.
+    ] ifFalse:[
+        self halt. "/ find the real top view
+        topView := aView topView.
+    ].
+
+    topView isNil ifTrue:[
+        ^ super 
+            openViewWithBlock:openAction
+            view:aView  
+            at:origin
+    ].
+
+    monitorInfo := Display monitorInfoForView:topView.    
+    monitorInfo isNil ifTrue:[
+        ^ super 
+            openViewWithBlock:openAction
+            view:aView  
+            at:origin
+    ].
+
+    originX := origin x.
+    originY := origin y.
+    screenX := monitorInfo screenX.
+    screenY := monitorInfo screenY.
+    tmpOriginX := originX.
+    tmpOriginY := originY.
+
+    origin x < screenX ifTrue:[
+        tmpOriginX := screenX. 
+    ].
+    origin y < screenY ifTrue:[
+        tmpOriginY := screenY. 
+    ].     
+
+    aView origin:tmpOriginX@tmpOriginY.
+    openAction value.
+    aView origin:origin.
+
+    "Created: / 28-11-2019 / 17:54:32 / Stefan Reise"
+! !
+
 !WinWorkstation class methodsFor:'private'!
 
 convertTargetValue:targetValue
@@ -20605,7 +20685,7 @@
     }
 %}
     "
-     (StandardSystemView new label:'äöü') open
+     (StandardSystemView new label:'äöü') open
     "
 !