WinWorkstation.st
branchexpecco_19_2_0
changeset 8907 4dba092535cc
parent 8906 ac2bce3f4f42
child 8918 fc1e63310a48
--- a/WinWorkstation.st	Thu Nov 28 13:16:54 2019 +0100
+++ b/WinWorkstation.st	Thu Nov 28 18:01:46 2019 +0100
@@ -11,7 +11,7 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
-'From Smalltalk/X, Version:7.2.0.0 on 28-11-2019 at 13:15:50'                   !
+'From Smalltalk/X, Version:7.2.0.0 on 28-11-2019 at 18:01:17'                   !
 
 "{ Package: 'stx:libview' }"
 
@@ -6630,6 +6630,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
@@ -8224,6 +8302,25 @@
     "Modified: / 22-11-2019 / 09:57:05 / Stefan Reise"
 !
 
+monitorInfoForView:aView
+    "answer the bounds of the monitor the point is contained in"
+
+    "
+        Display monitorInfoForView:Transcript topView          
+    "                
+
+    |monitorHandle|
+
+    monitorHandle := self monitorHandleForView:aView.
+    monitorHandle notNil ifTrue:[
+        ^ self monitorInfoFor:monitorHandle
+    ].
+
+    ^ nil
+
+    "Created: / 28-11-2019 / 17:27:47 / Stefan Reise"
+!
+
 monitorInfos
     ^ self monitorHandles 
         collect:[:eachMonitorHandle |