mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-35490 Maximized IDEA main window forgets it's non-maximum size after restart
This commit is contained in:
@@ -612,7 +612,12 @@ public final class WindowManagerImpl extends WindowManagerEx implements NamedCom
|
||||
}
|
||||
|
||||
frame.addWindowListener(myActivationListener);
|
||||
|
||||
frame.addComponentListener(new ComponentAdapter() {
|
||||
@Override
|
||||
public void componentMoved(@NotNull ComponentEvent e) {
|
||||
updateFrameBounds(frame);
|
||||
}
|
||||
});
|
||||
myEventDispatcher.getMulticaster().frameCreated(frame);
|
||||
|
||||
return frame;
|
||||
@@ -778,7 +783,21 @@ public final class WindowManagerImpl extends WindowManagerEx implements NamedCom
|
||||
return null;
|
||||
}
|
||||
|
||||
int extendedState = updateFrameBounds(frame);
|
||||
Rectangle rectangle = myFrameBounds;
|
||||
final Element frameElement = new Element(FRAME_ELEMENT);
|
||||
frameElement.setAttribute(X_ATTR, Integer.toString(rectangle.x));
|
||||
frameElement.setAttribute(Y_ATTR, Integer.toString(rectangle.y));
|
||||
frameElement.setAttribute(WIDTH_ATTR, Integer.toString(rectangle.width));
|
||||
frameElement.setAttribute(HEIGHT_ATTR, Integer.toString(rectangle.height));
|
||||
|
||||
if (!(frame.isInFullScreen() && SystemInfo.isAppleJvm)) {
|
||||
frameElement.setAttribute(EXTENDED_STATE_ATTR, Integer.toString(extendedState));
|
||||
}
|
||||
return frameElement;
|
||||
}
|
||||
|
||||
private int updateFrameBounds(IdeFrameImpl frame) {
|
||||
int extendedState = frame.getExtendedState();
|
||||
if (SystemInfo.isMacOSLion) {
|
||||
@SuppressWarnings("deprecation") ComponentPeer peer = frame.getPeer();
|
||||
@@ -792,16 +811,10 @@ public final class WindowManagerImpl extends WindowManagerEx implements NamedCom
|
||||
boolean usePreviousBounds = isMaximized &&
|
||||
myFrameBounds != null &&
|
||||
frame.getBounds().contains(new Point((int)myFrameBounds.getCenterX(), (int)myFrameBounds.getCenterY()));
|
||||
Rectangle rectangle = usePreviousBounds ? myFrameBounds : frame.getBounds();
|
||||
frameElement.setAttribute(X_ATTR, Integer.toString(rectangle.x));
|
||||
frameElement.setAttribute(Y_ATTR, Integer.toString(rectangle.y));
|
||||
frameElement.setAttribute(WIDTH_ATTR, Integer.toString(rectangle.width));
|
||||
frameElement.setAttribute(HEIGHT_ATTR, Integer.toString(rectangle.height));
|
||||
|
||||
if (!(frame.isInFullScreen() && SystemInfo.isAppleJvm)) {
|
||||
frameElement.setAttribute(EXTENDED_STATE_ATTR, Integer.toString(extendedState));
|
||||
if (!usePreviousBounds) {
|
||||
myFrameBounds = frame.getBounds();
|
||||
}
|
||||
return frameElement;
|
||||
return extendedState;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user