<Swing Dev> [9] RFR JDK-8173145: Menu is activated after using mnemonic Alt/Key combination

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

<Swing Dev> [9] RFR JDK-8173145: Menu is activated after using mnemonic Alt/Key combination

mikhail cherkasov
Hi all,

Bug: https://bugs.openjdk.java.net/browse/JDK-8173145
Webrev: http://cr.openjdk.java.net/~mcherkas/8173145/webrev.00/

The problem appears because AltProcessor  doesn't reset altKeyPressed
flag when
not-alt key pressed, but event is consumed.
This situation is possible when all events consumed by key bindings. A
menubar is activated while
user expects only key binding actions.
In my test a button should be activated by alt+m mnemonic, but a menu is
activate, because
key pressed/released consumed by mnemonic combination and key typed
event is
consumed by DefaultEditorKit$DefaultDeyTypedAction that is installed for
JTextField,
as result instead of button, menu is activated.

To fix the issue I added resetting altKeyPressed flag if any non-alt key
pressed despite consuming state,
because obviously user what make some alt+[KEY] action instead of menu
activation.

Thanks,
Mikhail.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: <Swing Dev> [9] RFR JDK-8173145: Menu is activated after using mnemonic Alt/Key combination

Sergey Bylokhov
Hi, Mikhail.
Can you please confirm that you run a regression/jck tests. What about other L&F, why they are skipped in the test?

>
> Hi all,
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8173145
> Webrev: http://cr.openjdk.java.net/~mcherkas/8173145/webrev.00/
>
> The problem appears because AltProcessor  doesn't reset altKeyPressed flag when
> not-alt key pressed, but event is consumed.
> This situation is possible when all events consumed by key bindings. A menubar is activated while
> user expects only key binding actions.
> In my test a button should be activated by alt+m mnemonic, but a menu is activate, because
> key pressed/released consumed by mnemonic combination and key typed event is
> consumed by DefaultEditorKit$DefaultDeyTypedAction that is installed for JTextField,
> as result instead of button, menu is activated.
>
> To fix the issue I added resetting altKeyPressed flag if any non-alt key pressed despite consuming state,
> because obviously user what make some alt+[KEY] action instead of menu activation.
>
> Thanks,
> Mikhail.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: <Swing Dev> [9] RFR JDK-8173145: Menu is activated after using mnemonic Alt/Key combination

mikhail cherkasov
Hi Sergey,

I've just finished with tests, no new failures, everything works as
before the fix.

Thanks,
Mikhail.

On 06.02.2017 17:03, Sergey Bylokhov wrote:

> Hi, Mikhail.
> Can you please confirm that you run a regression/jck tests. What about other L&F, why they are skipped in the test?
>
>> Hi all,
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8173145
>> Webrev: http://cr.openjdk.java.net/~mcherkas/8173145/webrev.00/
>>
>> The problem appears because AltProcessor  doesn't reset altKeyPressed flag when
>> not-alt key pressed, but event is consumed.
>> This situation is possible when all events consumed by key bindings. A menubar is activated while
>> user expects only key binding actions.
>> In my test a button should be activated by alt+m mnemonic, but a menu is activate, because
>> key pressed/released consumed by mnemonic combination and key typed event is
>> consumed by DefaultEditorKit$DefaultDeyTypedAction that is installed for JTextField,
>> as result instead of button, menu is activated.
>>
>> To fix the issue I added resetting altKeyPressed flag if any non-alt key pressed despite consuming state,
>> because obviously user what make some alt+[KEY] action instead of menu activation.
>>
>> Thanks,
>> Mikhail.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: <Swing Dev> [9] RFR JDK-8173145: Menu is activated after using mnemonic Alt/Key combination

Sergey Bylokhov
Looks fine to me then. But I am not an expert in this area.

>
> Hi Sergey,
>
> I've just finished with tests, no new failures, everything works as before the fix.
>
> Thanks,
> Mikhail.
>
> On 06.02.2017 17:03, Sergey Bylokhov wrote:
>> Hi, Mikhail.
>> Can you please confirm that you run a regression/jck tests. What about other L&F, why they are skipped in the test?
>>
>>> Hi all,
>>>
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8173145
>>> Webrev: http://cr.openjdk.java.net/~mcherkas/8173145/webrev.00/
>>>
>>> The problem appears because AltProcessor  doesn't reset altKeyPressed flag when
>>> not-alt key pressed, but event is consumed.
>>> This situation is possible when all events consumed by key bindings. A menubar is activated while
>>> user expects only key binding actions.
>>> In my test a button should be activated by alt+m mnemonic, but a menu is activate, because
>>> key pressed/released consumed by mnemonic combination and key typed event is
>>> consumed by DefaultEditorKit$DefaultDeyTypedAction that is installed for JTextField,
>>> as result instead of button, menu is activated.
>>>
>>> To fix the issue I added resetting altKeyPressed flag if any non-alt key pressed despite consuming state,
>>> because obviously user what make some alt+[KEY] action instead of menu activation.
>>>
>>> Thanks,
>>> Mikhail.
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: <Swing Dev> [9] RFR JDK-8173145: Menu is activated after using mnemonic Alt/Key combination

Semyon Sadetsky
In reply to this post by mikhail cherkasov
Hi Mikhail,

The fix itself is good.

Could you, please, remove the author tag from the test header? We have
agreement to not use it anymore.

And the test frame need to be disposed after the test.

--Semyon


On 2/6/2017 4:32 PM, Mikhail Cherkasov wrote:

> Hi all,
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8173145
> Webrev: http://cr.openjdk.java.net/~mcherkas/8173145/webrev.00/
>
> The problem appears because AltProcessor  doesn't reset altKeyPressed
> flag when
> not-alt key pressed, but event is consumed.
> This situation is possible when all events consumed by key bindings. A
> menubar is activated while
> user expects only key binding actions.
> In my test a button should be activated by alt+m mnemonic, but a menu
> is activate, because
> key pressed/released consumed by mnemonic combination and key typed
> event is
> consumed by DefaultEditorKit$DefaultDeyTypedAction that is installed
> for JTextField,
> as result instead of button, menu is activated.
>
> To fix the issue I added resetting altKeyPressed flag if any non-alt
> key pressed despite consuming state,
> because obviously user what make some alt+[KEY] action instead of menu
> activation.
>
> Thanks,
> Mikhail.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: <Swing Dev> [9] RFR JDK-8173145: Menu is activated after using mnemonic Alt/Key combination

mikhail cherkasov

> The fix itself is good.
>
> Could you, please, remove the author tag from the test header? We have
> agreement to not use it anymore.
ok. thank you.

>
> And the test frame need to be disposed after the test.
>
> --Semyon
>
>
> On 2/6/2017 4:32 PM, Mikhail Cherkasov wrote:
>> Hi all,
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8173145
>> Webrev: http://cr.openjdk.java.net/~mcherkas/8173145/webrev.00/
>>
>> The problem appears because AltProcessor  doesn't reset altKeyPressed
>> flag when
>> not-alt key pressed, but event is consumed.
>> This situation is possible when all events consumed by key bindings.
>> A menubar is activated while
>> user expects only key binding actions.
>> In my test a button should be activated by alt+m mnemonic, but a menu
>> is activate, because
>> key pressed/released consumed by mnemonic combination and key typed
>> event is
>> consumed by DefaultEditorKit$DefaultDeyTypedAction that is installed
>> for JTextField,
>> as result instead of button, menu is activated.
>>
>> To fix the issue I added resetting altKeyPressed flag if any non-alt
>> key pressed despite consuming state,
>> because obviously user what make some alt+[KEY] action instead of
>> menu activation.
>>
>> Thanks,
>> Mikhail.
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: <Swing Dev> [9] RFR JDK-8173145: Menu is activated after using mnemonic Alt/Key combination

Alexey Ivanov
In reply to this post by mikhail cherkasov
Hi Mikhail,

You should dispose the frame in the end of the test.

This could probably be removed:
  90         UIManager.getLookAndFeel();


You can merge the explicit exception list of main method to just Exception.

Otherwise, it looks good to me.


Regards,
Alexey

On 06.02.2017 16:32, Mikhail Cherkasov wrote:

> Hi all,
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8173145
> Webrev: http://cr.openjdk.java.net/~mcherkas/8173145/webrev.00/
>
> The problem appears because AltProcessor  doesn't reset altKeyPressed
> flag when
> not-alt key pressed, but event is consumed.
> This situation is possible when all events consumed by key bindings. A
> menubar is activated while
> user expects only key binding actions.
> In my test a button should be activated by alt+m mnemonic, but a menu
> is activate, because
> key pressed/released consumed by mnemonic combination and key typed
> event is
> consumed by DefaultEditorKit$DefaultDeyTypedAction that is installed
> for JTextField,
> as result instead of button, menu is activated.
>
> To fix the issue I added resetting altKeyPressed flag if any non-alt
> key pressed despite consuming state,
> because obviously user what make some alt+[KEY] action instead of menu
> activation.
>
> Thanks,
> Mikhail.

Loading...