Skip to content

Commit 42fcb47

Browse files
akoch-yattaHeikoKlare
authored andcommitted
[win32] Calculate zoom for adjustWindowRectEx via Shell
This commit moves the internal utility method Widget#adjustWindowRectEx to control to utilize Shell#getZoom if possible to define the target zoom. This is necessary if the control has its autoscaling disabled.
1 parent bc0f6ba commit 42fcb47

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6097,6 +6097,12 @@ void handleDPIChange(Event event, float scalingFactor) {
60976097
}
60986098
}
60996099

6100+
boolean adjustWindowRectEx(RECT lpRect, int dwStyle, boolean bMenu, int dwExStyle) {
6101+
Shell shell = getShell();
6102+
int zoom = shell != null ? shell.getZoom() : nativeZoom;
6103+
return OS.AdjustWindowRectExForDpi (lpRect, dwStyle, bMenu, dwExStyle, DPIUtil.mapZoomToDPI(zoom));
6104+
}
6105+
61006106
private static void resizeFont(Control control, int newZoom) {
61016107
Display display = control.getDisplay();
61026108
Font font = control.font;

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2711,9 +2711,4 @@ int getSystemMetrics(int nIndex) {
27112711
return OS.GetSystemMetricsForDpi(nIndex, DPIUtil.mapZoomToDPI(nativeZoom));
27122712
}
27132713

2714-
boolean adjustWindowRectEx(RECT lpRect, int dwStyle, boolean bMenu, int dwExStyle) {
2715-
return OS.AdjustWindowRectExForDpi (lpRect, dwStyle, bMenu, dwExStyle, DPIUtil.mapZoomToDPI(nativeZoom));
2716-
}
2717-
2718-
27192714
}

0 commit comments

Comments
 (0)