On Sat, 22 Apr 2023 17:00:50 GMT, Thiago Milczarek Sayao <tsa...@openjdk.org> 
wrote:

>> I replicated the fix on #1054 on Linux.
>> 
>> Also fixes [Monocle: Stage no longer gets focus after fix for 
>> JDK-8296621](https://bugs.openjdk.org/browse/JDK-8304734)
>
> Thiago Milczarek Sayao has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Revert "The window could start iconified."
>   
>   This reverts commit f92e25cbcc24fd772b9d6bb25a92386ec0561313.

Now I see that the call will actually get delayed.

`javafx.stage.Window` will do the calls when the window will be shown(). On 
line 1162 `WindowStage.setScene` is called:


peer.setScene(SceneHelper.getPeer(getScene()));


but this is only called on line 1186:


peer.setVisible(true);


The configuration of Window properties (iconified, maximized, etc) will start 
on line 1212:


WindowHelper.visibleChanged(Window.this, newVisible);


which will fall into `Stage` line 1178 `doVisibleChanged`.

I think this is the right place to call `requestFocus` if the window is not 
minimized/iconified.

Calling `requestFocus` on `setScene`  will cause an initially iconified window 
to be shown (actually pop on the screen) and then be iconified.

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

PR Comment: https://git.openjdk.org/jfx/pull/1110#issuecomment-1518725198

Reply via email to