Skip to content

Commit 44f830b

Browse files
committed
Scale IBF on shell:resize after async ZoomChanged
This commit adapts ImageBasedFrame scaling to be triggered when it's Shell recieves a resize event after ZoomChanged event on its wrapped control. This will correct an inconsistent refresh when the ZoomChanged events are handled asynchronously.
1 parent a13de75 commit 44f830b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bundles/org.eclipse.e4.ui.widgets/src/org/eclipse/e4/ui/widgets/ImageBasedFrame.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.eclipse.swt.widgets.Composite;
2828
import org.eclipse.swt.widgets.Control;
2929
import org.eclipse.swt.widgets.Listener;
30+
import org.eclipse.swt.widgets.Shell;
3031
import org.eclipse.swt.widgets.ToolBar;
3132

3233

@@ -71,6 +72,7 @@ public ImageBasedFrame(Composite parent, Control toWrap, boolean vertical,
7172
});
7273

7374
toWrap.addListener(SWT.ZoomChanged, event -> {
75+
Shell shell = parent.getShell();
7476
final AtomicReference<Listener> scaleOnParentResize = new AtomicReference<>();
7577
scaleOnParentResize.set(e -> {
7678
if (isDisposed()) {
@@ -79,9 +81,9 @@ public ImageBasedFrame(Composite parent, Control toWrap, boolean vertical,
7981
toWrap.pack(true);
8082
setFramedControlLocation();
8183
parent.layout();
82-
parent.removeListener(SWT.Resize, scaleOnParentResize.get());
84+
shell.removeListener(SWT.Resize, scaleOnParentResize.get());
8385
});
84-
parent.addListener(SWT.Resize, scaleOnParentResize.get());
86+
shell.addListener(SWT.Resize, scaleOnParentResize.get());
8587
});
8688

8789
addMouseMoveListener(e -> {

0 commit comments

Comments
 (0)