-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
19
-
windows
AwtTrayIcon::WmTaskbarCreated [1] handles the situation where Windows Taskbar is recreated. When an app receives this message, it should re-add all its notification icons.
On Windows 10, this message is also broadcast when the DPI of the main display changes. This situation is handled byJDK-8255439 which calls UpdateImage. This results in SendTrayMessage(NIM_MODIFY) being called, and it returns 1 which indicates success.
At the same time, SendTrayMessage(NIM_ADD) is still called, and it always returns 0 which indicates failure.
So the two cases should be handled separately: if DPI changed, call SendTrayMessage(NIM_MODIFY) only because the Taskbar still has the icon; otherwise call SendTrayMessage(NIM_ADD) to re-add the icon because the taskbar was re-created.
[1] https://github.com/openjdk/jdk/blob/1d8e92ae0d2d0d6740e2171abef45545439e6414/src/java.desktop/windows/native/libawt/windows/awt_TrayIcon.cpp#L477
On Windows 10, this message is also broadcast when the DPI of the main display changes. This situation is handled by
At the same time, SendTrayMessage(NIM_ADD) is still called, and it always returns 0 which indicates failure.
So the two cases should be handled separately: if DPI changed, call SendTrayMessage(NIM_MODIFY) only because the Taskbar still has the icon; otherwise call SendTrayMessage(NIM_ADD) to re-add the icon because the taskbar was re-created.
[1] https://github.com/openjdk/jdk/blob/1d8e92ae0d2d0d6740e2171abef45545439e6414/src/java.desktop/windows/native/libawt/windows/awt_TrayIcon.cpp#L477
- relates to
-
JDK-8286872 Refactor add/modify notification icon (TrayIcon)
- Resolved
-
JDK-8255439 System Tray icons get corrupted when Windows scaling changes
- Resolved
- links to