RFR: 8326619: Stage.sizeToScene() on maximized/fullscreen Stage breaks the Window

Kevin Rushforth kcr at openjdk.org
Mon May 20 21:03:07 UTC 2024


On Fri, 8 Mar 2024 16:39:56 GMT, Marius Hanl <mhanl at openjdk.org> wrote:

>> This seems like a reasonable fix and spec change. Have you tested the case of calling sizeToScene before setting full-screen or maximzed? Since the pending flag will still be set in that case, I want to make sure that case is tested as well.
>> 
>> Also, if this fixed [JDK-8316425](https://bugs.openjdk.org/browse/JDK-8316425), then that bug should be closed as a duplicate of this one.
>> 
>> @lukostyra @arapte can you also review this?
>
>> This seems like a reasonable fix and spec change. Have you tested the case of calling sizeToScene before setting full-screen or maximzed? Since the pending flag will still be set in that case, I want to make sure that case is tested as well.
> 
> I thought about this as well but could not find any problem at least on Windows.
> If we want to be perfectly safe, we may still want to set the flag when `sizeToScene()` is called. What do you think?
> 
> I used the following code to test this, and it didn't matter when `sizeToScene()` was called:
> 
> 
>    @Override
>     public void start(Stage primaryStage) throws Exception {
>         StackPane root = new StackPane();
>         Button wss = new Button("Wss");
>         wss.setPrefSize(50, 50);
>         root.getChildren().add(wss);
> 
>         Scene scene = new Scene(root);
> 
>         Stage stage = new Stage();
>         stage.setWidth(500);
>         stage.setMaximized(true);
>         stage.sizeToScene();
>         stage.setScene(scene);
>         stage.show();
>     }

@Maran23 I think this is pretty close to being ready to go in. At a minimum, you will need to merge master and then fix the test so that it will compile, and then create a CSR with the updated specification (I can help with that if needed). My only other suggestion was around additional tests that might be useful, but they could be done as a follow-on fix.

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

PR Comment: https://git.openjdk.org/jfx/pull/1382#issuecomment-2121199537


More information about the openjfx-dev mailing list