From 110656059c4d6c56caf69a23d4574d9f235fa377 Mon Sep 17 00:00:00 2001 From: Kuba3105 Date: Wed, 3 Jul 2024 13:19:05 +0200 Subject: [PATCH] Scale up magic number in Button Use DPIUtil Contributes to https://github.com/vi-eclipse/Eclipse-Platform/issues/72 --- .../Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java index 30134a9c282..08d97c8b443 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java @@ -361,10 +361,10 @@ else if ((style & SWT.RIGHT) != 0) { Rectangle rect = DPIUtil.scaleBounds(image.getBounds(), this.getZoom(), 100); width = rect.width; if (hasText && text.length () != 0) { - width += MARGIN * 2; + width += DPIUtil.scaleUp(MARGIN * 2, getZoom());; } height = rect.height; - extra = MARGIN * 2; + extra = DPIUtil.scaleUp(MARGIN * 2, getZoom());; } } if (hasText) { @@ -378,7 +378,7 @@ else if ((style & SWT.RIGHT) != 0) { if (length == 0) { height = Math.max (height, lptm.tmHeight); } else { - extra = Math.max (MARGIN * 2, lptm.tmAveCharWidth); + extra = Math.max (DPIUtil.scaleUp(MARGIN * 2, getZoom()), lptm.tmAveCharWidth); char [] buffer = text.toCharArray (); RECT rect = new RECT (); int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE;