From 661396e9a680ce72cb6f7cbbed992693f28bd46e Mon Sep 17 00:00:00 2001 From: Shahzaib Ibrahim Date: Wed, 6 Nov 2024 14:54:01 +0100 Subject: [PATCH] Correctly reposition items of ExpandBar during DPI change When using the monitor-specific rescaling functionality on Windows, moving a shell between monitors with different zoom levels (no matter which zoom levels they are), the images, expand items and texts are not drawn at correct coordinates. This change fixes the behavior to perform an appropriate layout update of the ExpandBar. --- .../Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java | 1 + .../Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java index 60cdfccc0f5..6185d628325 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java @@ -878,6 +878,7 @@ private static void handleDPIChange(Widget widget, int newZoom, float scalingFac for (ExpandItem item : expandBar.getItems()) { DPIZoomChangeRegistry.applyChange(item, newZoom, scalingFactor); } + expandBar.layoutItems(0, true); expandBar.redraw(); } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java index 4b98353244d..e6d9a4f8055 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java @@ -539,7 +539,7 @@ private static void handleDPIChange(Widget widget, int newZoom, float scalingFac if (item.height != 0 || item.width != 0) { int newWidth = Math.round(item.width * scalingFactor); int newHeight = Math.round(item.height * scalingFactor); - item.setBoundsInPixels(item.x, item.y, newWidth, newHeight, false, true); + item.setBoundsInPixels(item.x, item.y, newWidth, newHeight, true, true); } } }