Default window position to the center of the screen; don't allow width or height to be zero.
This commit is contained in:
parent
3fda1c6efb
commit
8db9c2eb78
@ -1298,11 +1298,12 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
||||
Utils.setConfigInteger("window.y", y);
|
||||
Utils.setConfigInteger("window.w", w);
|
||||
Utils.setConfigInteger("window.h", h);
|
||||
logger.debug("Restored 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 void restoreWindowPosition(Frame frame) {
|
||||
if (!isWindowPositioningEnabled()) {
|
||||
mainFrame.setLocationRelativeTo(null); // default to middle of screen
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@ -1310,8 +1311,9 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
||||
int y = Utils.getConfigInteger("window.y", -1);
|
||||
int w = Utils.getConfigInteger("window.w", -1);
|
||||
int h = Utils.getConfigInteger("window.h", -1);
|
||||
if (x < 0 || y < 0 || w < 0 || h < 0) {
|
||||
if (x < 0 || y < 0 || w <= 0 || h <= 0) {
|
||||
logger.debug("UNUSUAL: One or more of: x, y, w, or h was still less than 0 after reading config");
|
||||
mainFrame.setLocationRelativeTo(null); // default to middle of screen
|
||||
return;
|
||||
}
|
||||
frame.setBounds(x, y, w, h);
|
||||
|
Loading…
Reference in New Issue
Block a user