From d3bb12adb93c320931ba862874e058f98dc84216 Mon Sep 17 00:00:00 2001 From: arunjose696 Date: Thu, 4 Dec 2025 10:13:18 +0100 Subject: [PATCH] Fix HiDPI progress icon clipping by relayouting only on image size change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows HiDPI screens, the progress icon in the status bar could appear clipped because Toolbars are initially created by windows with default button size (24×22). When larger images are set (e.g., 32×32 for 200% scaling), the toolbar resizes but the parent layout isn't updated due to deferred layout. This change adds a check to determine if the image size actually changed before requesting a relayout. The parent layout is now updated only when necessary, matching SWT's behavior for toolbar images and preventing unnecessary layouts while fixing the clipping issue. --- .../ui/internal/progress/ProgressAnimationItem.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/progress/ProgressAnimationItem.java b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/progress/ProgressAnimationItem.java index c9803dfb245..f3484bedfb9 100644 --- a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/progress/ProgressAnimationItem.java +++ b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/progress/ProgressAnimationItem.java @@ -260,11 +260,21 @@ private void refresh() { toolbar.setVisible(false); } + boolean isImageSizeChanged(Image oldImage, Image image) { + boolean changed = true; + // check if image size really changed for old and new images + if (oldImage != null && !oldImage.isDisposed() && image != null && !image.isDisposed()) { + changed = !oldImage.getBounds().equals(image.getBounds()); + } + return changed; + } + private void initButton(Image im, final String tt) { + boolean isLayoutRequired = isImageSizeChanged(im, toolButton.getImage()); toolButton.setImage(im); toolButton.setToolTipText(tt); toolbar.setVisible(true); - toolbar.getParent().requestLayout(); // must layout + toolbar.getParent().layout(isLayoutRequired); if (currentAccessibleListener != null) { toolbar.getAccessible().removeAccessibleListener(currentAccessibleListener);