From 1824ac7a8d2d75fc079209076882f78b0d5baf26 Mon Sep 17 00:00:00 2001 From: Andreas Koch Date: Thu, 17 Apr 2025 14:59:04 +0200 Subject: [PATCH] Fix for runWithAutoScaleValue This commit addresses and issue with DPIUtil#runWithAutoScaleValue. It only adapted DPIUtil#autoScaleValue temporarily. As DPIUtil#deviceZoom is directly affected by autoScaleValue, it is important to adjust it temporarily as well. fixes https://github.com/eclipse-platform/eclipse.platform.ui/issues/2897 --- .../Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java index 11537f334d6..5f1dd60f7af 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/DPIUtil.java @@ -667,10 +667,12 @@ private static int getZoomForAutoscaleProperty (int nativeDeviceZoom, String aut public static void runWithAutoScaleValue(String autoScaleValue, Runnable runnable) { String initialAutoScaleValue = DPIUtil.autoScaleValue; DPIUtil.autoScaleValue = autoScaleValue; + DPIUtil.deviceZoom = getZoomForAutoscaleProperty(nativeDeviceZoom); try { runnable.run(); } finally { DPIUtil.autoScaleValue = initialAutoScaleValue; + DPIUtil.deviceZoom = getZoomForAutoscaleProperty(nativeDeviceZoom); } }