mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-10-02 18:17:27 +13:00
More window centering fixes
This commit is contained in:
parent
54e1e6369c
commit
374a98d22d
1 changed files with 2 additions and 5 deletions
|
@ -96,6 +96,7 @@ public class AppWindowHelper {
|
||||||
addIcons(stage);
|
addIcons(stage);
|
||||||
setupContent(stage, contentFunc, bindSize, loading);
|
setupContent(stage, contentFunc, bindSize, loading);
|
||||||
setupStylesheets(stage.getScene());
|
setupStylesheets(stage.getScene());
|
||||||
|
fixInvalidStagePosition(stage);
|
||||||
|
|
||||||
if (AppPrefs.get() != null && AppPrefs.get().enforceWindowModality().get()) {
|
if (AppPrefs.get() != null && AppPrefs.get().enforceWindowModality().get()) {
|
||||||
stage.initModality(Modality.WINDOW_MODAL);
|
stage.initModality(Modality.WINDOW_MODAL);
|
||||||
|
@ -171,13 +172,9 @@ public class AppWindowHelper {
|
||||||
Alert a = AppWindowHelper.createEmptyAlert();
|
Alert a = AppWindowHelper.createEmptyAlert();
|
||||||
AppFont.normal(a.getDialogPane());
|
AppFont.normal(a.getDialogPane());
|
||||||
var s = (Stage) a.getDialogPane().getScene().getWindow();
|
var s = (Stage) a.getDialogPane().getScene().getWindow();
|
||||||
|
fixInvalidStagePosition(new Stage());
|
||||||
s.setOnShown(event -> {
|
s.setOnShown(event -> {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
// On some platforms, e.g. KDE with wayland, the screen size is not known when the window is first shown
|
|
||||||
// This fixes the alignment in these cases
|
|
||||||
if (s.getX() == 0 && s.getY() == 0) {
|
|
||||||
s.centerOnScreen();
|
|
||||||
}
|
|
||||||
clampWindow(s).ifPresent(rectangle2D -> {
|
clampWindow(s).ifPresent(rectangle2D -> {
|
||||||
s.setX(rectangle2D.getMinX());
|
s.setX(rectangle2D.getMinX());
|
||||||
s.setY(rectangle2D.getMinY());
|
s.setY(rectangle2D.getMinY());
|
||||||
|
|
Loading…
Reference in a new issue