diff --git a/client/src/main/java/ctbrec/ui/CamrecApplication.java b/client/src/main/java/ctbrec/ui/CamrecApplication.java index 00280ff4..94edea00 100644 --- a/client/src/main/java/ctbrec/ui/CamrecApplication.java +++ b/client/src/main/java/ctbrec/ui/CamrecApplication.java @@ -254,8 +254,16 @@ public class CamrecApplication extends Application { Player.scene = primaryStage.getScene(); primaryStage.setX(Config.getInstance().getSettings().windowX); primaryStage.setY(Config.getInstance().getSettings().windowY); - primaryStage.xProperty().addListener((observable, oldVal, newVal) -> Config.getInstance().getSettings().windowX = newVal.intValue()); - primaryStage.yProperty().addListener((observable, oldVal, newVal) -> Config.getInstance().getSettings().windowY = newVal.intValue()); + primaryStage.xProperty().addListener((observable, oldVal, newVal) -> { + if (newVal.doubleValue() + primaryStage.getWidth() > 0) { + Config.getInstance().getSettings().windowX = newVal.intValue(); + } + }); + primaryStage.yProperty().addListener((observable, oldVal, newVal) -> { + if (newVal.doubleValue() + primaryStage.getHeight() > 0) { + Config.getInstance().getSettings().windowY = newVal.intValue(); + } + }); primaryStage.show(); primaryStage.setOnCloseRequest(createShutdownHandler()); Runtime.getRuntime().addShutdownHook(new Thread(() -> Platform.runLater(this::shutdown)));