DeviceWorkstation.st
changeset 8889 b7105ad5bb18
parent 8886 eded150affe4
child 8892 1dcde2625bf9
--- a/DeviceWorkstation.st	Mon Nov 25 11:20:33 2019 +0100
+++ b/DeviceWorkstation.st	Mon Nov 25 12:26:52 2019 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
 COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
@@ -988,47 +990,29 @@
 
 !DeviceWorkstation class methodsFor:'queries - monitor'!
 
-monitorDeviceNameForPoint:aPoint
-    "given a point, return its monitor device name or nil if failed"
-    "implemented for windows only"
-
-    "
-        Screen current monitorDeviceNameForPoint:Transcript topView origin     
-    "          
-
-    ^ nil
-
-    "Created: / 21-11-2019 / 10:17:59 / Stefan Reise"
-!
-
-monitorDeviceNameForView:aView
-    "given a view, return its monitor device name or nil if failed"
-    "implemented for windows only"
-
-    "
-        Screen current monitorDeviceNameForView:Transcript topView id     
-    "          
-
-    ^ nil
-
-    "Created: / 20-11-2019 / 15:57:19 / Stefan Reise"
-    "Modified (comment): / 22-11-2019 / 10:04:54 / Stefan Reise"
-!
-
-scaleFactorForMonitorNamed:aMonitorDeviceName                 
-    "redefined for windows
-     this is the scale factor the user did enter within the windows settings,
-     for e.g. the user can choose between 100, 125, 150 etc.
-     here we return 1, 1.25 1.5"
-
-    "
-        self scaleFactorForMonitorNamed:'\\.\DISPLAY1'       
-        self scaleFactorForMonitorNamed:'\\.\DISPLAY2'      
-    "
-
-    ^ 1@1
-
-    "Created: / 21-11-2019 / 10:12:14 / Stefan Reise"
+monitorRealResolutionByPoint:aPoint
+    "this is the current resolution of the display,
+     without any effect of scaling
+
+     for e.g.
+        real resolution -> 1080p
+        scaling 150%
+        virtual resolution -> 720p
+
+        real resolution -> 1080p
+        scaling 100%
+        virtual resolution -> 1080p"         
+
+    "
+        Screen monitorRealResolutionByPoint:nil.     
+        Screen monitorRealResolutionByPoint:0@0.     
+        Screen monitorRealResolutionByPoint:500@0.       
+        Screen monitorRealResolutionByPoint:2000@0.      
+    "    
+
+    ^ Display extent
+
+    "Created: / 25-11-2019 / 12:19:03 / Stefan Reise"
 !
 
 scaleFactorForRootViewTranslationOnMonitorNamed:aMonitorDeviceName                 
@@ -1042,14 +1026,14 @@
      therefor we have to translate from virtual to current resolution"
 
     "
-        self scaleFactorForRootViewTranslationOnMonitorNamed:'\\.\DISPLAY1'          
-        self scaleFactorForRootViewTranslationOnMonitorNamed:'\\.\DISPLAY2'            
+        Screen scaleFactorForRootViewTranslationOnMonitorNamed:'\\.\DISPLAY1'.          
+        Screen scaleFactorForRootViewTranslationOnMonitorNamed:'\\.\DISPLAY2'.            
     "
 
     ^ 1@1
 
     "Created: / 21-11-2019 / 12:34:31 / Stefan Reise"
-    "Modified (comment): / 22-11-2019 / 10:05:25 / Stefan Reise"
+    "Modified (comment): / 25-11-2019 / 12:22:46 / Stefan Reise"
 ! !
 
 !DeviceWorkstation class methodsFor:'standalone setup'!
@@ -2325,6 +2309,22 @@
     isSlow := aBoolean
 !
 
+monitorScaleFactorFor:aMonitorHandle
+    "ATTENTION: this method always returns the scale factor set by os,
+     REGARDLESS if the application (stx, expecco) has a virtual resolution or not
+     use #scaleFactorForRootViewTranslationOnMonitorNamed: which is dependent on the 
+     application's (stx, expecco) high dpi awareness (if the application has a virtual 
+     resolution or not).
+
+     this is the scale factor the user did enter within the windows settings,
+     for e.g. the user can choose between 100, 125, 150 etc.
+     here we return 1, 1.25 1.5"
+
+    ^ 1@1
+
+    "Created: / 25-11-2019 / 11:56:20 / Stefan Reise"
+!
+
 monitorType
     "return a symbol representing the monitor type of the display.
      It is usually set to #unknown, #color or #monochrome.