requestFocus on setScene - is it right?

Thiago Milczarek Sayão thiago.sayao at gmail.com
Wed Nov 9 00:43:40 UTC 2022


I have opened a bug about this:
https://bugs.openjdk.org/browse/JDK-8296621

On Linux scene changes cause focus stealing.

-- Thiago.

Em seg., 7 de nov. de 2022 às 13:19, John Hendrikx <john.hendrikx at gmail.com>
escreveu:

> Sorry, I was confused which requestFocus you meant, I was looking at
> Scene#requestFocus(Node).
>
> --John
> On 07/11/2022 15:38, Thiago Milczarek Sayão wrote:
>
> It was a problem in the past gtk glass, but now it checks if visible to
> request the focus.
>
> But, there are two situations:
>
> 1 - Most common - there is one Scene and it's created before the window is
> shown. In this case,
> there is no point to request focus;
>
> 2 - The scene has changed. Do we want to issue notifications or flash the
> taskbar because the Scene has changed?
>
> If 2 is "no", then I think this line should be removed.
>
> If 2 is "yes", then I think we should have an API to request attention.
>
> Em seg., 7 de nov. de 2022 às 05:42, John Hendrikx <
> john.hendrikx at gmail.com> escreveu:
>
>> On 07/11/2022 00:32, Thiago Milczarek Sayão wrote:
>> > While working on native linux glass code I observed that
>> > requestFocus() is called before show().
>> > If the window is not shown (mapped on Xorg), It can't be focused.
>> Have you observed this to be a problem? I believe the actual focus
>> acquisition is delayed.
>> >
>> > The code is on WindowStage.setScene() line 276.
>> >
>> > It might be the case when switching the scene, but should the window
>> > be focused in that case?
>> >
>> > If the user is "focused" on another window and the program decides to
>> > switch the scene the window would pop and steal the focus.
>>
>> Most window managers won't allow this, even if an application does
>> request focus.  Instead they'll indicate this in the task bar that a
>> window wants the focus.
>>
>> Is this actually happening?
>>
>> --John
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20221108/37829548/attachment.htm>


More information about the openjfx-dev mailing list