From: Ben Soares Date: Tue, 19 May 2020 00:38:58 +0000 (+0100) Subject: JAL-3609 Added a -DforceHiDPISetting=true option mainly for testing, and updated... X-Git-Tag: Develop-2_11_2_0-d20201215~15^2~46 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=841509c5eccc4b4d9997897004bd916a85a30943;p=jalview.git JAL-3609 Added a -DforceHiDPISetting=true option mainly for testing, and updated getdown HiDPISetting --- diff --git a/getdown/lib/getdown-core.jar b/getdown/lib/getdown-core.jar index f800c5c..b444c96 100644 Binary files a/getdown/lib/getdown-core.jar and b/getdown/lib/getdown-core.jar differ diff --git a/getdown/lib/getdown-launcher-local.jar b/getdown/lib/getdown-launcher-local.jar index c0ed4a1..8b1025d 100644 Binary files a/getdown/lib/getdown-launcher-local.jar and b/getdown/lib/getdown-launcher-local.jar differ diff --git a/getdown/lib/getdown-launcher.jar b/getdown/lib/getdown-launcher.jar index 4fddd99..d4ca75a 100644 Binary files a/getdown/lib/getdown-launcher.jar and b/getdown/lib/getdown-launcher.jar differ diff --git a/getdown/src/getdown/core/src/main/java/jalview/bin/GetMemory.java b/getdown/src/getdown/core/src/main/java/jalview/bin/GetMemory.java index e89bffb..b01dfb8 100644 --- a/getdown/src/getdown/core/src/main/java/jalview/bin/GetMemory.java +++ b/getdown/src/getdown/core/src/main/java/jalview/bin/GetMemory.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.bin; import java.lang.management.ManagementFactory; diff --git a/getdown/src/getdown/core/src/main/java/jalview/bin/HiDPISetting.java b/getdown/src/getdown/core/src/main/java/jalview/bin/HiDPISetting.java index 5e20d76..bea9dae 100644 --- a/getdown/src/getdown/core/src/main/java/jalview/bin/HiDPISetting.java +++ b/getdown/src/getdown/core/src/main/java/jalview/bin/HiDPISetting.java @@ -10,38 +10,52 @@ public class HiDPISetting private static final int hidpi = 110; - private static final String scaleProperty = "sun.java2d.uiScale"; + private static final String scalePropertyName = "sun.java2d.uiScale"; - private static final boolean isAMac = System.getProperty("os.name") - .indexOf("Mac") > -1; + private static final boolean isAMac; - private static final boolean isLinux = System.getProperty("os.name") - .toLowerCase().indexOf("linux") > -1; + private static final boolean isLinux; - private static final boolean isWindows = System.getProperty("os.name") - .toLowerCase().indexOf("windows") > -1; + private static final boolean isWindows; + + public static final String forceHiDPISettingPropertyName = "forceHiDPISetting"; + + private static final boolean forceHiDPISetting; static { + isAMac = System.getProperty("os.name").indexOf("Mac") > -1; + isLinux = System.getProperty("os.name").toLowerCase() + .indexOf("linux") > -1; + isWindows = System.getProperty("os.name").toLowerCase() + .indexOf("windows") > -1; dpi = Toolkit.getDefaultToolkit().getScreenResolution(); scale = dpi / hidpi + 1; - if (scale > 1 && isLinux) + String forceHiDPISettingProperty = System + .getProperty(forceHiDPISettingPropertyName); + forceHiDPISetting = forceHiDPISettingProperty != null + && forceHiDPISettingProperty.equalsIgnoreCase("true"); + if (doCondition()) { + System.out.println("Property '" + forceHiDPISettingPropertyName + "'=" + + forceHiDPISettingProperty); + System.out.println("boolean forceHiDPISetting=" + forceHiDPISetting); System.out.println("DPI detected as " + dpi + ". Scaling factor set to " + scale + "."); } } - public static String getScalePropertyArg() + private static synchronized boolean doCondition() + { + return (scale > 1 && isLinux) || forceHiDPISetting; + } + + public static synchronized String getScalePropertyArg() { // HiDPI setting. Just looking at Linux to start with. Test with Windows. - if (!isLinux) - { - return null; - } - if (scale > 1) + if (doCondition()) { - return "-D" + scaleProperty + "=" + scale; + return "-D" + scalePropertyName + "=" + scale; } return null; } diff --git a/getdown/src/getdown/core/src/main/java/jalview/bin/MemorySetting.java b/getdown/src/getdown/core/src/main/java/jalview/bin/MemorySetting.java index 7849ba2..159374a 100644 --- a/getdown/src/getdown/core/src/main/java/jalview/bin/MemorySetting.java +++ b/getdown/src/getdown/core/src/main/java/jalview/bin/MemorySetting.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.bin; /** diff --git a/j11lib/getdown-core.jar b/j11lib/getdown-core.jar index f800c5c..b444c96 100644 Binary files a/j11lib/getdown-core.jar and b/j11lib/getdown-core.jar differ diff --git a/j8lib/getdown-core.jar b/j8lib/getdown-core.jar index f800c5c..b444c96 100644 Binary files a/j8lib/getdown-core.jar and b/j8lib/getdown-core.jar differ diff --git a/src/jalview/bin/HiDPISetting.java b/src/jalview/bin/HiDPISetting.java index 5e20d76..bea9dae 100644 --- a/src/jalview/bin/HiDPISetting.java +++ b/src/jalview/bin/HiDPISetting.java @@ -10,38 +10,52 @@ public class HiDPISetting private static final int hidpi = 110; - private static final String scaleProperty = "sun.java2d.uiScale"; + private static final String scalePropertyName = "sun.java2d.uiScale"; - private static final boolean isAMac = System.getProperty("os.name") - .indexOf("Mac") > -1; + private static final boolean isAMac; - private static final boolean isLinux = System.getProperty("os.name") - .toLowerCase().indexOf("linux") > -1; + private static final boolean isLinux; - private static final boolean isWindows = System.getProperty("os.name") - .toLowerCase().indexOf("windows") > -1; + private static final boolean isWindows; + + public static final String forceHiDPISettingPropertyName = "forceHiDPISetting"; + + private static final boolean forceHiDPISetting; static { + isAMac = System.getProperty("os.name").indexOf("Mac") > -1; + isLinux = System.getProperty("os.name").toLowerCase() + .indexOf("linux") > -1; + isWindows = System.getProperty("os.name").toLowerCase() + .indexOf("windows") > -1; dpi = Toolkit.getDefaultToolkit().getScreenResolution(); scale = dpi / hidpi + 1; - if (scale > 1 && isLinux) + String forceHiDPISettingProperty = System + .getProperty(forceHiDPISettingPropertyName); + forceHiDPISetting = forceHiDPISettingProperty != null + && forceHiDPISettingProperty.equalsIgnoreCase("true"); + if (doCondition()) { + System.out.println("Property '" + forceHiDPISettingPropertyName + "'=" + + forceHiDPISettingProperty); + System.out.println("boolean forceHiDPISetting=" + forceHiDPISetting); System.out.println("DPI detected as " + dpi + ". Scaling factor set to " + scale + "."); } } - public static String getScalePropertyArg() + private static synchronized boolean doCondition() + { + return (scale > 1 && isLinux) || forceHiDPISetting; + } + + public static synchronized String getScalePropertyArg() { // HiDPI setting. Just looking at Linux to start with. Test with Windows. - if (!isLinux) - { - return null; - } - if (scale > 1) + if (doCondition()) { - return "-D" + scaleProperty + "=" + scale; + return "-D" + scalePropertyName + "=" + scale; } return null; } diff --git a/src/jalview/bin/Launcher.java b/src/jalview/bin/Launcher.java index 5e6e48c..8b07142 100644 --- a/src/jalview/bin/Launcher.java +++ b/src/jalview/bin/Launcher.java @@ -153,7 +153,10 @@ public class Launcher } } + System.out.println("About to run HiDPISetting.getScalePropertyArg()"); String scalePropertyArg = HiDPISetting.getScalePropertyArg(); + System.out.println( + "Ran HiDPISetting.getScalePropertyArg() = " + scalePropertyArg); if (scalePropertyArg != null) { command.add(scalePropertyArg);