Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8340551

Remove MF_STRING from AwtMenu::AddItem

XMLWordPrintable

      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] for JDK-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

            aivanov Alexey Ivanov
            aivanov Alexey Ivanov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: