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

Abhishek Kumar abhiscxk at openjdk.org
Mon Jul 8 09:21:12 UTC 2024


On Fri, 5 Jul 2024 11:12:50 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:
> 
>   Javadoc style comment, unused import removed

> The diff modifies the generic `SynthGraphicsUtils.paintText` so that no mnemonic is passed to `SwingUtilities2.drawStringUnderlineCharAt` if `isMnemonicHidden` returns `true`.
> 
> This approach has _a performance impact_ on all UI text painting. The condition can be moved into `GTKGraphicsUtils` so that only GTK L&F will call `isMnemonicHidden`.

Updated the code to handle the mnemonic for buttons as well as labels. Mnemonic hide condition check moved to `GTKGraphicsUtils` to avoid the `performance issue`.

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

PR Comment: https://git.openjdk.org/jdk/pull/18992#issuecomment-2213485660


More information about the client-libs-dev mailing list