From d01403c8a252362567ace8dd3107b41a547d6bc2 Mon Sep 17 00:00:00 2001 From: crschnick Date: Fri, 15 Nov 2024 09:53:03 +0000 Subject: [PATCH] Various fixes [stage] --- .../app/browser/BrowserSessionTabsComp.java | 2 +- .../file/BrowserFileListFilterComp.java | 4 + .../io/xpipe/app/comp/base/FilterComp.java | 1 + .../xpipe/app/terminal/TerminalDockComp.java | 112 +++++++++++------- .../io/xpipe/app/resources/style/browser.css | 1 + .../xpipe/app/resources/style/dialog-comp.css | 2 +- version | 2 +- 7 files changed, 81 insertions(+), 43 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserSessionTabsComp.java b/app/src/main/java/io/xpipe/app/browser/BrowserSessionTabsComp.java index 10822d6f9..2f4055c10 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserSessionTabsComp.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserSessionTabsComp.java @@ -57,7 +57,7 @@ public class BrowserSessionTabsComp extends SimpleComp { var tabs = createTabPane(); var topBackground = Comp.hspacer().styleClass("top-spacer").createRegion(); leftPadding.subscribe(number -> { - StackPane.setMargin(topBackground, new Insets(0, 0, 0, -number.doubleValue())); + StackPane.setMargin(topBackground, new Insets(0, 0, 0, -number.doubleValue() - 6)); }); var stack = new StackPane(topBackground, tabs); stack.setAlignment(Pos.TOP_CENTER); diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListFilterComp.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListFilterComp.java index 00cb13b49..15bc918bb 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListFilterComp.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListFilterComp.java @@ -37,6 +37,10 @@ public class BrowserFileListFilterComp extends Comp { + if (!expanded.get()) { + return; + } + text.clear(); button.fire(); keyEvent.consume(); diff --git a/app/src/main/java/io/xpipe/app/comp/base/FilterComp.java b/app/src/main/java/io/xpipe/app/comp/base/FilterComp.java index 6e4ee8a14..025382f06 100644 --- a/app/src/main/java/io/xpipe/app/comp/base/FilterComp.java +++ b/app/src/main/java/io/xpipe/app/comp/base/FilterComp.java @@ -58,6 +58,7 @@ public class FilterComp extends Comp> { filter.addEventFilter(KeyEvent.KEY_PRESSED, event -> { if (new KeyCodeCombination(KeyCode.ESCAPE).match(event)) { + filter.clear(); filter.getScene().getRoot().requestFocus(); event.consume(); } diff --git a/app/src/main/java/io/xpipe/app/terminal/TerminalDockComp.java b/app/src/main/java/io/xpipe/app/terminal/TerminalDockComp.java index f9ec2d94a..ba9a12071 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TerminalDockComp.java +++ b/app/src/main/java/io/xpipe/app/terminal/TerminalDockComp.java @@ -4,6 +4,9 @@ import io.xpipe.app.comp.SimpleComp; import io.xpipe.app.core.AppI18n; import io.xpipe.app.core.window.AppMainWindow; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.event.EventHandler; import javafx.geometry.Pos; import javafx.scene.Cursor; import javafx.scene.control.Label; @@ -29,46 +32,6 @@ public class TerminalDockComp extends SimpleComp { stack.boundsInParentProperty().addListener((observable, oldValue, newValue) -> { update(stack); }); - var s = AppMainWindow.getInstance().getStage(); - s.xProperty().addListener((observable, oldValue, newValue) -> { - update(stack); - }); - s.yProperty().addListener((observable, oldValue, newValue) -> { - update(stack); - }); - s.widthProperty().addListener((observable, oldValue, newValue) -> { - update(stack); - }); - s.heightProperty().addListener((observable, oldValue, newValue) -> { - update(stack); - }); - s.iconifiedProperty().addListener((observable, oldValue, newValue) -> { - if (newValue) { - model.onWindowMinimize(); - } else { - model.onWindowActivate(); - } - }); - s.focusedProperty().addListener((observable, oldValue, newValue) -> { - if (newValue) { - model.onFocusGain(); - } else { - model.onFocusLost(); - } - }); - s.addEventFilter(WindowEvent.WINDOW_SHOWN, event -> { - update(stack); - }); - s.addEventFilter(WindowEvent.WINDOW_HIDING, event -> { - model.onClose(); - }); - s.focusedProperty().addListener((observable, oldValue, newValue) -> { - if (newValue) { - model.onFocusGain(); - } else { - model.onFocusLost(); - } - }); stack.setOnMouseClicked(event -> { model.clickView(); event.consume(); @@ -76,9 +39,78 @@ public class TerminalDockComp extends SimpleComp { stack.getStyleClass().add("terminal-dock-comp"); stack.setMinWidth(100); stack.setMinHeight(100); + setupListeners(stack); return stack; } + private void setupListeners(StackPane stack) { + var s = AppMainWindow.getInstance().getStage(); + + var update = new ChangeListener() { + @Override + public void changed(ObservableValue observable, Number oldValue, Number newValue) { + update(stack); + } + }; + s.xProperty().addListener(update); + s.yProperty().addListener(update); + s.widthProperty().addListener(update); + s.heightProperty().addListener(update); + + var iconified = new ChangeListener() { + @Override + public void changed(ObservableValue observable, Boolean oldValue, Boolean newValue) { + if (newValue) { + model.onWindowMinimize(); + } else { + model.onWindowActivate(); + } + } + }; + s.iconifiedProperty().addListener(iconified); + + var focus = new ChangeListener() { + @Override + public void changed(ObservableValue observable, Boolean oldValue, Boolean newValue) { + if (newValue) { + model.onFocusGain(); + } else { + model.onFocusLost(); + } + } + }; + s.focusedProperty().addListener(focus); + + var show = new EventHandler() { + @Override + public void handle(WindowEvent event) { + update(stack); + } + }; + s.addEventFilter(WindowEvent.WINDOW_SHOWN, show); + + var hide = new EventHandler() { + @Override + public void handle(WindowEvent event) { + update(stack); + } + }; + s.addEventFilter(WindowEvent.WINDOW_HIDING, hide); + + stack.sceneProperty().addListener((observable, oldValue, newValue) -> { + if (oldValue != null && newValue == null) { + s.xProperty().removeListener(update); + s.yProperty().removeListener(update); + s.widthProperty().removeListener(update); + s.heightProperty().removeListener(update); + s.iconifiedProperty().removeListener(iconified); + s.focusedProperty().removeListener(focus); + s.removeEventFilter(WindowEvent.WINDOW_SHOWN, show); + s.removeEventFilter(WindowEvent.WINDOW_HIDING, hide); + } + }); + } + private void update(Region region) { if (region.getScene() == null || region.getScene().getWindow() == null) { return; diff --git a/app/src/main/resources/io/xpipe/app/resources/style/browser.css b/app/src/main/resources/io/xpipe/app/resources/style/browser.css index 06c01d8d0..e54d13123 100644 --- a/app/src/main/resources/io/xpipe/app/resources/style/browser.css +++ b/app/src/main/resources/io/xpipe/app/resources/style/browser.css @@ -51,6 +51,7 @@ -fx-background-color: -color-bg-inset; -fx-border-width: 0 0 1 0; -fx-border-color: -color-border-default; + -fx-opacity: 0.7; } .root:seamless-frame .browser .top-spacer { diff --git a/app/src/main/resources/io/xpipe/app/resources/style/dialog-comp.css b/app/src/main/resources/io/xpipe/app/resources/style/dialog-comp.css index 323ce4ef9..0c8299744 100644 --- a/app/src/main/resources/io/xpipe/app/resources/style/dialog-comp.css +++ b/app/src/main/resources/io/xpipe/app/resources/style/dialog-comp.css @@ -16,6 +16,6 @@ .dialog-comp .buttons { -fx-padding: 10; -fx-border-color: -color-border-default; - -fx-background-color: -color-bg-overlay; + -fx-background-color: -color-bg-subtle; -fx-border-width: 1 0 0 0; } diff --git a/version b/version index 51369fd5f..3a63d297f 100644 --- a/version +++ b/version @@ -1 +1 @@ -13.0-18 +13.0-19