On Fri, 5 Aug 2022 17:34:00 GMT, Phil Race <[email protected]> wrote:

>> Issue is Arrow in submenu with empty title have a wrong position in Aqua L&F 
>> as can be seen
>> 
>> <img width="94" alt="image" 
>> src="https://user-images.githubusercontent.com/43534309/183023538-de8e51b4-31e6-45d7-b2bd-35da5e29c1e8.png";>
>> 
>> 
>> which is because the text being null/empty, `labelR` rectangle width/height 
>> is 0 so arrowIcon y coordinate becomes -ve as per the calculation in 
>> layoutMenuItem(). Although it seems logical to me to not show the arrow if 
>> submenu text is null, but
>> whereas for other L&F, it is shown as this 
>> for Metal
>> <img width="83" alt="image" 
>> src="https://user-images.githubusercontent.com/43534309/183022436-d9e8ebf1-98de-4cf6-bf43-3713357846e5.png";>
>> 
>> for Nimbus
>> <img width="77" alt="image" 
>> src="https://user-images.githubusercontent.com/43534309/183022730-35d170b2-71c6-4231-9a03-880107dc49c6.png";>
>> 
>> so the fix is made in Aqua L&F to show as other L&F as
>> <img width="92" alt="image" 
>> src="https://user-images.githubusercontent.com/43534309/183023030-7356086d-957c-4e0d-bd52-bdf3493a96b0.png";>
>
> src/java.desktop/macosx/classes/com/apple/laf/AquaMenuPainter.java line 498:
> 
>> 496:             //    else hierRect.left = hierRect.right - w - 4;
>> 497: 
>> 498:             arrowIconR.x = Math.abs((viewR.width - arrowIconR.width) + 
>> 1);
> 
> May I take it that you verified this doesn't have any adverse effects on 
> submenus with text :?

Yes, with fix it is
<img width="120" alt="Screenshot 2022-08-08 at 9 46 02 AM" 
src="https://user-images.githubusercontent.com/43534309/183338104-3df28849-1557-4c65-b22c-2f0db7ec8755.png";>

whereas without fix it is
<img width="120" alt="Screenshot 2022-08-08 at 9 47 57 AM" 
src="https://user-images.githubusercontent.com/43534309/183338213-da66d1d5-c186-4ae2-9b14-4381df4d7dce.png";>

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

PR: https://git.openjdk.org/jdk/pull/9769

Reply via email to