RFR: JDK-8305645: System Tray icons get corrupted when Windows primary monitor changes

Harshitha Onkar honkar at openjdk.org
Wed Jun 7 19:14:29 UTC 2023


There are two scenarios related to tray icon distortion.

1. Single Screen - when DPI / Scale is changed on the fly - this was resolved as part of [PR#8441](https://github.com/openjdk/jdk/pull/8441)

2. Multi Screen - when screens are set to different scales and the primary display is toggled. This is a variation of scenario one. 

Earlier Windows msg - [WM_DPICHANGED](https://learn.microsoft.com/en-us/windows/win32/hidpi/wm-dpichanged) was being used to update the tray icons. This message is sent when window DPI changes. WM_DPICHANGED msg is not received when taskbar switches to primary display under multiple screen scenario, hence the tray icon was still seen distorted in case 2.
 
As [WM_DISPLAYCHANGE](https://learn.microsoft.com/en-us/windows/win32/gdi/wm-displaychange) is received in both cases, it is used as the new message to trigger tray icon update. This message also works when the main display monitor gets disconnected accidently making the other display the primary display.

TrayIconScalingTest's  instructions have been updated to include both the cases described above.

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

Commit messages:
 - year updated
 - fix for tray icon

Changes: https://git.openjdk.org/jdk/pull/14368/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14368&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8305645
  Stats: 16 lines in 2 files changed: 7 ins; 0 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/14368.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14368/head:pull/14368

PR: https://git.openjdk.org/jdk/pull/14368



More information about the client-libs-dev mailing list