From dd0138b3903bab623c734f3ed6b8063cd5f5028d Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Mon, 29 May 2017 16:33:56 +0300 Subject: [PATCH] remove old key in WindowStateServiceImpl --- .../openapi/util/WindowStateServiceImpl.java | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/util/WindowStateServiceImpl.java b/platform/platform-impl/src/com/intellij/openapi/util/WindowStateServiceImpl.java index 21b5e6555db8..2f7bc2dc6891 100644 --- a/platform/platform-impl/src/com/intellij/openapi/util/WindowStateServiceImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/util/WindowStateServiceImpl.java @@ -278,12 +278,15 @@ abstract class WindowStateServiceImpl extends WindowStateService implements Pers boolean maximized, boolean maximizedSet, boolean fullScreen, boolean fullScreenSet) { WindowState state = myStateMap.get(keyPair.first); - if (state == null) { - // may be convert the old key state to the new key - state = myStateMap.remove(oldKeyPair.first); + + // may be convert the old key state to the new key + WindowState oldState = myStateMap.remove(oldKeyPair.first); + if (oldState != null) { + oldState.scaleDown(oldKeyPair.second); if (state != null) { - state.scaleDown(oldKeyPair.second); - myStateMap.put(keyPair.first, state); + state.merge(oldState); + } else { + myStateMap.put(keyPair.first, state = oldState); } } if (state != null) { @@ -459,6 +462,18 @@ abstract class WindowStateServiceImpl extends WindowStateService implements Pers } return myLocation != null || mySize != null; } + + /** + * Merges this state with the passed one, prefering this state. + */ + private void merge(@NotNull WindowState state) { + if (myLocation == null && state.myLocation != null) { + myLocation = state.myLocation.getLocation(); + } + if (mySize == null && state.mySize != null) { + mySize = state.mySize.getSize(); + } + } } private static boolean isVisible(WindowState state) {