On Sat, 7 May 2022 13:01:53 GMT, Kevin Rushforth <k...@openjdk.org> wrote:
>> Harshitha Onkar has updated the pull request incrementally with one >> additional commit since the last revision: >> >> resized instruction window and formatted line lengths > > The fix looks good to me, but someone more familiar with the code will need > to review it. I can confirm that the new test program fails without the fix > and passes with the fix. One problem with the test is that it doesn't exit > for me, regardless of whether the test passes or fails (or times out). > > To partially answer Sergey's question, the problem with just using > `WM_DPICHANGED` to trigger the update is that the scale of the default screen > transform used by `WTrayIconPeer::updateNativeImage` hasn't yet been updated > to reflect that new DPI scale. I don't know _why_ that is the case here, but > it is. I do know that in JavaFX we stopped relying on `WM_DPICHANGED` for > anything related to HiDPI several years ago when fixing some multi-monitor > HiDPI issues in > [JDK-8146920](https://bugs.openjdk.java.net/browse/JDK-8146920). > > To show that triggering the update on `WM_DPICHANGED` is insufficient, I > applied the patch from this PR, added some debugging output, and modified the > fix to also update the image on a `WM_DPICHANGED` event. Here is the output > when I start the program with a screen scale of 1.25 and then change it to > 1.5: > > > WM_WINDOWPOSCHANGING > AwtTrayIcon::UpdateTrayIconHandler > SystemTray::updateTrayIcons > WTrayIconPeer::updateNativeImage : scale = (1.25, 1.25) > WM_DPICHANGED > AwtTrayIcon::UpdateTrayIconHandler > SystemTray::updateTrayIcons > WM_WINDOWPOSCHANGING > AwtTrayIcon::UpdateTrayIconHandler > SystemTray::updateTrayIcons > WTrayIconPeer::updateNativeImage : scale = (1.25, 1.25) <----- This is from > the WM_DPICHANGED event > WTrayIconPeer::updateNativeImage : scale = (1.25, 1.25) > WM_WINDOWPOSCHANGING > AwtTrayIcon::UpdateTrayIconHandler > SystemTray::updateTrayIcons > WTrayIconPeer::updateNativeImage : scale = (1.5, 1.5) <----- Transform has > now been updated > WM_WINDOWPOSCHANGING > AwtTrayIcon::UpdateTrayIconHandler > SystemTray::updateTrayIcons > WTrayIconPeer::updateNativeImage : scale = (1.5, 1.5) > WM_WINDOWPOSCHANGING > AwtTrayIcon::UpdateTrayIconHandler > SystemTray::updateTrayIcons > WTrayIconPeer::updateNativeImage : scale = (1.5, 1.5) > > > So I think the fix using `WM_WINDOWPOSCHANGING` to trigger the update is > good. I left a couple minor comments inline. @kevinrushforth Thank you for taking time to look into the fix and providing informative feedback. I'll check the test case exit issues and add the suggested changes. ------------- PR: https://git.openjdk.java.net/jdk/pull/8441