Fix: ESC/F11 per fullscreen

This commit is contained in:
2026-06-02 20:02:26 +02:00
parent a3cac111ad
commit 707e58a94c
@@ -9,6 +9,8 @@ import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Rectangle2D;
import javafx.scene.Scene;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.KeyCombination;
import javafx.stage.Screen;
import javafx.stage.Stage;
@@ -37,6 +39,7 @@ public class GUI extends Application implements IView {
private ClientController controller;
private boolean autoReenterFullscreen = true;
@Override
@@ -83,7 +86,21 @@ public class GUI extends Application implements IView {
primaryStage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH);
primaryStage.fullScreenProperty().addListener((obs, was, isNow) -> {
if (!isNow) Platform.runLater(() -> primaryStage.setFullScreen(true));
if (!isNow && autoReenterFullscreen) {
Platform.runLater(() -> primaryStage.setFullScreen(true));
}
});
primaryStage.addEventFilter(KeyEvent.KEY_PRESSED, e -> {
if (e.getCode() == KeyCode.ESCAPE) {
autoReenterFullscreen = false;
primaryStage.setFullScreen(false);
e.consume();
} else if (e.getCode() == KeyCode.F11) {
autoReenterFullscreen = true;
primaryStage.setFullScreen(true);
e.consume();
}
});
primaryStage.setTitle("Mesos");
@@ -130,6 +147,7 @@ public class GUI extends Application implements IView {
public void showError(ErrorType error,String message) {
Platform.runLater(() -> {
if (error == ErrorType.SERVER_CRASHED) {
controllerLogin.updateLoginButton(true);
primaryStage.setScene(loginScene);
controllerLogin.showError(error);
} else {