From ae2a2d10eb574861ae6b5a4f6012ee9df04c7926 Mon Sep 17 00:00:00 2001 From: crschnick Date: Wed, 21 Aug 2024 13:04:55 +0000 Subject: [PATCH] Various fixes [stage] --- app/build.gradle | 2 +- .../file/BrowserQuickAccessContextMenu.java | 2 +- .../xpipe/app/comp/base/MultiContentComp.java | 40 ++++++++++++++++--- .../core/window/NativeMacOsWindowControl.java | 2 +- .../app/prefs/WorkspaceCreationAlert.java | 6 +-- dist/licenses/github-api.properties | 2 +- version | 2 +- 7 files changed, 42 insertions(+), 14 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5018f0c97..0160355de 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -52,7 +52,7 @@ dependencies { api files("$rootDir/gradle/gradle_scripts/vernacular-1.16.jar") api 'org.bouncycastle:bcprov-jdk18on:1.78.1' api 'info.picocli:picocli:4.7.6' - api ('org.kohsuke:github-api:1.323') { + api ('org.kohsuke:github-api:1.324') { exclude group: 'org.apache.commons', module: 'commons-lang3' } api 'org.apache.commons:commons-lang3:3.16.0' diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserQuickAccessContextMenu.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserQuickAccessContextMenu.java index 9052f654f..83d3d6a33 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserQuickAccessContextMenu.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserQuickAccessContextMenu.java @@ -79,7 +79,7 @@ public class BrowserQuickAccessContextMenu extends ContextMenu { getItems().addAll(r.getItems()); // Prevent NPE in show() - if (getScene() == null || anchor == null) { + if (getScene() == null || anchor == null || anchor.getScene() == null) { return; } show(anchor, Side.RIGHT, 0, 0); diff --git a/app/src/main/java/io/xpipe/app/comp/base/MultiContentComp.java b/app/src/main/java/io/xpipe/app/comp/base/MultiContentComp.java index 9dbfacb8c..89e388ac9 100644 --- a/app/src/main/java/io/xpipe/app/comp/base/MultiContentComp.java +++ b/app/src/main/java/io/xpipe/app/comp/base/MultiContentComp.java @@ -3,8 +3,11 @@ package io.xpipe.app.comp.base; import io.xpipe.app.fxcomps.Comp; import io.xpipe.app.fxcomps.SimpleComp; import io.xpipe.app.fxcomps.util.PlatformThread; + import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; +import javafx.collections.MapChangeListener; +import javafx.collections.ObservableMap; import javafx.scene.layout.Region; import javafx.scene.layout.StackPane; @@ -20,22 +23,49 @@ public class MultiContentComp extends SimpleComp { @Override protected Region createSimple() { + ObservableMap, Region> m = FXCollections.observableHashMap(); var stack = new StackPane(); + m.addListener((MapChangeListener, Region>) change -> { + if (change.wasAdded()) { + stack.getChildren().add(change.getValueAdded()); + } else { + stack.getChildren().remove(change.getValueRemoved()); + } + }); + for (Map.Entry, ObservableValue> e : content.entrySet()) { var r = e.getKey().createRegion(); e.getValue().subscribe(val -> { PlatformThread.runLaterIfNeeded(() -> { r.setManaged(val); r.setVisible(val); - if (val && !stack.getChildren().contains(r)) { - stack.getChildren().add(r); - } else { - stack.getChildren().remove(r); - } }); }); + m.put(e.getKey(), r); } return stack; } + +// Lazy impl +// @Override +// protected Region createSimple() { +// var stack = new StackPane(); +// for (Map.Entry, ObservableValue> e : content.entrySet()) { +// var r = e.getKey().createRegion(); +// e.getValue().subscribe(val -> { +// PlatformThread.runLaterIfNeeded(() -> { +// r.setManaged(val); +// r.setVisible(val); +// if (val && !stack.getChildren().contains(r)) { +// stack.getChildren().add(r); +// } else { +// stack.getChildren().remove(r); +// } +// }); +// }); +// } +// +// return stack; +// } } diff --git a/app/src/main/java/io/xpipe/app/core/window/NativeMacOsWindowControl.java b/app/src/main/java/io/xpipe/app/core/window/NativeMacOsWindowControl.java index 30dbc0c27..0375fcd3b 100644 --- a/app/src/main/java/io/xpipe/app/core/window/NativeMacOsWindowControl.java +++ b/app/src/main/java/io/xpipe/app/core/window/NativeMacOsWindowControl.java @@ -46,7 +46,7 @@ public class NativeMacOsWindowControl { try { lib.get().setAppearance(new NativeLong(nsWindow), seamlessFrame, darkMode); if (seamlessFrame) { - ThreadHelper.sleep(100); + ThreadHelper.sleep(250); } } catch (Throwable e) { ErrorEvent.fromThrowable(e).handle(); diff --git a/app/src/main/java/io/xpipe/app/prefs/WorkspaceCreationAlert.java b/app/src/main/java/io/xpipe/app/prefs/WorkspaceCreationAlert.java index 83891d116..ba9c7a919 100644 --- a/app/src/main/java/io/xpipe/app/prefs/WorkspaceCreationAlert.java +++ b/app/src/main/java/io/xpipe/app/prefs/WorkspaceCreationAlert.java @@ -6,10 +6,7 @@ import io.xpipe.app.core.AppProperties; import io.xpipe.app.core.mode.OperationMode; import io.xpipe.app.core.window.AppWindowHelper; import io.xpipe.app.issue.ErrorEvent; -import io.xpipe.app.util.DesktopHelper; -import io.xpipe.app.util.DesktopShortcuts; -import io.xpipe.app.util.OptionsBuilder; -import io.xpipe.app.util.ThreadHelper; +import io.xpipe.app.util.*; import io.xpipe.core.process.OsType; import io.xpipe.core.util.XPipeInstallation; @@ -24,6 +21,7 @@ import java.nio.file.Files; public class WorkspaceCreationAlert { public static void showAsync() { + LicenseProvider.get().getFeature("workspaces").throwIfUnsupported(); ThreadHelper.runFailableAsync(() -> { show(); }); diff --git a/dist/licenses/github-api.properties b/dist/licenses/github-api.properties index 6a028ae6f..bf80eed48 100644 --- a/dist/licenses/github-api.properties +++ b/dist/licenses/github-api.properties @@ -1,4 +1,4 @@ name=Java API for GitHub -version=1.321 +version=1.324 license=MIT License link=https://github.com/hub4j/github-api \ No newline at end of file diff --git a/version b/version index 7ba4ff47d..57452c51b 100644 --- a/version +++ b/version @@ -1 +1 @@ -11.0-14 +11.0-15