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

Alexey Ivanov aivanov at openjdk.org
Fri Jun 9 10:43:43 UTC 2023


On Wed, 7 Jun 2023 19:05:56 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

> 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 used to set `m_bDPIChanged` which is used within  `AwtTrayIcon::WmTaskbarCreated()` 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 update `m_bDPIChanged`. 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.

Marked as reviewed by aivanov (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/14368#pullrequestreview-1471704243



More information about the client-libs-dev mailing list