Skip to content

Commit 32d98a1

Browse files
arunjose696akoch-yatta
authored andcommitted
Fix HiDPI progress icon clipping by relayouting only on image size change
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.
1 parent b4b98c6 commit 32d98a1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/progress/ProgressAnimationItem.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,21 @@ private void refresh() {
260260
toolbar.setVisible(false);
261261
}
262262

263+
boolean isImageSizeChanged(Image oldImage, Image image) {
264+
boolean changed = true;
265+
// check if image size really changed for old and new images
266+
if (oldImage != null && !oldImage.isDisposed() && image != null && !image.isDisposed()) {
267+
changed = !oldImage.getBounds().equals(image.getBounds());
268+
}
269+
return changed;
270+
}
271+
263272
private void initButton(Image im, final String tt) {
273+
boolean isLayoutRequired = isImageSizeChanged(im, toolButton.getImage());
264274
toolButton.setImage(im);
265275
toolButton.setToolTipText(tt);
266276
toolbar.setVisible(true);
267-
toolbar.getParent().requestLayout(); // must layout
277+
toolbar.getParent().layout(isLayoutRequired);
268278

269279
if (currentAccessibleListener != null) {
270280
toolbar.getAccessible().removeAccessibleListener(currentAccessibleListener);

0 commit comments

Comments
 (0)