<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>So on Windows at least, it will change the width temporarily and
then revert back to the original width value. So you will receive
two width change events if you listen to the stage width property.
The maximized property is not changed.</p>
<p>I guess this also not optimal handling of this. Ideally, no
changes would be made in that case.<br>
</p>
<div class="moz-cite-prefix">On 17/03/2025 10:53, Thiago Milczarek
Sayão wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAAP_wumg0w5vEsSBgOBz5NcCbjvCVzqTKzvrJRP4W2QqTc4Ymw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<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" moz-do-not-send="true"
class="moz-txt-link-freetext">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">
<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" moz-do-not-send="true"
class="moz-txt-link-freetext">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 moz-do-not-send="true">"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><br>
Best<br>
Christopher Schnick<br>
</p>
</div>
</blockquote>
</div>
</blockquote>
</body>
</html>