RFR: 8286872: Refactor add/modify notification icon (TrayIcon) [v4]

Alexander Zvegintsev azvegint at openjdk.java.net
Thu May 19 15:28:43 UTC 2022


On Thu, 19 May 2022 08:23:16 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Encapsulate the logic of adding or modifying a notification icon aka tray icon. This is to avoid code duplication between [`AwtTrayIcon::WmTaskbarCreated`](https://github.com/openjdk/jdk/blob/7b988b31c661c6e3e58cf8ced81732e40a79d4f5/src/java.desktop/windows/native/libawt/windows/awt_TrayIcon.cpp#L477) and [`AwtTrayIcon::_UpdateIcon`](https://github.com/openjdk/jdk/blob/7b988b31c661c6e3e58cf8ced81732e40a79d4f5/src/java.desktop/windows/native/libawt/windows/awt_TrayIcon.cpp#L796).
>> 
>> Separating adding and modifying the icon simplifies the methods, the actions are clearer: adding the icon requires sending `NIM_SETVERSION` message whereas modifying the icon doesn't.
>> 
>> To verify the code works as before, I used `TrayIconScalingTest.java`. I killed explorer.exe process to verify the notification icon gets added. Changing DPI of the main display updates the displayed icon as expected.
>
> Alexey Ivanov has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 18 commits:
> 
>  - Merge master
>  - Inline AddTrayIcon and ModifyTrayIcon
>  - Make SendTrayMessage private - it's used internally only
>  - 8286872: Replace SendTrayMessage(NIM_MODIFY) with ModifyTrayIcon()
>  - 8286872: Refactor add/modify notification icon (TrayIcon)
>  - renamed method id variable
>  - added ExceptionClear, fixed CI debug build issue
>  - Merge branch 'master' into WinTrayIcon
>  - reverted SystemTray changes
>  - new changes - trayicon update triggered in WmTaskbarCreated
>  - ... and 8 more: https://git.openjdk.java.net/jdk/compare/fc3edf24...44d20dc5

Still looks good.

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

Marked as reviewed by azvegint (Reviewer).

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



More information about the client-libs-dev mailing list