diff --git a/src/main/java/com/rarchives/ripme/ui/MainWindow.java b/src/main/java/com/rarchives/ripme/ui/MainWindow.java index 71a93276..8b54e180 100644 --- a/src/main/java/com/rarchives/ripme/ui/MainWindow.java +++ b/src/main/java/com/rarchives/ripme/ui/MainWindow.java @@ -1333,11 +1333,26 @@ public final class MainWindow implements Runnable, RipStatusHandler { logger.debug("Saved window position (x=" + x + ", y=" + y + ", w=" + w + ", h=" + h + ")"); } + public static boolean hasWindowPositionBug() { + String osName = System.getProperty("os.name"); + if (osName != null) { + // Java on Windows has a bug where if we try to manually set the position of the Window, + // javaw.exe will not close itself down when the application is closed. + // Therefore, even if isWindowPositioningEnabled, if we are on Windows, we ignore it. + return osName.startsWith("Windows"); + } else { + // If we're unsure, since we know there might be a bug, + // better be safe and report that the bug exists. + return true; + } + } + public static void restoreWindowPosition(Frame frame) { - if (!isWindowPositioningEnabled()) { + if (!isWindowPositioningEnabled() || hasWindowPositionBug()) { mainFrame.setLocationRelativeTo(null); // default to middle of screen return; } + try { int x = Utils.getConfigInteger("window.x", -1); int y = Utils.getConfigInteger("window.y", -1);