On Wed, 1 Sep 2021 23:57:07 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:
>> It is seen in macos disabled JMenuItem arrow is not disabled even though >> JMenuItem itself is disabled. >> In native app, same menuitem arrow is disabled for disabled menuitem. >> >> Issue is when AquaMenuPainter#paintMenuItem() is called, it tries to draw a >> ImageIcon image of the arrow via ImageIcon#paintIcon which tries to generate >> MultiResolutionCachedImage via getResolutionVariant() by calling >> AquaUtils#generateFilteredImage. >> It does not take into account if disabled arrow icon image needs to be drawn >> or not, so it is always enabled. >> >> Proposed fix is to generate a disabled ImageIcon image of the same arrow >> icon and use it for disabled state. > > src/java.desktop/macosx/classes/com/apple/laf/AquaMenuPainter.java line 301: > >> 299: arrowIcon = new ImageIconUIResource(GrayFilter. >> 300: >> createDisabledImage(((ImageIcon)arrowIcon).getImage())); >> 301: } > > Maybe we do not need to duplicate LookAndFeel.getDisabledIcon() here and > create a new disabled icon on each call for each menu item? > What about tweak the aqua arrow icon, so it will paint itself correctly for > enabled/disabled states. Similar to how the MenuArrowIcon from the > WindowsLookAndFeel and MetalLookAndFeel works. In MenuArrowIcon, the arrow icon is drawn there itself using drawPolygon but in Aqua, it is drawn via imageicon image so it will be a change in design and will make it more complex and it might introduce bug in hidpi/retina. I will like to keep it simple following the current design in aqua. ------------- PR: https://git.openjdk.java.net/jdk/pull/5310