--- a/WinWorkstation.st Tue Nov 26 16:31:16 2019 +0100
+++ b/WinWorkstation.st Tue Nov 26 16:57:44 2019 +0100
@@ -6843,16 +6843,11 @@
here we return 1, 1.25 1.5"
"
- Screen monitorScaleFactorFor:(Display monitorHandleForName:'\\.\DISPLAY1').
- Screen monitorScaleFactorFor:(Display monitorHandleForName:'\\.\DISPLAY2').
- "
-
- |sx|
-
- (aMonitorHandle isNil
- or:[aMonitorHandle isExternalAddress not]) ifTrue:[
- ^ super monitorScaleFactorFor:aMonitorHandle
- ].
+ Screen monitorScaleFactorFor:(Display monitorHandleForName:'\\.\DISPLAY1').
+ Screen monitorScaleFactorFor:(Display monitorHandleForName:'\\.\DISPLAY2').
+ "
+
+ |scaleFactor|
%{
if (__isExternalAddress(aMonitorHandle)) {
@@ -6860,20 +6855,20 @@
HINSTANCE hShcore = LoadLibrary("Shcore.dll");
if (hShcore) {
- static HRESULT (__stdcall *P_GetDpiForMonitor)(HMONITOR, DWORD, UINT*, UINT*);
- P_GetDpiForMonitor = (HRESULT (__stdcall *)(HMONITOR, DWORD, UINT*, UINT*))GetProcAddress(hShcore, "GetDpiForMonitor");
-
- if (P_GetDpiForMonitor) {
- UINT x = 0;
- UINT y = 0;
-
- if ((*P_GetDpiForMonitor)(hMonitor, 0, &x, &y) == S_OK) {
- sx = __MKSMALLINT(x);
+ static HRESULT (__stdcall *P_GetScaleFactorForMonitor)(HMONITOR, VOID*);
+ P_GetScaleFactorForMonitor = (HRESULT (__stdcall *)(HMONITOR, VOID*))GetProcAddress(hShcore, "GetScaleFactorForMonitor");
+
+ if (P_GetScaleFactorForMonitor) {
+ UINT displayScaleFactor;
+
+
+ if ((*P_GetScaleFactorForMonitor)(hMonitor, &displayScaleFactor) == S_OK) {
+ scaleFactor = __MKSMALLINT(displayScaleFactor);
} else {
- printf("Call \"GetDpiForMonitor()\" failed\n");
+ printf("Call \"GetScaleFactorForMonitor()\" failed\n");
};
} else {
- printf("Loading \"GetDpiForMonitor()\" failed\n");
+ printf("Loading \"GetScaleFactorForMonitor()\" failed\n");
}
} else {
printf("Loading \"Shcore.dll\" failed\n");
@@ -6881,14 +6876,17 @@
}
%}.
- (sx isNil
- or:[sx == 0]) ifTrue:[
+ scaleFactor isNil ifTrue:[
+ ^ super monitorScaleFactorFor:aMonitorHandle
+ ].
+ scaleFactor == 0 ifTrue:[
^ super monitorScaleFactorFor:aMonitorHandle
].
- ^ sx / 96
+ ^ scaleFactor / 100
+
"Created: / 25-11-2019 / 11:52:42 / Stefan Reise"
- "Modified (comment): / 25-11-2019 / 14:26:07 / Stefan Reise"
+ "Modified: / 26-11-2019 / 16:43:02 / Stefan Reise"
!
thisAppVirtualResolutionByMonitorDeviceName:aMonitorDeviceName