mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-07-07 07:16:14 +12:00
Fixes
This commit is contained in:
parent
79c2070d19
commit
69a55884af
|
@ -21,6 +21,7 @@ import javafx.scene.layout.Region;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.stage.Screen;
|
import javafx.stage.Screen;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
import javafx.stage.StageStyle;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Value;
|
import lombok.Value;
|
||||||
|
@ -52,6 +53,7 @@ public class AppMainWindow {
|
||||||
INSTANCE = new AppMainWindow(stage);
|
INSTANCE = new AppMainWindow(stage);
|
||||||
var scene = new Scene(new Region(), -1, -1, false);
|
var scene = new Scene(new Region(), -1, -1, false);
|
||||||
scene.setFill(Color.TRANSPARENT);
|
scene.setFill(Color.TRANSPARENT);
|
||||||
|
stage.initStyle(StageStyle.UNIFIED);
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
AppWindowHelper.setupStylesheets(stage.getScene());
|
AppWindowHelper.setupStylesheets(stage.getScene());
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.xpipe.app.core.window;
|
package io.xpipe.app.core.window;
|
||||||
|
|
||||||
|
import io.xpipe.app.fxcomps.util.PlatformThread;
|
||||||
import io.xpipe.app.prefs.AppPrefs;
|
import io.xpipe.app.prefs.AppPrefs;
|
||||||
import io.xpipe.core.process.OsType;
|
import io.xpipe.core.process.OsType;
|
||||||
import javafx.animation.PauseTransition;
|
import javafx.animation.PauseTransition;
|
||||||
|
@ -24,13 +25,23 @@ public class ModifiedStage extends Stage {
|
||||||
if (c.next() && c.wasAdded()) {
|
if (c.next() && c.wasAdded()) {
|
||||||
var added = c.getAddedSubList().getFirst();
|
var added = c.getAddedSubList().getFirst();
|
||||||
if (added instanceof Stage stage) {
|
if (added instanceof Stage stage) {
|
||||||
applyStage(stage);
|
hookUpStage(stage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void applyStage(Stage stage) {
|
private static void hookUpStage(Stage stage) {
|
||||||
|
applyModes(stage);
|
||||||
|
AppPrefs.get().theme.addListener((observable, oldValue, newValue) -> {
|
||||||
|
updateStage(stage);
|
||||||
|
});
|
||||||
|
AppPrefs.get().performanceMode().addListener((observable, oldValue, newValue) -> {
|
||||||
|
updateStage(stage);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void applyModes(Stage stage) {
|
||||||
if (OsType.getLocal() != OsType.WINDOWS || AppPrefs.get() == null) {
|
if (OsType.getLocal() != OsType.WINDOWS || AppPrefs.get() == null) {
|
||||||
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("seamless-frame"), false);
|
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("seamless-frame"), false);
|
||||||
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("separate-frame"), true);
|
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("separate-frame"), true);
|
||||||
|
@ -47,23 +58,23 @@ public class ModifiedStage extends Stage {
|
||||||
}
|
}
|
||||||
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("seamless-frame"), backdrop);
|
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("seamless-frame"), backdrop);
|
||||||
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("separate-frame"), !backdrop);
|
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("separate-frame"), !backdrop);
|
||||||
|
}
|
||||||
|
|
||||||
AppPrefs.get().theme.addListener((observable, oldValue, newValue) -> {
|
private static void updateStage(Stage stage) {
|
||||||
if (!stage.isShowing()) {
|
if (!stage.isShowing()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform.runLater(() -> {
|
PlatformThread.runLaterIfNeeded(() -> {
|
||||||
var transition = new PauseTransition(Duration.millis(300));
|
var transition = new PauseTransition(Duration.millis(300));
|
||||||
transition.setOnFinished(e -> {
|
transition.setOnFinished(e -> {
|
||||||
applyStage(stage);
|
applyModes(stage);
|
||||||
stage.setWidth(stage.getWidth() - 1);
|
stage.setWidth(stage.getWidth() - 1);
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
stage.setWidth(stage.getWidth() + 1);
|
stage.setWidth(stage.getWidth() + 1);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
transition.play();
|
|
||||||
});
|
});
|
||||||
|
transition.play();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue