Skip to content

Commit

Permalink
Add jdk16 support (qzind#823)
Browse files Browse the repository at this point in the history
* Add jigsaw "--add-opens" options for Java 9+
* Temporarily disable Darcula on JDK16+
  • Loading branch information
tresf authored Jun 10, 2021
1 parent 23639f2 commit dbd6ca2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions ant/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions ant/unix/unix-launcher.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down
10 changes: 7 additions & 3 deletions src/qz/utils/SystemUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit dbd6ca2

Please sign in to comment.