Do not manually position window on Windows to work around javaw.exe not closing. (Closes 4pr0n/ripme#412, Closes RipMeApp/ripme#70)
This commit is contained in:
parent
15a0c39a3b
commit
4ef73a0c07
@ -1333,11 +1333,26 @@ public final class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
logger.debug("Saved window position (x=" + x + ", y=" + y + ", w=" + w + ", h=" + h + ")");
|
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) {
|
public static void restoreWindowPosition(Frame frame) {
|
||||||
if (!isWindowPositioningEnabled()) {
|
if (!isWindowPositioningEnabled() || hasWindowPositionBug()) {
|
||||||
mainFrame.setLocationRelativeTo(null); // default to middle of screen
|
mainFrame.setLocationRelativeTo(null); // default to middle of screen
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int x = Utils.getConfigInteger("window.x", -1);
|
int x = Utils.getConfigInteger("window.x", -1);
|
||||||
int y = Utils.getConfigInteger("window.y", -1);
|
int y = Utils.getConfigInteger("window.y", -1);
|
||||||
|
Loading…
Reference in New Issue
Block a user