<div dir="ltr">Hi Christopher,<div><br></div><div>It seems like a simple fix.</div><div><br></div><div>How does it behave on other platforms? Does it ignore the resize, restore the window to its unmaximized state before resizing, or keep it maximized while adjusting the unmaximized size.</div><div><br></div><div>-- Thiago</div><div><div tabindex="0" class="gmail-mb-2 gmail-flex gmail-gap-3 gmail--ml-2"><div class="gmail-flex gmail-items-center gmail-justify-start gmail-rounded-xl gmail-p-1"><div class="gmail-flex gmail-items-center gmail-transition-opacity gmail-group-hover/turn:opacity-100 gmail-opacity-100"><div class="gmail-flex"><span class="gmail-"></span></div><span class="gmail-"><br></span><span class="gmail-hidden"></span><span class="gmail-"></span></div></div></div></div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">Em dom., 16 de mar. de 2025 às 05:25, Christopher Schnick <<a href="mailto:crschnick@xpipe.io">crschnick@xpipe.io</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>

  

    
  
  <div>
    <p>Hello,<br>
      <br>
      we encountered an issue on Linux where resizing the stage while it
      is maximized breaks the size of the scene. You can see a video of
      this at <a href="https://github.com/xpipe-io/xpipe/issues/485" target="_blank">https://github.com/xpipe-io/xpipe/issues/485</a> . The root
      cause is that the stage size is modified.<br>
      <br>
      When doing this, it temporarily or permanently switches to the
      size the stage had prior to being maximized, leading to either a
      flicker or a permanently broken scene that has the wrong size.
      This happens on Gnome and KDE for me with the latest JavaFX ea
      version.<br>
      <br>
      Here is a simple reproducer:</p>
    <div style="background-color:rgb(30,31,34);color:rgb(188,190,196)">
      <pre style="font-family:"JetBrains Mono",monospace"><span style="color:rgb(207,142,109)">import </span>javafx.application.Application;
<span style="color:rgb(207,142,109)">import </span>javafx.scene.Scene;
<span style="color:rgb(207,142,109)">import </span>javafx.scene.control.Button;
<span style="color:rgb(207,142,109)">import </span>javafx.scene.layout.Region;
<span style="color:rgb(207,142,109)">import </span>javafx.scene.layout.StackPane;
<span style="color:rgb(207,142,109)">import </span>javafx.stage.Stage;

<span style="color:rgb(207,142,109)">import </span>java.io.IOException;
<span style="color:rgb(207,142,109)">import </span>java.util.Base64;

<span style="color:rgb(207,142,109)">public class </span>MaximizeLinuxBug <span style="color:rgb(207,142,109)">extends </span>Application {

    <span style="color:rgb(179,174,96)">@Override
</span><span style="color:rgb(179,174,96)">    </span><span style="color:rgb(207,142,109)">public void </span><span style="color:rgb(86,168,245)">start</span>(Stage stage) <span style="color:rgb(207,142,109)">throws </span>IOException {
        Scene scene = <span style="color:rgb(207,142,109)">new </span>Scene(createContent(), <span style="color:rgb(42,172,184)">640</span>, <span style="color:rgb(42,172,184)">480</span>);
        <span style="color:rgb(207,142,109)">var </span>s = <span style="color:rgb(106,171,115)"><a>"data:text/css;base64,"</a> </span>+ Base64.<span style="font-style:italic">getEncoder</span>().encodeToString(createCss().getBytes());
        scene.getStylesheets().add(s);
        stage.setTitle(<span style="color:rgb(106,171,115)">"Hello!"</span>);
        stage.setScene(scene);
        stage.show();
        stage.centerOnScreen();
        stage.setMaximized(<span style="color:rgb(207,142,109)">true</span>);
    }

    <span style="color:rgb(207,142,109)">private </span>String <span style="color:rgb(86,168,245)">createCss</span>() {
        <span style="color:rgb(207,142,109)">return </span><span style="color:rgb(106,171,115)">"""
</span><span style="color:rgb(106,171,115)">                * {
</span><span style="color:rgb(106,171,115)">                -fx-border-color: red;
</span><span style="color:rgb(106,171,115)">                -fx-border-width: 1;
</span><span style="color:rgb(106,171,115)">                }
</span><span style="color:rgb(106,171,115)">                """</span>;
    }

    <span style="color:rgb(207,142,109)">private </span>Region <span style="color:rgb(86,168,245)">createContent</span>() {
        <span style="color:rgb(207,142,109)">var </span>button = <span style="color:rgb(207,142,109)">new </span>Button(<span style="color:rgb(106,171,115)">"Click me!"</span>);
        button.setOnAction(event -> {
            <span style="color:rgb(207,142,109)">var </span>w = <span style="color:rgb(199,125,187)">button</span>.getScene().getWindow();
            w.setWidth(w.getWidth() - <span style="color:rgb(42,172,184)">1</span>);
            event.consume();
        });
        <span style="color:rgb(207,142,109)">var </span>stack = <span style="color:rgb(207,142,109)">new </span>StackPane(button);
        <span style="color:rgb(207,142,109)">return </span>stack;
    }

    <span style="color:rgb(207,142,109)">public static void </span><span style="color:rgb(86,168,245)">main</span>(String[] args) {
        <span style="font-style:italic">launch</span>();
    }
}</pre>
    </div>
    <p></p>
    <p><br>
      Best<br>
      Christopher Schnick<br>
    </p>
  </div>

</blockquote></div>