From 0ca5a60ca575f0d0e6aeea158485f16cd61df082 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 20 Oct 2017 17:03:19 +0100 Subject: [PATCH] JAL-2779 keep a reference to original Aqua manager so we can iconise/deiconise windows still --- src/jalview/gui/AquaInternalFrameManager.java | 35 ++++++++++--------------- src/jalview/gui/Desktop.java | 3 ++- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/jalview/gui/AquaInternalFrameManager.java b/src/jalview/gui/AquaInternalFrameManager.java index b96892b..ea809eb 100644 --- a/src/jalview/gui/AquaInternalFrameManager.java +++ b/src/jalview/gui/AquaInternalFrameManager.java @@ -26,11 +26,11 @@ package jalview.gui; import java.awt.Container; -import java.awt.Rectangle; import java.beans.PropertyVetoException; import java.util.Vector; import javax.swing.DefaultDesktopManager; +import javax.swing.DesktopManager; import javax.swing.JInternalFrame; /** @@ -82,6 +82,17 @@ public class AquaInternalFrameManager extends DefaultDesktopManager */ Vector fChildFrames = new Vector<>(1); + /** + * keep a reference to the original LAF manager so we can iconise/de-iconise + * correctly + */ + private DesktopManager ourManager; + + public AquaInternalFrameManager(DesktopManager desktopManager) + { + ourManager = desktopManager; + } + @Override public void closeFrame(final JInternalFrame f) { @@ -112,7 +123,7 @@ public class AquaInternalFrameManager extends DefaultDesktopManager // reshape does delta checks for us f.reshape(desktopIcon.getX(), desktopIcon.getY(), f.getWidth(), f.getHeight()); - super.deiconifyFrame(f); + ourManager.deiconifyFrame(f); } void addIcon(final Container c, @@ -127,25 +138,7 @@ public class AquaInternalFrameManager extends DefaultDesktopManager @Override public void iconifyFrame(final JInternalFrame f) { - // Same as super except doesn't deactivate it - JInternalFrame.JDesktopIcon desktopIcon; - Container c; - - desktopIcon = f.getDesktopIcon(); - // Position depends on *current* position of frame, unlike super which - // reuses the first position - final Rectangle r = getBoundsForIconOf(f); - desktopIcon.setBounds(r.x, r.y, r.width, r.height); - - c = f.getParent(); - if (c == null) - { - return; - } - - c.remove(f); - addIcon(c, desktopIcon); - c.repaint(f.getX(), f.getY(), f.getWidth(), f.getHeight()); + ourManager.iconifyFrame(f); } // WindowsDesktopManager code diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 8ca22b5..5366d1f 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -360,7 +360,8 @@ public class Desktop extends jalview.jbgui.GDesktop new MyDesktopManager( (Platform.isWindows() ? new DefaultDesktopManager() : Platform.isAMac() - ? new AquaInternalFrameManager() + ? new AquaInternalFrameManager( + desktop.getDesktopManager()) : desktop.getDesktopManager()))); Rectangle dims = getLastKnownDimensions(""); -- 1.7.10.2