--- a/DeviceWorkstation.st Fri Nov 22 10:43:26 2019 +0100
+++ b/DeviceWorkstation.st Fri Nov 22 10:43:40 2019 +0100
@@ -607,6 +607,33 @@
"Modified: / 20.1.1998 / 14:11:01 / stefan"
! !
+!DeviceWorkstation class methodsFor:'converting'!
+
+convertVirtualResolutionPointToCurrentResolutionPoint:aPoint
+ "this is required when you want to access the root display coordinates correctly,
+ because may windows did scale the application (when the app is not high DPI aware),
+ and if windows did scale the application, the application gets a virtual display
+ with a diffrent resolution"
+
+ "redefined for windows"
+
+ ^ aPoint
+
+ "Created: / 22-11-2019 / 10:09:36 / Stefan Reise"
+!
+
+convertVirtualResolutionRectangleToCurrentResolutionRectangle:aRectangle
+ "this is required when you want to access the root display coordinates correctly,
+ because may windows did scale the application (when the app is not high DPI aware),
+ and if windows did scale the application, the application gets a virtual display
+ with a diffrent resolution"
+
+ ^ (self convertVirtualResolutionPointToCurrentResolutionPoint:aRectangle origin)
+ corner:(self convertVirtualResolutionPointToCurrentResolutionPoint:aRectangle corner)
+
+ "Created: / 22-11-2019 / 10:10:29 / Stefan Reise"
+! !
+
!DeviceWorkstation class methodsFor:'defaults'!
defaultButtonPressTimeForMenu
@@ -886,31 +913,6 @@
"Modified: / 18.3.1999 / 18:20:39 / stefan"
!
-currentDisplayResolution
- "ONLY WINDOWS redfines this method
- here just return my known extent
-
- this is the current resolution of the display,
- without any effect of scaling
-
- for e.g.
- real current display resolution -> 1080p
- scaling 150%
- virtual display resolution -> 720p
-
- real current display resolution -> 1080p
- scaling 100%
- virtual display resolution -> 1080p"
-
- "
- self currentDisplayResolution
- "
-
- ^ Display extent
-
- "Created: / 15-11-2019 / 10:42:20 / Stefan Reise"
-!
-
currentWindow
"Return the currently active window,
that is, the topView of the currently executing windowGroup"
@@ -948,21 +950,6 @@
"
!
-displayScaleFactor
- "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 displayScaleFactor
- "
-
- ^ 1@1
-
- "Created: / 18-11-2019 / 14:52:37 / Stefan Reise"
-!
-
flushCachedLastScreen
LastActiveScreen := nil.
LastActiveProcess := nil.
@@ -997,20 +984,98 @@
^ #unknown
"Modified (comment): / 17-05-2017 / 18:25:06 / mawalch"
-!
-
-scaleFactorForRootDisplayCoordinates
- "this is the factor we need to adopt for the root display coordinates,
- if windows did scale the application (when the app is not high DPI aware)"
-
- "
- self scaleFactorForRootDisplayCoordinates
+! !
+
+!DeviceWorkstation class methodsFor:'queries - monitor'!
+
+currentResolutionForMonitorNamed:aMonitorDeviceName
+ "ONLY WINDOWS redfines this method
+ here just return my known extent
+
+ this is the current resolution of the display,
+ without any effect of scaling
+
+ for e.g.
+ real current display resolution -> 1080p
+ scaling 150%
+ virtual display resolution -> 720p
+
+ real current display resolution -> 1080p
+ scaling 100%
+ virtual display resolution -> 1080p"
+
+ "
+ self currentResolutionForMonitorNamed:'\\.\DISPLAY1'
+ self currentResolutionForMonitorNamed:'\\.\DISPLAY2'
+ "
+
+ ^ Display extent
+
+ "Created: / 21-11-2019 / 10:10:26 / Stefan Reise"
+!
+
+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: / 14-11-2019 / 13:43:12 / Stefan Reise"
- "Modified (comment): / 15-11-2019 / 10:23:45 / Stefan Reise"
+ "Created: / 21-11-2019 / 10:12:14 / Stefan Reise"
+!
+
+scaleFactorForRootViewTranslationOnMonitorNamed:aMonitorDeviceName
+ "redefined for windows
+ this is the scale factor, we have to use,
+ when we work directly with the root view (desktop)
+
+ because we may have a virtual display,
+ but the screen (from which we take a screenshot for e.g.)
+ does always have the current resoltion,
+ therefor we have to translate from virtual to current resolution"
+
+ "
+ self scaleFactorForRootViewTranslationOnMonitorNamed:'\\.\DISPLAY1'
+ self scaleFactorForRootViewTranslationOnMonitorNamed:'\\.\DISPLAY2'
+ "
+
+ ^ 1@1
+
+ "Created: / 21-11-2019 / 12:34:31 / Stefan Reise"
+ "Modified (comment): / 22-11-2019 / 10:05:25 / Stefan Reise"
! !
!DeviceWorkstation class methodsFor:'standalone setup'!
@@ -1030,40 +1095,6 @@
"Modified: 23.4.1996 / 22:01:28 / cg"
! !
-!DeviceWorkstation class methodsFor:'transformations'!
-
-transformVirtualDisplayPointToRootDisplayPoint:aPoint
- "this is required when you want to access the root display coordinates correctly,
- because may windows did scale the application (when the app is not high DPI aware),
- and if windows did scale the application, the application gets a virtual display
- with a diffrent resolution"
-
- ^ (aPoint * self scaleFactorForRootDisplayCoordinates) rounded
-
- "Created: / 15-11-2019 / 10:31:31 / Stefan Reise"
-!
-
-transformVirtualDisplayRectangleToRootDisplayRectangle:aRectangle
- "this is required when you want to access the root display coordinates correctly,
- because may windows did scale the application (when the app is not high DPI aware),
- and if windows did scale the application, the application gets a virtual display
- with a diffrent resolution"
-
- "ATTENTION:
- do not call #transformVirtualDisplayPointToRootDisplayPoint: 2 times here,
- because this would also call #scaleFactorForRootDisplayCoordinates 2 times,
- but the call #scaleFactorForRootDisplayCoordinates is a little expensive"
-
- |scaleFactorForRootDisplayCoordinates|
-
- scaleFactorForRootDisplayCoordinates := self scaleFactorForRootDisplayCoordinates.
-
- ^ (aRectangle origin * scaleFactorForRootDisplayCoordinates) rounded
- corner:(aRectangle corner * scaleFactorForRootDisplayCoordinates) rounded
-
- "Created: / 15-11-2019 / 10:22:38 / Stefan Reise"
-! !
-
!DeviceWorkstation methodsFor:'Compatibility-ST80'!
colorDepth
@@ -7031,7 +7062,7 @@
[:gc :rect |
gc
displayRectangle:(Screen
- transformVirtualDisplayRectangleToRootDisplayRectangle:rect).
+ convertVirtualResolutionRectangleToCurrentResolutionRectangle:rect).
].
root clippedByChildren:false.
@@ -7161,7 +7192,7 @@
"Created: / 24-07-1997 / 15:26:47 / cg"
"Modified: / 10-09-1998 / 17:38:41 / cg"
"Modified: / 23-02-2017 / 13:30:21 / stefan"
- "Modified: / 15-11-2019 / 10:26:36 / Stefan Reise"
+ "Modified: / 22-11-2019 / 10:10:50 / Stefan Reise"
!
topviewFromUser
@@ -7764,19 +7795,6 @@
focusWindowGroup := aWindowGroupOrNil
!
-monitorDeviceNameForView:aWindowId
- "given a window ID, 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"
-!
-
redrawAllWindows
self allViewsDo:[:eachView |
(eachView shown and:[eachView isRootView not]) ifTrue:[