<AWT Dev> [10] Review request for 8155197: Focus transition issue

Semyon Sadetsky semyon.sadetsky at oracle.com
Tue Oct 3 16:09:38 UTC 2017


+1

--Semyon


On 10/03/2017 08:23 AM, Dmitry Markov wrote:
> Hi Semyon,
>
> I have updated the fix based on your suggestion. The new version is 
> located at http://cr.openjdk.java.net/~dmarkov/8155197/webrev.02/ 
> <http://cr.openjdk.java.net/%7Edmarkov/8155197/webrev.02/>
> Also I slightly modified the test to simplify it.
>
> Thanks,
> Dmitry
>> On 2 Oct 2017, at 18:32, Semyon Sadetsky <semyon.sadetsky at oracle.com 
>> <mailto:semyon.sadetsky at oracle.com>> wrote:
>>
>> Hi Dmitry,
>>
>>>> Actually the parent frame doesn't own the input focus when the 
>>>> issue happens. The focus is on the dialog already and when 
>>>> FOCUS_GAINED event comes for the dialog the KFM discovers that the 
>>>> dialog should not have the focus and rejects it in line 588 of the 
>>>> DefaultKeyboardFocusManager:
>>>>
>>>>                             restoreFocus(fe, newFocusedWindow);
>>>>
>>>> This happens when the dialog became non-focusable (non-visible) 
>>>> after the focus request is sent, but before the corresponding 
>>>> FOCUS_GAINED event is handled on the EDT. In this case the focus is 
>>>> directly restored to the previously focused window which doesn't 
>>>> have the focus at this moment and input focus cannot be requested 
>>>> to one of its components synchronously.
>>>> Please confirm whether you agree on the root cause of the bug.
>>>>
>>> You are right. I agree with your evaluation.
>> Thanks.
>> Before setting the restoreFocusTo to toFocus in line 190 I would 
>> recheck for toFocus.isShowing() && toFocus.canBeFocusOwner() once 
>> again because the component can be made non-focusable concurrently.
>>
>> --Semyon
>>
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20171003/cf926fc7/attachment.html>


More information about the awt-dev mailing list