From 2dc97c59b813978425b0ad8bd88ab028e33e67f9 Mon Sep 17 00:00:00 2001 From: Amartya Parijat Date: Thu, 16 Jan 2025 13:08:11 +0100 Subject: [PATCH] Fixed Shell::setBounds scaling This commit contributes to the correct scaling of the Shell using its own zoom on Shell::setBounds call as the scaling of the shell in case of a monitor change is directly handled by the DPI_CHANGED event. contributes to #62 and #127 --- .../Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java index 26a0a2d9951..108e948da44 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java @@ -1595,8 +1595,8 @@ public void setLocation(int x, int y) { public void setBounds(Rectangle rect) { if (rect == null) error (SWT.ERROR_NULL_ARGUMENT); checkWidget (); - Rectangle boundsInPixels = getDisplay().translateToDisplayCoordinates(rect, getZoom()); - setBoundsInPixels(boundsInPixels.x, boundsInPixels.y, boundsInPixels.width, boundsInPixels.height); + Point topLeftInPixels = getDisplay().translateToDisplayCoordinates(new Point(rect.x, rect.y), getZoom()); + setBoundsInPixels(topLeftInPixels.x, topLeftInPixels.y, DPIUtil.scaleUp(rect.width, getZoom()), DPIUtil.scaleUp(rect.height, getZoom())); } @Override