<div dir="ltr">Odd in the sense it's unrestrictive to the bounds. <div>It shouldn't be allowed in a TopLevel taskbar shown window at least, but that's my opinion.<div>But it's windows being windows. They value compatibility and that's probably an old behaviour</div><div>that some apps depend on.</div><div>Gnome being gnome has a lot of restrictions, specially on Wayland.</div></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">Em qua., 9 de abr. de 2025 às 09:15, John Hendrikx <<a href="mailto:john.hendrikx@gmail.com">john.hendrikx@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"><u></u>
<div>
<p>On Windows it is not restricted AFAIK, moving a screen anywhere
is allowed, and one can also drag windows beyond those limits.
When a monitor is added/removed Windows may however decide to
reshuffle all your Windows (or randomly if a monitor is slow to
respond when waking from sleep) to ensure they're all visible.</p>
<p>I think Windows just treats the screen space as infinite with the
monitors being views into it; overlaps and gaps are allowed,
although you need some tricks to get your screens setup that way.</p>
<p>Not sure what you find odd about the Windows behaviour?<br>
</p>
<p>--John<br>
</p>
<div>On 09/04/2025 13:57, Thiago Milczarek
Sayão wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Thanks John!
<div><br>
</div>
<div>I did not calculate the center, I just wanted to know the
behaviour of setX() outside bounds and within</div>
<div>bounds of the last screen.</div>
<div><br>
</div>
<div>The GNOME window manager on Linux restricts programmatic
movement of windows to prevent them </div>
<div>from being moved outside screen boundaries. However, it
allows users to drag windows beyond these limits.<br>
I find it odd that the maximum movement is restricted to the
bounds of the first screen, while it would be more</div>
<div>intuitive for it to be based on the last screen.</div>
<div><br>
</div>
<div>The Windows behaviour also seems odd.</div>
<div><br>
</div>
<div>-- Thiago</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Em qua., 9 de abr. de 2025 às
08:28, John Hendrikx <<a href="mailto:john.hendrikx@gmail.com" target="_blank">john.hendrikx@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>
<p>Small addition; the 3520 button moved the top left of the
Window to the middle of the right screen, but the window
as a whole was not centered.</p>
<p>--John<br>
</p>
<div>On 09/04/2025 13:22, John Hendrikx wrote:<br>
</div>
<blockquote type="cite">
<p>Hi Thiago,</p>
<p>I ran this on Windows. My monitor setup is:</p>
<p>Left: 3840x2160 (150%) -- top left coordinate (-2560,
0) (-2560 because of scaling)<br>
Middle: 3840x2160 (150%) -- this one has a top left
coordinate of (0, 0)<br>
Right: 1920x1200 (100%) -- this one has a top left
coordinate of (2560, 0)<br>
</p>
<p>When started, the program appeared perfectly centered
on the middle screen.</p>
<p>Your program showed buttons: 4480 and 3520</p>
<p>The 4480 button moved the Window far too the right, off
screen and I had to stop the program</p>
<p>The 3520 button moved the Window to the Right monitor,
but it was not centered nicely.</p>
<p>I added a `peek(System.out::println)` on the screens
stream. These are my screens:</p>
<div style="background-color:rgb(255,255,255);padding:0px 0px 0px 2px">
<div style="color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Consolas;font-size:11pt;white-space:pre-wrap"><p style="margin:0px"><span style="color:rgb(0,0,255)">Rectangle2D [minX=0.0, minY=0.0, maxX=2560.0, maxY=1440.0, width=2560.0, height=1440.0]</span></p><p style="margin:0px"><span style="color:rgb(0,0,255)">Rectangle2D [minX=2560.0, minY=-194.0, maxX=4480.0, maxY=1006.0, width=1920.0, height=1200.0]</span></p><p style="margin:0px"><span style="color:rgb(0,0,255)">Rectangle2D [minX=-2560.0, minY=6.0, maxX=0.0, maxY=1446.0, width=2560.0, height=1440.0]</span></p></div>
</div>
<p>--John<br>
</p>
<div>On 09/04/2025 12:55, Thiago Milczarek Sayão wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi,
<div><br>
</div>
<div>Could anyone with a multi-screen setup on Mac
and/or Windows please share the results of the two
buttons on this sample app? Your feedback would be
greatly appreciated!</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div><span></span></div>
</div>
</div>
</div>
</div>
</div>
<div><br>
</div>
<div>On Ubuntu 24.04 the first button moves the
Stage to the end of the first screen (bit weird). </div>
<div>The second work as expected, it gets moved to
the start of the center of the last screen.</div>
<div><br>
</div>
<div>Thanks!</div>
<div><br>
</div>
<div>
<div style="background-color:rgb(30,31,34);color:rgb(188,190,196)">
<pre style="font-family:"JetBrains Mono",monospace;font-size:9.8pt"><span style="color:rgb(207,142,109)">import </span>javafx.application.Application;
<span style="color:rgb(207,142,109)">import </span>javafx.geometry.Pos;
<span style="color:rgb(207,142,109)">import </span>javafx.geometry.Rectangle2D;
<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.VBox;
<span style="color:rgb(207,142,109)">import </span>javafx.stage.Screen;
<span style="color:rgb(207,142,109)">import </span>javafx.stage.StageStyle;
<span style="color:rgb(207,142,109)">import </span>javafx.application.Platform;
<span style="color:rgb(207,142,109)">import </span>javafx.scene.Scene;
<span style="color:rgb(207,142,109)">import </span>javafx.scene.layout.StackPane;
<span style="color:rgb(207,142,109)">import </span>javafx.scene.paint.Color;
<span style="color:rgb(207,142,109)">import </span>javafx.stage.Stage;
<span style="color:rgb(207,142,109)">import </span>java.util.Comparator;
<span style="color:rgb(207,142,109)">public class </span>TestScreenBounds <span style="color:rgb(207,142,109)">extends </span>Application {
@Override
<span style="color:rgb(207,142,109)">public void </span>start(Stage stage) {
stage.setTitle(<span style="color:rgb(106,171,115)">"Move Outside Bounds"</span>);
Rectangle2D bounds = Screen.getScreens().stream()
.map(Screen::getBounds)
.sorted(Comparator.comparingDouble(Rectangle2D::getMaxX).reversed())
.findFirst()
.orElseThrow();
Button btn = <span style="color:rgb(207,142,109)">new </span>Button(<span style="color:rgb(106,171,115)">"Move To " </span>+ bounds.getMaxX());
btn.setOnAction(event -> stage.setX(bounds.getMaxX()));
<span style="color:rgb(207,142,109)">double </span>middleLastScreen = bounds.getMinX() + bounds.getWidth() / <span style="color:rgb(42,172,184)">2</span>;
Button btn2 = <span style="color:rgb(207,142,109)">new </span>Button(<span style="color:rgb(106,171,115)">"Move To " </span>+ middleLastScreen);
btn2.setOnAction(event -> stage.setX(middleLastScreen));
VBox root = <span style="color:rgb(207,142,109)">new </span>VBox(btn, btn2);
root.setFillWidth(<span style="color:rgb(207,142,109)">true</span>);
root.setAlignment(Pos.CENTER);
Scene scene = <span style="color:rgb(207,142,109)">new </span>Scene(root, <span style="color:rgb(42,172,184)">300</span>, <span style="color:rgb(42,172,184)">300</span>);
stage.setScene(scene);
stage.show();
}
<span style="color:rgb(207,142,109)">public static void </span>main(String[] args) {
launch(TestScreenBounds.<span style="color:rgb(207,142,109)">class</span>, args);
}
}
</pre>
</div>
</div>
</div>
</div>
</blockquote>
</blockquote>
</div>
</blockquote>
</div>
</blockquote>
</div>
</blockquote></div>