On Mon, 29 Apr 2024 09:00:46 GMT, Abhishek Kumar <abhis...@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**), 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. src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java line 1066: > 1064: */ > 1065: public static void setMnemonicHidden(boolean hide) { > 1066: if (UIManager.getBoolean("Button.showMnemonics") == true) { Suggestion: if (UIManager.getBoolean("Button.showMnemonics")) { src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java line 1083: > 1081: */ > 1082: public static boolean isMnemonicHidden() { > 1083: if (UIManager.getBoolean("Button.showMnemonics") == true) { Suggestion: if (UIManager.getBoolean("Button.showMnemonics")) { test/jdk/com/sun/java/swing/plaf/gtk/TestMenuMnemonicOnAltPress.java line 48: > 46: private static JFrame frame; > 47: private static JMenuBar menuBar; > 48: private static JMenu fileMenu; `menuBar `and `fileMenu `can be converted to local variable. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/18992#discussion_r1593386113 PR Review Comment: https://git.openjdk.org/jdk/pull/18992#discussion_r1593386383 PR Review Comment: https://git.openjdk.org/jdk/pull/18992#discussion_r1593388831