From 725f1f4a7e1448349bf7dd5f8efb1370de5b9a3e Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 15 Sep 2017 16:05:12 +0100 Subject: [PATCH] =?utf8?q?JAL-1625=20ensure=20we=20don=E2=80=99t=20regress=20?= =?utf8?q?on=20JAL-20=20-=20we=20always=20use=20the=20DefaultDesktopManager=20?= =?utf8?q?on=20Windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/gui/Desktop.java | 6 +++++- src/jalview/util/Platform.java | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 83d1e3e..1f8983f 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -41,6 +41,7 @@ import jalview.structure.StructureSelectionManager; import jalview.urls.IdOrgSettings; import jalview.util.ImageMaker; import jalview.util.MessageManager; +import jalview.util.Platform; import jalview.util.UrlConstants; import jalview.viewmodel.AlignmentViewport; import jalview.ws.params.ParamManager; @@ -94,6 +95,7 @@ import java.util.concurrent.Semaphore; import javax.swing.AbstractAction; import javax.swing.Box; import javax.swing.BoxLayout; +import javax.swing.DefaultDesktopManager; import javax.swing.DesktopManager; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -357,7 +359,9 @@ public class Desktop extends jalview.jbgui.GDesktop // This line prevents Windows Look&Feel resizing all new windows to maximum // if previous window was maximised desktop.setDesktopManager( - new MyDesktopManager(desktop.getDesktopManager())); + new MyDesktopManager( + (Platform.isWindows() ? new DefaultDesktopManager() + : desktop.getDesktopManager()))); Rectangle dims = getLastKnownDimensions(""); if (dims != null) diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index 3adba81..2c74609 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -30,7 +30,7 @@ import java.awt.event.MouseEvent; */ public class Platform { - private static Boolean isAMac = null; + private static Boolean isAMac = null, isWindows = null; private static Boolean isHeadless = null; @@ -45,11 +45,26 @@ public class Platform { isAMac = System.getProperty("os.name").indexOf("Mac") > -1; } + return isAMac.booleanValue(); } /** + * Check if we are on a Microsoft plaform... + * + * @return true if we have to cope with another platform variation + */ + public static boolean isWindows() + { + if (isWindows == null) + { + isWindows = System.getProperty("os.name").indexOf("Win") > -1; + } + return isWindows.booleanValue(); + } + + /** * * @return true if we are running in non-interactive no UI mode */ -- 1.7.10.2