+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.bin;
import java.lang.management.ManagementFactory;
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;
}
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.bin;
/**
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;
}
}
}
+ 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);