From: Ben Soares Date: Tue, 1 Dec 2020 14:57:16 +0000 (+0000) Subject: JAL-3609 JAL-3775 Updated getdown with re-factored HiDPISetting and ScreenInfo. No... X-Git-Tag: Develop-2_11_2_0-d20201215~15^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=1a4dd17cef65c03cf088a1e5aa4520078f1daeb8;p=jalview.git JAL-3609 JAL-3775 Updated getdown with re-factored HiDPISetting and ScreenInfo. No real functionality change. --- diff --git a/getdown/lib/FJVL_VERSION b/getdown/lib/FJVL_VERSION index 07a2dfc..df225c8 100644 --- a/getdown/lib/FJVL_VERSION +++ b/getdown/lib/FJVL_VERSION @@ -1 +1 @@ -1.8.3-1.2.9_FJVL +1.8.3-1.2.10_FJVL diff --git a/getdown/lib/JVL_VERSION b/getdown/lib/JVL_VERSION index b971e64..6f6eed4 100644 --- a/getdown/lib/JVL_VERSION +++ b/getdown/lib/JVL_VERSION @@ -1 +1 @@ -1.8.3-1.2.9_JVL +1.8.3-1.2.10_JVL diff --git a/getdown/lib/getdown-core.jar b/getdown/lib/getdown-core.jar index bb8c693..dadce6e 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 b6a4227..88036f9 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 515cc53..4e2a98c 100644 Binary files a/getdown/lib/getdown-launcher.jar and b/getdown/lib/getdown-launcher.jar differ diff --git a/getdown/src/getdown/ant/pom.xml b/getdown/src/getdown/ant/pom.xml index c180d5f..9b26d50 100644 --- a/getdown/src/getdown/ant/pom.xml +++ b/getdown/src/getdown/ant/pom.xml @@ -4,7 +4,7 @@ com.threerings.getdown getdown - 1.8.3-1.2.9_FJVL + 1.8.3-1.2.10_FJVL getdown-ant diff --git a/getdown/src/getdown/core/pom.xml b/getdown/src/getdown/core/pom.xml index dd387b1..eb6f388 100644 --- a/getdown/src/getdown/core/pom.xml +++ b/getdown/src/getdown/core/pom.xml @@ -4,7 +4,7 @@ com.threerings.getdown getdown - 1.8.3-1.2.9_FJVL + 1.8.3-1.2.10_FJVL getdown-core 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 497900f..d6d440a 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 @@ -1,7 +1,6 @@ package jalview.bin; import java.awt.HeadlessException; -import java.awt.Toolkit; public class HiDPISetting { @@ -11,7 +10,7 @@ public class HiDPISetting private static final int bigScreenThreshold = 1400; - private static final String scalePropertyName = "sun.java2d.uiScale"; + public static final String scalePropertyName = "sun.java2d.uiScale"; private static final boolean isLinux; @@ -39,6 +38,8 @@ public class HiDPISetting private static boolean allowScalePropertyArg = false; + private static ScreenInfo screenInfo = new ScreenInfo(); + static { String system = System.getProperty("os.name") == null ? null @@ -113,9 +114,10 @@ public class HiDPISetting // and screen resolution (more trustworthy) // get screen dpi + screenInfo = getScreenInfo(); try { - dpi = Toolkit.getDefaultToolkit().getScreenResolution(); + dpi = screenInfo.getScreenResolution(); } catch (HeadlessException e) { System.err.println("Cannot get screen resolution: " + e.getMessage()); @@ -124,8 +126,8 @@ public class HiDPISetting // try and get screen size height and width try { - int height = Toolkit.getDefaultToolkit().getScreenSize().height; - int width = Toolkit.getDefaultToolkit().getScreenSize().width; + int height = screenInfo.getScreenHeight(); + int width = screenInfo.getScreenWidth(); // using mindimension in case of portrait screens mindimension = Math.min(height, width); } catch (HeadlessException e) @@ -170,11 +172,41 @@ public class HiDPISetting doneInit = true; } + public static String getScalePropertyArg(int s) + { + return "-D" + scalePropertyName + "=" + String.valueOf(s); + } + public static String getScalePropertyArg() { init(); // HiDPI setting. Just looking at Linux to start with. Test with Windows. - return allowScalePropertyArg ? "-D" + scalePropertyName + "=" + scale - : null; + return allowScalePropertyArg ? getScalePropertyArg(scale) : null; + } + + public static void clear() + { + setHiDPI = false; + setHiDPIScale = 0; + dpi = 0; + mindimension = 0; + width = 0; + scale = 0; + doneInit = false; + allowScalePropertyArg = false; + } + + public static void setScreenInfo(ScreenInfo si) + { + screenInfo = si; + } + + public static ScreenInfo getScreenInfo() + { + if (screenInfo == null) + { + screenInfo = new ScreenInfo(); + } + return screenInfo; } } diff --git a/getdown/src/getdown/core/src/main/java/jalview/bin/ScreenInfo.java b/getdown/src/getdown/core/src/main/java/jalview/bin/ScreenInfo.java new file mode 100644 index 0000000..899bf94 --- /dev/null +++ b/getdown/src/getdown/core/src/main/java/jalview/bin/ScreenInfo.java @@ -0,0 +1,21 @@ +package jalview.bin; + +import java.awt.Toolkit; + +public class ScreenInfo +{ + public int getScreenResolution() + { + return Toolkit.getDefaultToolkit().getScreenResolution(); + } + + public int getScreenHeight() + { + return (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight(); + } + + public int getScreenWidth() + { + return (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth(); + } +} diff --git a/getdown/src/getdown/launcher/pom.xml b/getdown/src/getdown/launcher/pom.xml index e7dbeb1..b5e68f2 100644 --- a/getdown/src/getdown/launcher/pom.xml +++ b/getdown/src/getdown/launcher/pom.xml @@ -4,7 +4,7 @@ com.threerings.getdown getdown - 1.8.3-1.2.9_FJVL + 1.8.3-1.2.10_FJVL getdown-launcher diff --git a/getdown/src/getdown/mvn_cmd b/getdown/src/getdown/mvn_cmd index e0d7cf1..65e5fb9 100755 --- a/getdown/src/getdown/mvn_cmd +++ b/getdown/src/getdown/mvn_cmd @@ -3,7 +3,7 @@ if [ x$JVLVERSION != x ]; then export VERSION=$JVLVERSION else - export VERSION=1.8.3-1.2.9_JVL + export VERSION=1.8.3-1.2.10_JVL fi if [ x${VERSION%_JVL} = x$VERSION ]; then diff --git a/getdown/src/getdown/pom.xml b/getdown/src/getdown/pom.xml index 8c7c521..7a0fd27 100644 --- a/getdown/src/getdown/pom.xml +++ b/getdown/src/getdown/pom.xml @@ -10,7 +10,7 @@ com.threerings.getdown getdown pom - 1.8.3-1.2.9_FJVL + 1.8.3-1.2.10_FJVL getdown An application installer and updater. diff --git a/j11lib/getdown-core.jar b/j11lib/getdown-core.jar index bb8c693..dadce6e 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 bb8c693..dadce6e 100644 Binary files a/j8lib/getdown-core.jar and b/j8lib/getdown-core.jar differ