-
Notifications
You must be signed in to change notification settings - Fork 0
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
Incorrect scaling of program icons #186
Incorrect scaling of program icons #186
Comments
Can you tell me what is the zoom of your primary monitor? Since the retrieved size of the program icons before scaling is related to primary monitor zoom, it might be important to know that too. |
Primary monitor zoom is according to the described workflow. The workflow just assumes/requires a single monitor. |
Please also consider this issue here, as there might be a common solution for both issues: |
On debugging Program::getImageData, I found that OS.SHGetFileInfo gets the size 16 x 16 for 150% , which is 12 x 12 for 100% which is not the standard icon size here, hence where it is expected to haev 24 x 24 size on 150%, it is scaled to 16 x 16, leading to a smaller appearance. Since, OS.SHGetFileInfo gets the image and its size based on the zoom of primary monitor, it might be an issue related to the call itself. I also tried to perform the same on non-primary monitor; there it seems to work fine. |
Isn't this actually about OS.SHGetFileInfo returning the size according to the primary monitor zoom at application startup? So if you start the application at 100%, it will always return 16x16 for an icon, no matter how the different zooms of the different monitors (including the primary monitor) change. That would call for a replacement of using OS.SHGetFileInfo or maybe the usage of Device#getDPI(). |
I found out that SHGetFileInfo is a System DPI aware call. Which means it only returns the icon for the DPI at the application startup. There's no alterantive available for per monitor DPI aware functions at the moment like GetSystemMetricsForDpi for GetSystemMetrics, etc. However, we can either
I am going to explore both the possibilities to analyze which could be an optimal solution in our case. |
Might we make a two-step process?
|
I agree with you. I have a problem with varying value of getDPI here. Here's the outcome of the investigation using the first approach: If I start my IDE at 200% monitor with a primary monitor (PM) at 100% zoom. Then the DPI of the PM is 96 which maps to 100% but meanwhile if I change the PM to 150% then call getDPI again, the dpi is 64 which is 67% zoom which should not be the case. Does getDPI behave in a system DPI aware manner? |
I see the problem with getDPI now:
it returns a scaled down value. Thus in the consumer, I need to scale it up with getDeviceZoom which I think is a bad idea. The question is, why are we scaling it down with getDeviceZoom in getDpi in the first place. I tested out using just dpiX value, it is always concrete and doesnt change with the monitor zoom change. |
Exactly. We do the scaling as it has always been done like this and consumers rely on it (remember the regression we had in the 2024-12 release). Scaling up the value returned by |
Yeah i completely didnt see _getDPIX(). However, it is package protected. So we need a way to access the unscaled DPI value. |
Yes the logic would be now based on this system-wide DPI value since there's a direct relation between OS.SHGetFileInfo. My proposal is that after a quick fix, we can look out for a better way of retreiving the program icons. |
One way could be to Do it like this:
But it adds a boilerplate to the existing _getDPIX logic |
You mean to add that code to the |
Yes i simplified it a bit. Now we don't need the display instance at all. This would also fix: eclipse-platform/eclipse.platform.swt#1759 |
Under specific conditions, program icons are not scaled correct.
E.g., do the following:
-Dswt.autoScale.updateOnRuntime=true
You will see that the program icons are scaled according to the original zoom rather than the current one:
The text was updated successfully, but these errors were encountered: