-
Notifications
You must be signed in to change notification settings - Fork 150
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
Program icon scaling using DPI #1804
Program icon scaling using DPI #1804
Conversation
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.
As we have discussed, this seem to be the "right" short-term solution. I want to point out that we plan to work on replacing the call to SHGetFileInfo
in order to get rid of the returned icons being scaled according to initial primary monitor zoom.
Can you please adapt the commit message to state that this will actually fix
#1759 (as the usage of display causing the reported issue is completely removed)?
bundles/org.eclipse.swt/Eclipse SWT Program/win32/org/eclipse/swt/program/Program.java
Outdated
Show resolved
Hide resolved
6297c78
to
869fa19
Compare
Adapted both in the PR description and the commit message |
869fa19
to
5ad58b9
Compare
5ad58b9
to
a1ac77d
Compare
@@ -427,6 +427,13 @@ public ImageData getImageData (int zoom) { | |||
return imageData; | |||
} | |||
|
|||
private int getSystemWideDPI() { |
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.
..AtStartup ? This value doesn't change. Thats why we need to use it
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 thought so but SystemWideDPI is, I reckon implicable for System DPI-aware value. At least that's what I found by definition here: https://learn.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows#system-dpi-awareness
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.
My understanding is that the value we use here is equivalent to the DPI value when using "system DPI awareness", but we need to be aware that the we use here is the same throughout application lifecycle even when not using system DPI awareness, isn't it? I usually execute my runtime application directly with PerMonitorV2 and still this value is static.
Maybe we should not refer to any such predefined name but could instead also put the DPIUtil.mapDpiToZoom()
call inside this method an make the method do some getPrimaryMonitorZoomAtStartup()
and keep the documentation that SHGetFileInfo returns the icon scaled according to primary monitor zoom at startup? Then at least the given information is consistent and can be easily validated by anyone trying to understand the code.
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.
Fair enough. On it.
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.
Done
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.
Do you agree with this, @akoch-yatta?
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.
Yes, sure. I think, that should give the right expectation, what the method returns
a1ac77d
to
2756354
Compare
2756354
to
d684b15
Compare
This commit contributes to proper scaling of Program icons. Since these icons are retrieved by OS.SHGetFileInfo which is System DPI-Aware, it returns the icon with zoom level of the primary monitor at application startup. Hence, for initialNativeZoom of the Image object to be created for the icon, the zoom retrieved from the DPI is considered. Contributes to eclipse-platform#62 and eclipse-platform#127 Fixes eclipse-platform#1759
d684b15
to
d7120e1
Compare
This PR contributes to proper scaling of Program icon. Since, these icons are retrieved by OS.SHGetFileInfo which is System DPI-Aware, it returns the icon with zoom level of the primary monitor at application startup. Hence, for initialNativeZoom of the Image object to be created for the icon, the zoom retrieved from the DPI is considered.
contributes to #62 and #127
fixes #1759