From dbd6ca2b370673d925838d0c47ab00d237982c36 Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Thu, 10 Jun 2021 17:05:53 -0400 Subject: [PATCH] Add jdk16 support (#823) * Add jigsaw "--add-opens" options for Java 9+ * Temporarily disable Darcula on JDK16+ --- ant/project.properties | 1 + ant/unix/unix-launcher.sh.in | 8 ++++++++ src/qz/utils/SystemUtilities.java | 10 +++++++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ant/project.properties b/ant/project.properties index 6cd2f427e..05f9574e1 100644 --- a/ant/project.properties +++ b/ant/project.properties @@ -9,6 +9,7 @@ project.datadir=qz install.opts=-Djna.nosys=true launch.opts=-Xms512m ${install.opts} +launch.jigsaw=--add-opens java.desktop/sun.lwawt.macosx=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED launch.overrides=QZ_OPTS src.dir=${basedir}/src diff --git a/ant/unix/unix-launcher.sh.in b/ant/unix/unix-launcher.sh.in index c05fed936..0169a7645 100644 --- a/ant/unix/unix-launcher.sh.in +++ b/ant/unix/unix-launcher.sh.in @@ -87,6 +87,14 @@ else echo -e "$SUCCESS Java $curver was detected" fi +jigsaw=$(echo -e "9.0\n$curver") +actual=$(echo "$jigsaw" |sort -t '.' -k 1,1 -k 2,2 -n) +if [ "$jigsaw" != "$actual" ]; then + echo -e "$SUCCESS Java < 9.0, skipping jigsaw options" +else + echo -e "$SUCCESS Java >= 9.0, adding jigsaw options" + LAUNCH_OPTS="$LAUNCH_OPTS ${launch.jigsaw}" +fi if command -v java &>/dev/null; then echo -e "$ABOUT_TITLE is starting..." diff --git a/src/qz/utils/SystemUtilities.java b/src/qz/utils/SystemUtilities.java index 08e68a7b5..41468ab21 100644 --- a/src/qz/utils/SystemUtilities.java +++ b/src/qz/utils/SystemUtilities.java @@ -370,11 +370,15 @@ public static boolean prefersMaskTrayIcon() { public static boolean setSystemLookAndFeel() { try { UIManager.getDefaults().put("Button.showMnemonics", Boolean.TRUE); - boolean darkulaThemeNeeded = true; + boolean darculaThemeNeeded = true; if(!isMac() && (isUnix() && UbuntuUtilities.isDarkMode())) { - darkulaThemeNeeded = false; + darculaThemeNeeded = false; } - if(isDarkDesktop() && darkulaThemeNeeded) { + // Disable darcula on JDK16+ per https://github.com/bobbylight/Darcula/issues/8 + if(Constants.JAVA_VERSION.greaterThanOrEqualTo(Version.valueOf("16.0.0"))) { + darculaThemeNeeded = false; + } + if(isDarkDesktop() && darculaThemeNeeded) { UIManager.setLookAndFeel("com.bulenkov.darcula.DarculaLaf"); } else { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());