Skip to content

Commit

Permalink
Remove linux mitigation
Browse files Browse the repository at this point in the history
  • Loading branch information
mynttt authored Sep 21, 2022
1 parent 8a04170 commit 262b8da
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions src/main/java/de/hshannover/inform/gnuman/GameLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@ public class GameLauncher extends Application {
private static Stage primaryStage = null;
private SceneManager m;

/*
* Mitigates the primaryStage.setResizable(false); bug with JavaFX that exists on Linux and stops the stage from resizing
* It calculates an offset once (platform dependant window decorations) and then forbids resizing by setting max/min width in the scene manager
* This allows to forbid resizing without using the bugged setResizable(false)
*/

public static boolean RUN_LINUX_MITIGATION = false;
public static double LINUX_RESIZE_BUG_MITIGATION_OFFSET_X, LINUX_RESIZE_BUG_MITIGATION_OFFSET_Y = 0;

static {
String os = System.getProperty("os.name").toLowerCase();
RUN_LINUX_MITIGATION = os.contains("nix") || os.contains("nux") || os.contains("aix");
}

@Override
public void start(Stage primaryStage) {
GameLauncher.primaryStage = primaryStage;
Expand Down Expand Up @@ -77,16 +63,7 @@ public void start(Stage primaryStage) {
} catch (InterruptedException e) {}
}).start();

if(RUN_LINUX_MITIGATION) {
LINUX_RESIZE_BUG_MITIGATION_OFFSET_X = primaryStage.getWidth() - primaryStage.getScene().getWidth();
LINUX_RESIZE_BUG_MITIGATION_OFFSET_Y = primaryStage.getHeight() - primaryStage.getScene().getHeight();
primaryStage.setMaxWidth(primaryStage.getWidth());
primaryStage.setMaxHeight(primaryStage.getHeight());
primaryStage.setMinWidth(primaryStage.getWidth());
primaryStage.setMinHeight(primaryStage.getHeight());
} else {
primaryStage.setResizable(false);
}
primaryStage.setResizable(false);
}

private void mainMenu() {
Expand Down

0 comments on commit 262b8da

Please sign in to comment.