requestFocus on setScene - is it right?

Thiago Milczarek Sayão thiago.sayao at gmail.com
Mon Nov 7 14:38:23 UTC 2022


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/20221107/2a1550e1/attachment-0001.htm>


More information about the openjfx-dev mailing list