From 698b5a5d62a4801e13f69409c79b31a03941128d Mon Sep 17 00:00:00 2001 From: 0xb00bface <0xboobface@gmail.com> Date: Sat, 8 May 2021 14:05:19 +0200 Subject: [PATCH] Restore window location after minimize On windows the window ends up at -32000,-32000, if it gets hidden with stage.hide() after it has been minimized, so we have to restore the location when it is brought back to the front again --- CHANGELOG.md | 5 +++++ client/src/main/java/ctbrec/ui/DesktopIntegration.java | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e7a4699..10015c0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +4.2.1 +======================== +* Fixed bug, which caused the window to stay invisible after being minimized to + tray on windows + 4.2.0 ======================== * App can now be minimized to tray diff --git a/client/src/main/java/ctbrec/ui/DesktopIntegration.java b/client/src/main/java/ctbrec/ui/DesktopIntegration.java index 64187db8..82dfc86c 100644 --- a/client/src/main/java/ctbrec/ui/DesktopIntegration.java +++ b/client/src/main/java/ctbrec/ui/DesktopIntegration.java @@ -23,6 +23,7 @@ import javax.swing.SwingUtilities; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import ctbrec.Config; import ctbrec.OS; import ctbrec.event.EventBusHolder; import ctbrec.io.StreamRedirector; @@ -256,6 +257,9 @@ public class DesktopIntegration { private static void restoreStage(Stage stage) { Platform.runLater(() -> { + stage.setX(Config.getInstance().getSettings().windowX); + stage.setY(Config.getInstance().getSettings().windowY); + LOG.debug("Restoring window location {},{}", stage.getX(), stage.getY()); stage.setIconified(false); stage.show(); stage.toFront();