From c85e14559052b6f566339dba905b04d315cc6224 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 18 Oct 2017 17:12:51 +0100 Subject: [PATCH] =?utf8?q?JAL-2779=20patch=20so=20closing=20most=20recent=20?= =?utf8?q?frame=20doesn=E2=80=99t=20transfer=20focus=20to=20oldest=20frame=20?= =?utf8?q?on=20the=20stack?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/gui/AquaInternalFrameManager.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/jalview/gui/AquaInternalFrameManager.java b/src/jalview/gui/AquaInternalFrameManager.java index a97d8ec..aeb1e5f 100644 --- a/src/jalview/gui/AquaInternalFrameManager.java +++ b/src/jalview/gui/AquaInternalFrameManager.java @@ -57,6 +57,11 @@ import com.apple.laf.AquaInternalFramePaneUI; * Downloaded from * https://raw.githubusercontent.com/frohoff/jdk8u-jdk/master/src/macosx/classes/com/apple/laf/AquaInternalFrameManager.java * + * Patch from Jim Procter - when the most recently opened frame is closed, + * correct behaviour is to go to the next most recent frame, rather than wrap + * around to the bottom of the window stack (as the original implementation + * does) + * * @see com.sun.java.swing.plaf.windows.WindowsDesktopManager */ public class AquaInternalFrameManager extends DefaultDesktopManager @@ -86,7 +91,16 @@ public class AquaInternalFrameManager extends DefaultDesktopManager { if (f == fCurrentFrame) { - activateNextFrame(); + boolean mostRecentFrame = fChildFrames + .indexOf(f) == fChildFrames.size() - 1; + if (!mostRecentFrame) + { + activateNextFrame(); + } + else + { + activatePreviousFrame(); + } } fChildFrames.removeElement(f); super.closeFrame(f); -- 1.7.10.2