-
Notifications
You must be signed in to change notification settings - Fork 139
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
[win32] Refactor toolbar dpi callback #1364
[win32] Refactor toolbar dpi callback #1364
Conversation
4e266f6
to
5104b44
Compare
5104b44
to
530dc79
Compare
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.
I have not tested the proposal yet, but I have taken a first look at the code. So far, I only have minor comments.
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ImageList.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ImageList.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ImageList.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ImageList.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java
Outdated
Show resolved
Hide resolved
c3ea35b
to
09f2eb6
Compare
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 looks sound to me. I've also tested it (in combination with akoch-yatta/eclipse.platform.ui@384e390 to properly see effects on the main toolbar) and found it working fine.
@fedejeanne maybe you could also have a look since parts of the change slightly affect the behavior also when using existing HiDPI support, so it would be good to have an additional review.
This commit adds a method to receive handles for scaled variants of an ImageList for the specified zoom. All calls to the handle of an ImageList is replaced by the added method. Contributes to eclipse-platform#62 and eclipse-platform#131.
09f2eb6
to
577b77c
Compare
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.
LGTM, just 1 nit
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ImageList.java
Outdated
Show resolved
Hide resolved
This commit refactors the callback use for ToolBar and ToolItem after a DPI change in the win32 implementation. It makes use of the scalable ImageList to reuse the existing items in the toolbar and only resets the ImageList with a correctly scaled one. Due to the limitations of the win32 implementation all items must be removed and re-added via the win32-API to make shrinking of toolbars possible. Additionally, the commit removes the now unused callback in ToolItem Contributes to eclipse-platform#62 and eclipse-platform#131.
577b77c
to
ee0b8d7
Compare
This PR mainly is targeted on refactoring the existing callback for ToolBar and ToolItem after a DPI change in the win32 implementation.
To achieve that a method to scale an ImageList was added. Scaled variants of an image list are saved and reused similar to the other Resources.
The refactoring uses the scalable ImageLists to reuse the existing toolbar items and only resets the ImageList with a correctly scaled one. Due to the limitations of the win32 implementation all items must be removed and re-added via the win32-API to make shrinking of toolbars possible. Additionally, the commit removes the now unused callback in ToolItem.
All calls to the ImageList handle are replaced to use the added method.