RFR: JDK-8255439: System Tray icons get corrupted when windows scaling changes [v3]

Alexey Ivanov aivanov at openjdk.java.net
Tue May 10 17:46:52 UTC 2022


On Sun, 8 May 2022 19:36:33 GMT, Harshitha Onkar <duke at openjdk.java.net> wrote:

>> In Windows, when desktop scaling is changed the tray icons was distorted/blurred a bit each time scaling changes.
>> 
>> With the proposed fix, the tray icon scales according to on-the-fly DPI scale settings. A test case has been added which adds a MRI icon to system tray, to observe the icon scaling when DPI is changed. Since the scale cannot be programmatically changed (for dynamic on-the-fly scale changes), I have used a manual test case to test this scenario.
>> 
>> When DPI changes usually two messages are sent by windows -
>> 
>> - [WM_DPICHANGED](https://docs.microsoft.com/en-us/windows/win32/hidpi/wm-dpichanged)
>> - [WMPOSCHANGING](https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-windowposchanging)
>> 
>> I'm triggering an update on tray icons on receiving WMPOSCHANGING msg through the Tray icon's Window Procedure. Triggering an update on WM_DPICHANGED was still causing the icons to be distorted, hence WMPOSCHANGING is being used as the message to trigger the update.
>
> Harshitha Onkar has updated the pull request incrementally with one additional commit since the last revision:
> 
>   formatting changes

Unfortunately, the icon is distorted on Windows 11. When I tested on Windows 10, it updates correctly most of the time, but rarely the icon becomes distorted. When the icon is distorted, enabling taskbar auto-hide and disabling it repaints the icon correctly; this works both on Windows 10 and 11.

![Tray Icon 125% -> 150%](https://user-images.githubusercontent.com/70774172/167689269-2d41884a-a5cd-4cb5-b3b5-21b02f0f46b5.png)
I got the above image on Windows 10 after switching from 125% to 150%. The icon should display 24 at 150%, one can see the number with some paint artefacts.

I don't understand why it happens this way.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8441



More information about the client-libs-dev mailing list