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

Harshitha Onkar duke at openjdk.java.net
Thu Apr 28 15:26:10 UTC 2022


In Windows when desktop scaling was 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.

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

Commit messages:
 - removed whitespaces error due to CRLF
 - removed whitespace error
 - added manual to test case
 - trayicon changes

Changes: https://git.openjdk.java.net/jdk/pull/8441/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8441&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8255439
  Stats: 177 lines in 5 files changed: 172 ins; 1 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8441.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8441/head:pull/8441

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



More information about the client-libs-dev mailing list