From 5dab6086eb97813fcb5c14be34522a111dc6e5f6 Mon Sep 17 00:00:00 2001 From: Denis Fokin Date: Tue, 3 Dec 2013 15:22:50 +0400 Subject: [PATCH] IDEA-116059 After upgrade from 12, IDEA opens all new windows very small --- .../openapi/wm/impl/WindowManagerImpl.java | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.java index 984b6551cb82..beda082b3d60 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.java @@ -93,7 +93,7 @@ public final class WindowManagerImpl extends WindowManagerEx implements Applicat } private static final boolean ORACLE_BUG_8007219 = SystemInfo.isMac && SystemInfo.isJavaVersionAtLeast("1.7"); - private static final int ORACLE_BUG_8007219_THRESHOLD = 10; + private static final int ORACLE_BUG_8007219_THRESHOLD = 5; private Boolean myAlphaModeSupported = null; @@ -557,25 +557,36 @@ public final class WindowManagerImpl extends WindowManagerEx implements Applicat private void fixForOracleBug8007219(IdeFrameImpl frame) { if ((myFrameExtendedState & Frame.MAXIMIZED_BOTH) > 0 && ORACLE_BUG_8007219) { - final Rectangle rect = ScreenUtil.getMainScreenBounds(); + final Rectangle screenBounds = ScreenUtil.getMainScreenBounds(); final Insets screenInsets = ScreenUtil.getScreenInsets(frame.getGraphicsConfiguration()); + final int leftGap = myFrameBounds.x - screenInsets.left; - myFrameBounds.x = myFrameBounds.x - screenInsets.left > ORACLE_BUG_8007219_THRESHOLD ? + myFrameBounds.x = leftGap > ORACLE_BUG_8007219_THRESHOLD ? myFrameBounds.x : screenInsets.left + ORACLE_BUG_8007219_THRESHOLD + 1; - myFrameBounds.y = myFrameBounds.y - screenInsets.top > ORACLE_BUG_8007219_THRESHOLD ? + final int topGap = myFrameBounds.y - screenInsets.top; + + myFrameBounds.y = topGap > ORACLE_BUG_8007219_THRESHOLD ? myFrameBounds.y : screenInsets.top + ORACLE_BUG_8007219_THRESHOLD + 1; - myFrameBounds.width = rect.width - (myFrameBounds.width + myFrameBounds.x) > ORACLE_BUG_8007219_THRESHOLD ? - myFrameBounds.width : - rect.width - ORACLE_BUG_8007219_THRESHOLD - 1; + final int maximumFrameWidth = screenBounds.width - screenInsets.right - myFrameBounds.x; - myFrameBounds.height = rect.height - (myFrameBounds.height + myFrameBounds.y) > ORACLE_BUG_8007219_THRESHOLD ? + final int rightGap = maximumFrameWidth - myFrameBounds.width; + + myFrameBounds.width = rightGap > ORACLE_BUG_8007219_THRESHOLD ? + myFrameBounds.width : + maximumFrameWidth - ORACLE_BUG_8007219_THRESHOLD - 1; + + final int maximumFrameHeight = screenBounds.height - screenInsets.bottom - myFrameBounds.y; + + final int bottomGap = maximumFrameHeight - myFrameBounds.height; + + myFrameBounds.height = bottomGap > ORACLE_BUG_8007219_THRESHOLD ? myFrameBounds.height : - rect.height - ORACLE_BUG_8007219_THRESHOLD - 1; + - ORACLE_BUG_8007219_THRESHOLD - 1; } }