IDEA-210941 Project window does not remember its position and size when it is opened from Welcome screen

GitOrigin-RevId: 926261be50f6166fcb3cb3065994043c2035be2b
This commit is contained in:
develar
2019-04-29 18:00:28 +03:00
committed by intellij-monorepo-bot
parent a84c574ef5
commit dc84439e3d
@@ -36,7 +36,7 @@ class ProjectFrameBounds(private val project: Project) : PersistentStateComponen
}
override fun getModificationCount(): Long {
val frameInfoInDeviceSpace = (WindowManager.getInstance() as? WindowManagerImpl)?.getFrameInfoInDeviceSpace(project, rawFrameInfo)
val frameInfoInDeviceSpace = (WindowManager.getInstance() as? WindowManagerImpl)?.let { getFrameInfoInDeviceSpace(it, project, rawFrameInfo) }
if (frameInfoInDeviceSpace != null) {
if (rawFrameInfo == null) {
rawFrameInfo = frameInfoInDeviceSpace
@@ -57,11 +57,15 @@ class FrameInfo : BaseState() {
@get:Attribute var fullScreen by property(false)
}
fun WindowManagerImpl.getFrameInfoInDeviceSpace(project: Project, prev: FrameInfo?): FrameInfo? {
val frame = getFrame(project) ?: return null
internal fun getFrameInfoInDeviceSpace(windowManagerImpl: WindowManagerImpl, project: Project, prev: FrameInfo?): FrameInfo? {
val frame = windowManagerImpl.getFrame(project) ?: return null
// updateFrameBounds will also update myDefaultFrameInfo,
// so, we have to call this method before other code in this method and if later extendedState is used only for macOS
val extendedState = windowManagerImpl.updateFrameBounds(frame)
// save bounds even if maximized because on unmaximize we must restore previous frame bounds
val deviceSpaceBounds = convertToDeviceSpace(frame.graphicsConfiguration, myDefaultFrameInfo.bounds ?: return null)
val deviceSpaceBounds = convertToDeviceSpace(frame.graphicsConfiguration, windowManagerImpl.myDefaultFrameInfo.bounds ?: return null)
// don't report if was already reported
if (prev?.bounds != deviceSpaceBounds && !ScreenUtil.intersectsVisibleScreen(frame)) {
@@ -70,12 +74,8 @@ fun WindowManagerImpl.getFrameInfoInDeviceSpace(project: Project, prev: FrameInf
val frameInfo = FrameInfo()
frameInfo.bounds = deviceSpaceBounds
// updateFrameBounds will also update myDefaultFrameInfo,
// so, we have to call this method before other code in this method and if later extendedState is used only for macOS
frameInfo.extendedState = updateFrameBounds(frame)
if (isFullScreenSupportedInCurrentOS) {
frameInfo.extendedState = extendedState
if (windowManagerImpl.isFullScreenSupportedInCurrentOS) {
frameInfo.fullScreen = frame.isInFullScreen
}
return frameInfo