-
Bug
-
Resolution: Unresolved
-
P5
-
8, 11, 17, 21
-
windows
AwtMenu::AddItem in awt_Menu.cpp sets `flags` to `MF_STRING` which is overridden by `MF_OWNERDRAW` on the next line:
https://github.com/openjdk/jdk/blob/e087edeb256a9743d1fdb6c295cb5add78d4552e/src/java.desktop/windows/native/libawt/windows/awt_Menu.cpp#L212-L213
UINT flags = MF_STRING | (enabled ? MF_ENABLED : MF_GRAYED);
flags |= MF_OWNERDRAW;
This potential cleanup was found in code review [1][2] forJDK-8311113:
Because the value of MF_STRING is 0, it cannot be combined with MF_BITMAP or MF_OWNERDRAW. Thus the menu is a regular string menu if and only if neither MF_BITMAP or MF_OWNERDRAW are set, which is never true for AWT menus because MF_OWNERDRAW is always set.
The above holds true for the flags in MENUITEMINFOW structure.
[1] https://github.com/openjdk/jdk/pull/15276#issuecomment-1699846911
[2] https://github.com/openjdk/jdk/pull/15276#issuecomment-1700927944
https://github.com/openjdk/jdk/blob/e087edeb256a9743d1fdb6c295cb5add78d4552e/src/java.desktop/windows/native/libawt/windows/awt_Menu.cpp#L212-L213
UINT flags = MF_STRING | (enabled ? MF_ENABLED : MF_GRAYED);
flags |= MF_OWNERDRAW;
This potential cleanup was found in code review [1][2] for
Because the value of MF_STRING is 0, it cannot be combined with MF_BITMAP or MF_OWNERDRAW. Thus the menu is a regular string menu if and only if neither MF_BITMAP or MF_OWNERDRAW are set, which is never true for AWT menus because MF_OWNERDRAW is always set.
The above holds true for the flags in MENUITEMINFOW structure.
[1] https://github.com/openjdk/jdk/pull/15276#issuecomment-1699846911
[2] https://github.com/openjdk/jdk/pull/15276#issuecomment-1700927944
- relates to
-
JDK-8311113 Remove invalid pointer cast and clean up setLabel() in awt_MenuItem.cpp
- Resolved