mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-19 00:36:10 -04:00
Fix process not exited when pressed Alt+F4
This commit is contained in:
parent
ba359305f6
commit
3bf92e6f12
@ -86,6 +86,8 @@ public final class Launcher extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void stopWithoutPlatform() {
|
public static void stopWithoutPlatform() {
|
||||||
|
Logging.LOG.info("Stopping application without JavaFX Toolkit");
|
||||||
|
|
||||||
JFXUtilities.runInFX(() -> {
|
JFXUtilities.runInFX(() -> {
|
||||||
if (Controllers.getStage() == null)
|
if (Controllers.getStage() == null)
|
||||||
return;
|
return;
|
||||||
|
@ -93,6 +93,8 @@ public final class Controllers {
|
|||||||
public static void initialize(Stage stage) {
|
public static void initialize(Stage stage) {
|
||||||
Controllers.stage = stage;
|
Controllers.stage = stage;
|
||||||
|
|
||||||
|
stage.setOnCloseRequest(e -> Launcher.stopApplication());
|
||||||
|
|
||||||
decorator = new Decorator(stage, getMainPage(), Launcher.TITLE, false, true);
|
decorator = new Decorator(stage, getMainPage(), Launcher.TITLE, false, true);
|
||||||
decorator.showPage(null);
|
decorator.showPage(null);
|
||||||
leftPaneController = new LeftPaneController(decorator.getLeftPane());
|
leftPaneController = new LeftPaneController(decorator.getLeftPane());
|
||||||
|
@ -74,7 +74,7 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
|
|||||||
private static final SVGGlyph close = Lang.apply(new SVGGlyph(0, "CLOSE", "M810 274l-238 238 238 238-60 60-238-238-238 238-60-60 238-238-238-238 60-60 238 238 238-238z", Color.WHITE),
|
private static final SVGGlyph close = Lang.apply(new SVGGlyph(0, "CLOSE", "M810 274l-238 238 238 238-60 60-238-238-238 238-60-60 238-238-238-238 60-60 238 238 238-238z", Color.WHITE),
|
||||||
glyph -> { glyph.setPrefSize(12, 12); glyph.setSize(12, 12); });
|
glyph -> { glyph.setPrefSize(12, 12); glyph.setSize(12, 12); });
|
||||||
|
|
||||||
private final ObjectProperty<Runnable> onCloseButtonAction = new SimpleObjectProperty<>(Launcher::stopApplication);
|
private final ObjectProperty<Runnable> onCloseButtonAction;
|
||||||
private final BooleanProperty customMaximize = new SimpleBooleanProperty(false);
|
private final BooleanProperty customMaximize = new SimpleBooleanProperty(false);
|
||||||
|
|
||||||
private final Stage primaryStage;
|
private final Stage primaryStage;
|
||||||
@ -141,6 +141,8 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
|
|||||||
|
|
||||||
FXUtils.loadFXML(this, "/assets/fxml/decorator.fxml");
|
FXUtils.loadFXML(this, "/assets/fxml/decorator.fxml");
|
||||||
|
|
||||||
|
onCloseButtonAction = new SimpleObjectProperty<>(this, "onCloseButtonAction", primaryStage::close);
|
||||||
|
|
||||||
primaryStage.initStyle(StageStyle.UNDECORATED);
|
primaryStage.initStyle(StageStyle.UNDECORATED);
|
||||||
btnClose.setGraphic(close);
|
btnClose.setGraphic(close);
|
||||||
btnMin.setGraphic(minus);
|
btnMin.setGraphic(minus);
|
||||||
|
@ -45,6 +45,7 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler {
|
|||||||
put("java.lang.ClassFormatError", Launcher.i18n("crash.NoClassDefFound"));
|
put("java.lang.ClassFormatError", Launcher.i18n("crash.NoClassDefFound"));
|
||||||
put("java.lang.OutOfMemoryError", "FUCKING MEMORY LIMIT!");
|
put("java.lang.OutOfMemoryError", "FUCKING MEMORY LIMIT!");
|
||||||
put("Trampoline", Launcher.i18n("launcher.update_java"));
|
put("Trampoline", Launcher.i18n("launcher.update_java"));
|
||||||
|
put("com.sun.javafx.css.StyleManager.findMatchingStyles", Launcher.i18n("launcher.update_java"));
|
||||||
put("NoSuchAlgorithmException", "Has your operating system been installed completely or is a ghost system?");
|
put("NoSuchAlgorithmException", "Has your operating system been installed completely or is a ghost system?");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user