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

Phil Race prr at openjdk.org
Fri Jun 14 20:31:24 UTC 2024


On Fri, 14 Jun 2024 10:07:39 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**), 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:
> 
>   condition update

src/java.desktop/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java line 780:

> 778:             }
> 779: 
> 780:             if (c instanceof JLabel && ((JLabel) c).getDisplayedMnemonic() != '\0') {

you can use else if in all these cases

src/java.desktop/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java line 785:

> 783:             }
> 784: 
> 785:             if (c instanceof Container) {

JComponent extends Container ..  so this will traverse everything in the Swing UI.
Is there any pattern elsewhere in Swing you can use to short-circuit this ?

src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java line 1056:

> 1054:      * @param hide true if mnemonics should be hidden
> 1055:      * @since 23
> 1056:      */

Hmm. So .. new public API ? Is this absolutely necessary ? 
I don't see why an app would need to call this directly. 
And it would need a CSR, and it is too late for 23 anyway.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18992#discussion_r1640319600
PR Review Comment: https://git.openjdk.org/jdk/pull/18992#discussion_r1640320632
PR Review Comment: https://git.openjdk.org/jdk/pull/18992#discussion_r1640324672


More information about the client-libs-dev mailing list