-
Notifications
You must be signed in to change notification settings - Fork 227
Improve ImageBasedFrame scaling #3290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve ImageBasedFrame scaling #3290
Conversation
|
How does one test this? |
It's just an improvement in how it ImageBasedFrame implemenation for this case. I would expect ImageBasedFrame to behave the same as it does right now on master, with resize of Parent and on DPI change. |
HeikoKlare
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will now react to every resize event and on every OS with a relayouting of the parent and other adaptations to execute. Since this kind of adaptation only seems to be necessary on a DPI change, is that really the right thing to do? I would expect these adaptations to then be executed far too often.
Then please provide a snippet (or name an existing one) so that we can validate the behavior and see if your expectations are met :-) |
I agree. We can make this resize handler dependent on after ZoomChanged event. How do you like such idea? |
|
That would definitely be better. Couldn't even the |
ed0ded8 to
da8190d
Compare
Adapted the suggested change. |
@amartya4256 is the latest change as intended? My proposal was to keep the |
da8190d to
12ca9be
Compare
|
My bad, I pushed without adding the latest change ;D |
HeikoKlare
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change works fine for me. I only have minor comments.
bundles/org.eclipse.e4.ui.widgets/src/org/eclipse/e4/ui/widgets/ImageBasedFrame.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.e4.ui.widgets/src/org/eclipse/e4/ui/widgets/ImageBasedFrame.java
Outdated
Show resolved
Hide resolved
62e0987 to
8770526
Compare
8770526 to
b063676
Compare
b063676 to
0309086
Compare
This commit adapts ImageBasedFrame scaling to be triggered when it's parent recieves a resize event after ZoomChanged event on its wrapped control.
0309086 to
266df0d
Compare
With both Async and Sync DPI scaling, ImageBasedFrame scales itself on ZoomChanged event to pack the control to wrap in it. However, with the current approach of scaling on DPI_CHANGED it works fine as it only receives the event after the children have been resized. However, since ImageBasedFrame is a Control wrapped inside a Canvas, those widgets are already scaled implicitly and there's no need to pack them on ZoomChanged event but rather when a Resize event is received at the parent, allowing the ImageBasedFrame to only recalibrate its size when the parent is resizing.
This approach moves the responsibility of handling ZoomChanged event from outside SWT for ImageBasedFrame and also provides a possibility to scale it properly when the scaling is Async, i.e. the children might not have scaled when ZoomChanged is received.
###How to test
Simply A/B testing with master to check if the toolbar images scale properly since they are all wrapped in ImageBasedFrames, especially the perspective switcher in the top right.
Before:

After:

This PR improves the state of eclipse-platform/eclipse.platform.swt#2520, although not dependent on it. Must be merged before it.