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
This commit is contained in:
0xb00bface 2021-05-08 14:05:19 +02:00
parent f366b9c5e9
commit 698b5a5d62
2 changed files with 9 additions and 0 deletions

View File

@ -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

View File

@ -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();