Skip to content

Commit 75ebdf5

Browse files
committed
Only redraw once after scaling every widget #62
This commit contributes to reducing the number of redraws and only draw once all the widgets have performed scaling using their Widget:handleDpiChange handlers. contributes to #62 and #128
1 parent 3bcbb47 commit 75ebdf5

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1984,6 +1984,5 @@ private static void handleDPIChange(Widget widget, int newZoom, float scalingFac
19841984
for (Control child : composite.getChildren()) {
19851985
DPIZoomChangeRegistry.applyChange(child, newZoom, scalingFactor);
19861986
}
1987-
composite.redrawInPixels (null, true);
19881987
}
19891988
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4764,6 +4764,7 @@ public boolean setParent (Composite parent) {
47644764
int newZoom = parent.nativeZoom;
47654765
float scalingFactor = 1f * newZoom / oldZoom;
47664766
DPIZoomChangeRegistry.applyChange(this, newZoom, scalingFactor);
4767+
getShell().WM_SIZE(0, 0);
47674768
}
47684769
int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE;
47694770
OS.SetWindowPos (topHandle, OS.HWND_BOTTOM, 0, 0, 0, 0, flags);
@@ -4961,6 +4962,7 @@ void handleMonitorSpecificDpiChange(int newNativeZoom, Rectangle newBoundsInPixe
49614962
DPIUtil.setDeviceZoom (newNativeZoom);
49624963
DPIZoomChangeRegistry.applyChange(this, newNativeZoom, scalingFactor);
49634964
this.setBoundsInPixels(newBoundsInPixels.x, newBoundsInPixels.y, newBoundsInPixels.width, newBoundsInPixels.height);
4965+
getShell().WM_SIZE(0, 0);
49644966
}
49654967

49664968
LRESULT WM_DPICHANGED (long wParam, long lParam) {

0 commit comments

Comments
 (0)