On macOS 15.3.2 I get the same results as Andy. When I press the top button 
glass asks the OS to move the window offscreen but the OS shifts the location 
40 units to the left so it’s partially onscreen.

> On Apr 9, 2025, at 8:08 AM, Andy Goryachev <andy.goryac...@oracle.com> wrote:
> 
> Here are the results on macOS 15.3.2, with the primary (retina, scale=2) at 
> the bottom and the external (scale=1) at the top like so
>  
> <image001.png>
>  
> In both cases, the first button (Move To 1800.0) moves the window to the same 
> screen partially outside of the viewing area (only about ~15% of the left 
> side remains visible), while the other button (Move To 900.0) shifts to the 
> right.
>  
> My setup uses the setting [Desktop & Dock -> Displays have separate Spaces 
> OFF] so I can move the windows between the monitors.
>  
> -andy
>  
>  
> From: openjfx-dev <openjfx-dev-r...@openjdk.org> on behalf of Thiago 
> Milczarek Sayão <thiago.sa...@gmail.com>
> Date: Wednesday, April 9, 2025 at 03:56
> To: openjfx-dev <openjfx-dev@openjdk.org>
> Subject: Help test the behavior of a multi-screen setup with both Mac and 
> Windows
> 
> Hi,
>  
> 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!
>  
> On Ubuntu 24.04 the first button moves the Stage to the end of the first 
> screen (bit weird). 
> The second work as expected, it gets moved to the start of the center of the 
> last screen.
>  
> Thanks!
>  
> import javafx.application.Application;
> import javafx.geometry.Pos;
> import javafx.geometry.Rectangle2D;
> import javafx.scene.control.Button;
> import javafx.scene.layout.VBox;
> import javafx.stage.Screen;
> import javafx.stage.StageStyle;
> import javafx.application.Platform;
> import javafx.scene.Scene;
> import javafx.scene.layout.StackPane;
> import javafx.scene.paint.Color;
> import javafx.stage.Stage;
> 
> import java.util.Comparator;
> 
> public class TestScreenBounds extends Application {
> 
>     @Override
>     public void start(Stage stage) {
>         stage.setTitle("Move Outside Bounds");
>         Rectangle2D bounds = Screen.getScreens().stream()
>                 .map(Screen::getBounds)
>                 
> .sorted(Comparator.comparingDouble(Rectangle2D::getMaxX).reversed())
>                 .findFirst()
>                 .orElseThrow();
> 
>         Button btn = new Button("Move To " + bounds.getMaxX());
>         btn.setOnAction(event -> stage.setX(bounds.getMaxX()));
> 
>         double middleLastScreen = bounds.getMinX() + bounds.getWidth() / 2;
> 
>         Button btn2 = new Button("Move To " + middleLastScreen);
>         btn2.setOnAction(event -> stage.setX(middleLastScreen));
> 
>         VBox root = new VBox(btn, btn2);
>         root.setFillWidth(true);
>         root.setAlignment(Pos.CENTER);
>         Scene scene = new Scene(root, 300, 300);
>         stage.setScene(scene);
>         stage.show();
>     }
> 
>     public static void main(String[] args) {
>         launch(TestScreenBounds.class, args);
>     }
> }

Reply via email to