From 66a45a8f71fee8195af9256a40712e3dd7709fb7 Mon Sep 17 00:00:00 2001 From: Dennis Ushakov Date: Wed, 4 Apr 2012 12:31:12 +0400 Subject: [PATCH] do not add minimize listener if problem is already fixed in JDK --- .../intellij/ui/mac/MacMainFrameDecorator.java | 16 +++++++++------- platform/util/src/com/intellij/Patches.java | 5 +++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ui/mac/MacMainFrameDecorator.java b/platform/platform-impl/src/com/intellij/ui/mac/MacMainFrameDecorator.java index 24a3ebb4b1a1..fe295604c47b 100644 --- a/platform/platform-impl/src/com/intellij/ui/mac/MacMainFrameDecorator.java +++ b/platform/platform-impl/src/com/intellij/ui/mac/MacMainFrameDecorator.java @@ -136,14 +136,16 @@ public class MacMainFrameDecorator implements UISettingsListener, Disposable { final ID pool = invoke("NSAutoreleasePool", "new"); int v = UNIQUE_COUNTER.incrementAndGet(); - frame.addWindowListener(new WindowAdapter() { - @Override - public void windowDeiconified(WindowEvent e) { - if (e.getWindow() == frame && frame.getState() == Frame.ICONIFIED) { - frame.setState(Frame.NORMAL); + if (Patches.APPLE_BUG_ID_10514018) { + frame.addWindowListener(new WindowAdapter() { + @Override + public void windowDeiconified(WindowEvent e) { + if (e.getWindow() == frame && frame.getState() == Frame.ICONIFIED) { + frame.setState(Frame.NORMAL); + } } - } - }); + }); + } try { if (SystemInfo.isMacOSLion) { if (!FULL_SCREEN_AVAILABLE) return; diff --git a/platform/util/src/com/intellij/Patches.java b/platform/util/src/com/intellij/Patches.java index 8008080b4b12..2a542176b2cf 100644 --- a/platform/util/src/com/intellij/Patches.java +++ b/platform/util/src/com/intellij/Patches.java @@ -110,6 +110,11 @@ public class Patches { public static final boolean APPLE_BUG_ID_10207064 = SystemInfo.isMac && (!SystemInfo.isMacOSLeopard || !SystemInfo.isJavaVersionAtLeast("1.6.0_30")); + /** + * Minimizing and restoring application via View | Minimize leads to visual artifacts + */ + public static final boolean APPLE_BUG_ID_10514018 = SystemInfo.isMac && !SystemInfo.isJavaVersionAtLeast("1.6.0_31"); + /** * Index out of bounds at apple.laf.AquaTabbedPaneUI.tabForCoordinate * http://www.jetbrains.net/jira/browse/IDEADEV-15769