This commit is contained in:
crschnick
2026-04-04 03:14:52 +00:00
parent 89eb84fb8a
commit 17985cdee3
3 changed files with 19 additions and 25 deletions

View File

@@ -85,6 +85,11 @@ public class AppAuxiliaryWindow {
stage.setHeight(780);
stage.titleProperty().bind(PlatformThread.sync(createTitle()));
// We close this automatically after all children are gone
stage.setOnCloseRequest(event -> {
event.consume();
});
if (AppPrefs.get() != null) {
stage.opacityProperty().bind(PlatformThread.sync(AppPrefs.get().windowOpacity()));
}
@@ -94,23 +99,23 @@ public class AppAuxiliaryWindow {
AppWindowStyle.addFontSize(stage);
AppTheme.initThemeHandlers(stage);
if (state != null) {
if (state.maximized) {
stage.setMaximized(true);
} else {
stage.setX(state.windowX);
stage.setY(state.windowY);
stage.setWidth(state.windowWidth);
stage.setHeight(state.windowHeight);
}
}
setupWindowListeners();
}
private void applyStageState() {
if (state != null) {
stage.setX(state.windowX);
stage.setY(state.windowY);
stage.setWidth(state.windowWidth);
stage.setHeight(state.windowHeight);
stage.setMaximized(state.maximized);
}
}
public void show() {
PlatformThread.runLaterIfNeededBlocking(() -> {
createStage();
applyStageState();
stage.show();
nativeWinWindowControl = new NativeWinWindowControl(stage);
nativeWinWindowControl.setWindowsTransitionsEnabled(false);
@@ -179,7 +184,7 @@ public class AppAuxiliaryWindow {
private void startStateListener() {
GlobalTimer.scheduleUntil(Duration.ofMillis(500), false, () -> {
if (stage == null || !stage.isShowing()) {
if (stage == null) {
return false;
}
@@ -222,13 +227,6 @@ public class AppAuxiliaryWindow {
stage.maximizedProperty().addListener((c, o, n) -> {
onWindowStateChange();
locked.set(false);
Platform.runLater(() -> {
stage.setWidth(state.getWindowWidth());
stage.setHeight(state.getWindowHeight());
});
});
locked.addListener((v, o, n) -> {
stage.setResizable(!n);
});
}

View File

@@ -91,10 +91,6 @@ public class AuxDockImpl implements WindowDockListener {
var p = e.getProcess();
if (p.isRunning()) {
// Reset style in case close is prevented by application
p.restoreIcon();
p.disown();
p.restoreStyle(true);
p.close();
}

View File

@@ -103,7 +103,7 @@ public class WindowDockComp<T extends WindowDockListener> extends SimpleRegionBu
s.heightProperty().removeListener(update);
s.iconifiedProperty().removeListener(iconified);
s.removeEventFilter(WindowEvent.WINDOW_SHOWN, show);
s.removeEventFilter(WindowEvent.WINDOW_HIDING, hide);
s.removeEventFilter(WindowEvent.WINDOW_CLOSE_REQUEST, hide);
s.outputScaleXProperty().addListener(scale);
if (parent.get() != null) {
parent.get().boundsInParentProperty().removeListener(bounds);
@@ -118,7 +118,7 @@ public class WindowDockComp<T extends WindowDockListener> extends SimpleRegionBu
s.iconifiedProperty().addListener(iconified);
s.outputScaleXProperty().removeListener(scale);
s.addEventFilter(WindowEvent.WINDOW_SHOWN, show);
s.addEventFilter(WindowEvent.WINDOW_HIDING, hide);
s.addEventFilter(WindowEvent.WINDOW_CLOSE_REQUEST, hide);
// As in practice this node is wrapped in another stack pane
// We have to listen to the parent bounds to actually receive bounds changes
stack.getParent().boundsInParentProperty().addListener(bounds);