On Mon, 24 Jun 2024 07:17:19 GMT, Abhishek Kumar <abhis...@openjdk.org> wrote:

>>> Wouldn't it be easier to install altProcessor always in 
>>> SynthLookAndFeel.initialize and to uninstall it in 
>>> SynthLookAndFeel.uninitialize like it's done in WindowsLookAndFeel:
>> https://github.com/openjdk/jdk/blob/master/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java#L197-L198
>> Then altProcessor would do nothing if the RootPane.altPress property isn't 
>> set or is false.
>> 
>> In my initial fix, I added the `altProcessor` handler in 
>> `SynthLookAndFeel.initialize` with condition check for GTK L&F. Phil has 
>> suggested not to check for GTK L&F instead look for some alternate way like 
>> mentioned 
>> [here](https://github.com/openjdk/jdk/pull/18992#discussion_r1595782003).
>> 
>> Now I left with few options:
>> 1. Install `altProcessor` handler similar to `WindowsLookAndFeel` 
>> implementation but that results in unnecessary installation of `alt handler 
>> for Nimbus L&F (derived from Synth L&F)` as well.
>> 2. Add the `RootPane.altPress` condition check before installing the 
>> `altProcessor` handler but the value returned for `RootPane.altPress` is 
>> always **false** and that left with `altProcessor` handler uninstalled.
>> 
>> So, the handler implementation is moved to `SynthRootPaneUI`.
>
>>Requesting the value of RootPane.altPress from UIManager each time 
>>postProcessKeyEvent is called is inefficient, so you can store the value in 
>>altProcessor when look and feel is installed.
> 
> I guess you are pointing out the code in SynthGraphicsUtils.paintText method 
> where RootPane.altPress value is retrieved from UIManager each time. Storing 
> the value in it's constructor doesn't reflect the correct value and is always 
> `false`.

> If RootPane.altPress can be changed dynamically, you can install a 
> PropertyChangeListener to UIManager.

I think it can be changed but is it really required to handle it ?
I mean why does a user change it dynamically ?

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

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

Reply via email to