RFR: 8306121: Scene not rendered initially when changing scenes after fix for JDK-8296621 [v2]

Thiago Milczarek Sayao tsayao at openjdk.org
Sat Apr 22 15:40:01 UTC 2023


On Sat, 22 Apr 2023 14:42:10 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> Thiago Milczarek Sayao has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Request Focus on setVisible
>
> I'll look at this early next week. My initial question for you is: Why wasn't the restored call to `requestFocus()` put back in the same place? It used to be in `setScene` and now is in `setVisible`. Was that change necessary?
> 
> I'd also like @jperedadnr to review this, since he was looking at [JDK-8304476](https://bugs.openjdk.org/browse/JDK-8304476), which was also caused by the fix for JDK-8296621. I would expect this new fix to also fix JDK-8304476.

@kevinrushforth I think it makes sense to call on `setVisible` because it would translate from `stage.show()` and keep the behavior used to have on `setScene`. But on `setScene` it would:

1. In the most common scenario where a `Stage` will only have one `Scene` during it's lifetime, it would call `requestFocus` before the window exists (mapped on the screen). I think it makes more sense to map the window on the screen and then focus. 

2. In the scenario where multiple scenes exists during the lifetime of the `Stage`, it would keep bringing the window up, restoring [JDK-8296621](https://bugs.openjdk.org/browse/JDK-8296621). It could check if it's the first `Scene`, but there's still (1).

There's a scenario where the user would want to `show` the stage but not raise/focus it (like show it on the taskbar, but not pop to the user). I think that should be possible (at least on platforms with window managers). Speaking of this, I think it will not work (will look into it).

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

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


More information about the openjfx-dev mailing list