Skip to content

Commit 2a90850

Browse files
committed
WIP
1 parent a0a0485 commit 2a90850

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public abstract class Control extends Widget implements Drawable {
8181
Region region;
8282
Font font;
8383
int drawCount, foreground, background, backgroundAlpha = 255;
84+
boolean isDpiChangeHandlingNeeded = true;
8485

8586
/**
8687
* Prevents uninitialized instances from being created outside the package.
@@ -4946,9 +4947,12 @@ LRESULT WM_DPICHANGED (long wParam, long lParam) {
49464947
float scalingFactor = 1f * DPIUtil.getZoomForAutoscaleProperty(newNativeZoom) / DPIUtil.getZoomForAutoscaleProperty(oldNativeZoom);
49474948
DPIZoomChangeRegistry.applyChange(this, newNativeZoom, scalingFactor);
49484949

4949-
RECT rect = new RECT ();
4950-
COM.MoveMemory(rect, lParam, RECT.sizeof);
4951-
this.setBoundsInPixels(rect.left, rect.top, rect.right - rect.left, rect.bottom-rect.top);
4950+
if (isDpiChangeHandlingNeeded) {
4951+
RECT rect = new RECT ();
4952+
COM.MoveMemory(rect, lParam, RECT.sizeof);
4953+
this.setBoundsInPixels(rect.left, rect.top, rect.right - rect.left, rect.bottom-rect.top);
4954+
}
4955+
isDpiChangeHandlingNeeded = true;
49524956
return LRESULT.ZERO;
49534957
}
49544958
} else {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,6 +1596,7 @@ public void setBounds(Rectangle rect) {
15961596
if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
15971597
checkWidget ();
15981598
Rectangle boundsInPixels = getDisplay().translateToDisplayCoordinates(rect, getZoom());
1599+
isDpiChangeHandlingNeeded = false;
15991600
setBoundsInPixels(boundsInPixels.x, boundsInPixels.y, boundsInPixels.width, boundsInPixels.height);
16001601
}
16011602

0 commit comments

Comments
 (0)