RFR: 8155030: The Menu Mnemonics are always displayed for GTK LAF [v8]
Abhishek Kumar
abhiscxk at openjdk.org
Thu Jun 27 10:06:49 UTC 2024
On Tue, 25 Jun 2024 15:35:47 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> Abhishek Kumar has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Remove access modifier from method declaration
>
> src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java line 868:
>
>> 866: "ctrl released ENTER", "release"
>> 867: },
>> 868: "RootPane.altPress", true,
>
> `RootPane.hideMnemonics` or `RootPane.showMnemonicsOnAltPress` could be a more descriptive property name.
Removed this property now.
> You may add another condition to the if statement, mnemIndex < 0 — if there's no mnemonic defined, there's no need to query the properties from UIManager at all.
Updated.
> src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java line 1046:
>
>> 1044:
>> 1045: // Toggle flag for drawing the mnemonic state
>> 1046: private static boolean isMnemonicHidden = true;
>
> I wonder why it defaults to `true` where only one L&F derived from Synth sets it to true.
That's correct. Modified it to be `false` by default and based on L&F it can be set to `true`. For GTK initialization, it is set to `true` to hide mnemonics by default.
> test/jdk/com/sun/java/swing/plaf/gtk/TestMenuMnemonicOnAltPress.java line 72:
>
>> 70: pt = fileMenu.getLocationOnScreen();
>> 71: fileMenuWidth = fileMenu.getWidth();
>> 72: fileMenuHeight = fileMenu.getHeight();
>
> If you save width and height in a `Dimension` object, `fileMenuSize`, you'll be able to use `new Rectangle(pt, fileMenuSize)` for capturing the screen.
>
> Since you need that rectangle only, you can create the rectangle here:
>
> Suggestion:
>
> fileMenuRect = new Rectangle(fileMenu.getLocationOnScreen(),
> fileMenu.getSize());
Updated.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18992#discussion_r1656861152
PR Review Comment: https://git.openjdk.org/jdk/pull/18992#discussion_r1656861413
PR Review Comment: https://git.openjdk.org/jdk/pull/18992#discussion_r1656860692
PR Review Comment: https://git.openjdk.org/jdk/pull/18992#discussion_r1656858840
More information about the client-libs-dev
mailing list