On Fri, 29 Apr 2022 00:36:15 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:
>> 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. > > Did you have a chance to check why the WM_DPICHANGED does not work, any > specific cases? It is used by checking the scale change for windows in AWT, > and no issues were reported for that as far as I know. @mrserb I wanted to add few more details about various window messages received during DPI changes. The order in which messages are received- 1. WM_DPICHANGED - if update is triggered at this point, the tray icons get distorted 2. WM_POSCHANGING - if update is triggered at this point, tray icons are rendered without any distortion. 3. WM_POSCHANGED - message received when tray icon is removed or exited. Kevin (@kevinrushforth) mentioned the usage of `WM_WINDOWPOSCHANGING` in JavaFX. Adding him to this PR conversation for suggestions. ------------- PR: https://git.openjdk.java.net/jdk/pull/8441