RFR: 8155030: The Menu Mnemonics are always displayed for GTK LAF [v18]

Andrey Turbanov aturbanov at openjdk.org
Thu Jul 11 07:13:02 UTC 2024


On Mon, 8 Jul 2024 15:40:25 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:

>> In GTK LAF, the menu mnemonics are always displayed which is different from the native behavior. In native application **(tested with gedit for normal buttons and tested with libreoffice for menu**), the menu mnemonics toggle on press of `ALT` key. Menu mnemonics are hidden initially and then toggles between show/hide on `ALT` press. 
>> Proposed fix is to handle the `ALT` key press for GTK LAF and mimic the native behavior. Fix is similar to the `ALT` key processing in  Windows LAF. Automated test case is added to verify the fix and tested in Ubuntu and Oracle linux.
>> 
>> CI testing is green and link attached in JBS.
>
> Abhishek Kumar has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Typo in copyright header

src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRootPaneUI.java line 156:

> 154:                     path[1] = menu;
> 155:                     msm.setSelectedPath(path);
> 156:                 } else if(!MnemonicHandler.isMnemonicHidden()) {

Suggestion:

                } else if (!MnemonicHandler.isMnemonicHidden()) {

test/jdk/javax/swing/JMenuBar/TestMenuMnemonicLinuxAndMac.java line 107:

> 105:     private static void createAndShowUI() {
> 106:         frame = new JFrame("Test Menu Mnemonic Show/Hide");
> 107:         JMenuBar menuBar  = new JMenuBar();

Suggestion:

        JMenuBar menuBar = new JMenuBar();

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18992#discussion_r1673518878
PR Review Comment: https://git.openjdk.org/jdk/pull/18992#discussion_r1673519102


More information about the client-libs-dev mailing list