<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>I wasn't really trying it, our application just had functionality
to resize the window on a certain action. And this functionality
then broke the window content when triggered while the window was
maximized, which is a case I didn't consider. I implemented a
workaround for this now by just setting the maximized property to
false prior and only resizing the window if really necessary, but
I can imagine other applications possibly being affected by this.<br>
<br>
For reference, here is a video on how the issue looked like
initially on Linux: <a class="moz-txt-link-freetext" href="https://github.com/xpipe-io/xpipe/issues/485">https://github.com/xpipe-io/xpipe/issues/485</a><br>
</p>
<div class="moz-cite-prefix">On 17/04/2025 22:24, Martin Fox wrote:<br>
</div>
<blockquote type="cite"
cite="mid:E6B4F323-F26B-479C-A279-0373C9B76125@gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<span style="font-family: Optima-Regular;">Christopher,</span>
<div style="font-family: Optima-Regular;"><br>
</div>
<div style="font-family: Optima-Regular;">Why are you trying to
change the size of a maximized stage? I’m not sure what the
intended effect is.</div>
<div style="font-family: Optima-Regular;"><br>
</div>
<div style="font-family: Optima-Regular;">Currently this produces
all sort of platform-specific behavior and since what you’re
seeing on Windows doesn’t match what I’m seeing I think there
might be some variation based on OS version. The easiest way out
of this thicket is to de-maximize the stage before trying to
change its size.</div>
<div style="font-family: Optima-Regular;"><br>
</div>
<div style="font-family: Optima-Regular;">With that said, yes,
this Linux bug definitely needs to be fixed. Whatever happens
the scene shouldn’t break.</div>
<div style="font-family: Optima-Regular;"><br>
</div>
<div>
<blockquote type="cite">
<div>On Apr 16, 2025, at 3:32 AM, Thiago Milczarek Sayão
<a class="moz-txt-link-rfc2396E" href="mailto:thiago.sayao@gmail.com"><thiago.sayao@gmail.com></a> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div dir="ltr">Hi,
<div><br>
</div>
<div>I’d like to get your thoughts on what the expected
behavior should be when setting the size of a window
while it's in a maximized state.<br>
<br>
</div>
<div>Here are the options I’ve considered:<br>
<br>
a) Ignore the resize while maximized, and when restored,
revert to the size before it was maximized<br>
b) Demaximize the window and apply the new size
immediately<br>
c) Ignore the resize request, but store the values and
apply them upon restore<br>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div style="font-family: Optima-Regular;">Option A forces the
client to de-maximize the window before changing its size.
Option B de-maximizes the window automatically. Option C is
the only one that brings new functionality to the table but it
would be complicated to implement (assuming it can be
implemented).</div>
<div style="font-family: Optima-Regular;"><br>
</div>
<div style="font-family: Optima-Regular;">The documentation
states that this is how things work when a stage is in
fullscreen mode but from I can tell that’s not how any of the
platforms actually behave. Trying to resize a fullscreen
window produces a variety of immediate platform-specific
effects.</div>
<br>
<blockquote type="cite">
<div>
<div dir="ltr">
<div>If I understood correctly, Martin mentioned that both
macOS and Windows apply the resize immediately while
keeping the window maximized.</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<span style="font-family: Optima-Regular;">You understood
correctly but I was wrong. On Windows 11 the size changes (I’m
seeing only one resize event) and the window stays in the
maximized state. This seems to be confusing the OS and it
draws the title bar incorrectly. On macOS the size changes and
the window leaves the maximized state but due to a bug in the
code we don’t update the maximized property correctly.</span></div>
<div><span style="font-family: Optima-Regular;"><br>
</span></div>
<div><span style="font-family: Optima-Regular;">Martin</span></div>
<div><font face="Optima-Regular"><br>
</font>
<blockquote type="cite">
<div>
<div dir="ltr">
<div>Then, when the window is demaximized, it restores the
previous (pre-maximized) size, which suggests behavior
leaning toward option a.<br>
<br>
For fullscreen mode, the expected behavior appears to
align more with option c, as documented for Stage
fullscreen.</div>
<div><br>
</div>
<div>-- Thiago.</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote gmail_quote_container">
<div dir="ltr" class="gmail_attr">Em sáb., 29 de mar. de
2025 às 09:24, Thiago Milczarek Sayão <<a
href="mailto:thiago.sayao@gmail.com"
moz-do-not-send="true" class="moz-txt-link-freetext">thiago.sayao@gmail.com</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 dir="ltr">I did not find a bug report, so I did one
and provided a fix:
<div><br>
</div>
<div><a
href="https://github.com/openjdk/jfx/pull/1748"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">https://github.com/openjdk/jfx/pull/1748</a></div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Em sáb., 29 de mar.
de 2025 às 08:26, Thiago Milczarek Sayão <<a
href="mailto:thiago.sayao@gmail.com"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">thiago.sayao@gmail.com</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 dir="ltr"><a class="gmail_plusreply"
id="m_2988398710280461967m_-7523828988626786145m_4138217888673675929plusReplyChip-0"
href="mailto:crschnick@xpipe.io" target="_blank"
moz-do-not-send="true">@Christopher Schnick</a> <br>
<div><br>
</div>
<div>Hi, did you open a bug? I have a fix for
this.</div>
<div><br>
</div>
<div>Thanks</div>
<div><br>
</div>
<div>-- Thiago.</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Em seg., 17 de
mar. de 2025 às 09:49, Christopher Schnick <<a
href="mailto:crschnick@xpipe.io"
target="_blank" 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>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>On 17/03/2025 10:53, Thiago Milczarek
Sayão wrote:<br>
</div>
<blockquote type="cite">
<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>
<div>
<div>
<div><span></span></div>
<span><br>
</span><span></span><span></span></div>
</div>
</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Em dom.,
16 de mar. de 2025 às 05:25, Christopher
Schnick <<a
href="mailto:crschnick@xpipe.io"
target="_blank" 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>
</div>
</blockquote>
</div>
</blockquote>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
<br>
</blockquote>
</body>
</html>