initial changes to replace monocle with johanvos-headless javafx branch

This commit is contained in:
Craig Raw 2024-04-11 09:45:50 +02:00
parent 86247c6440
commit b3d09bd972
2 changed files with 7 additions and 7 deletions

View file

@ -53,7 +53,7 @@ tasks.withType(AbstractArchiveTask) {
} }
javafx { javafx {
version = "18" sdk = "/home/scy/git/jfx-sandbox/build/sdk"
modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.swing', 'javafx.graphics' ] modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.swing', 'javafx.graphics' ]
} }
@ -198,7 +198,7 @@ application {
"--add-opens=javafx.graphics/com.sun.glass.ui.mac=centerdevice.nsmenufx"] "--add-opens=javafx.graphics/com.sun.glass.ui.mac=centerdevice.nsmenufx"]
} }
if(headless) { if(headless) {
applicationDefaultJvmArgs += ["-Dglass.platform=Monocle", "-Dmonocle.platform=Headless", "-Dprism.order=sw"] applicationDefaultJvmArgs += ["-Dglass.platform=Headless", "-Dprism.order=sw"]
} }
} }
@ -262,7 +262,7 @@ jlink {
jvmArgs += ["-Dprism.lcdtext=false", "--add-opens=javafx.graphics/com.sun.glass.ui.mac=com.sparrowwallet.merged.module"] jvmArgs += ["-Dprism.lcdtext=false", "--add-opens=javafx.graphics/com.sun.glass.ui.mac=com.sparrowwallet.merged.module"]
} }
if(headless) { if(headless) {
jvmArgs += ["-Dglass.platform=Monocle", "-Dmonocle.platform=Headless", "-Dprism.order=sw"] jvmArgs += ["-Dglass.platform=Headless", "-Dprism.order=sw"]
} }
} }
addExtraDependencies("javafx") addExtraDependencies("javafx")

View file

@ -8,13 +8,13 @@ public enum Interface {
public static Interface get() { public static Interface get() {
if(currentInterface == null) { if(currentInterface == null) {
boolean headless = java.awt.GraphicsEnvironment.isHeadless(); boolean headless = java.awt.GraphicsEnvironment.isHeadless();
boolean monocle = "Monocle".equalsIgnoreCase(System.getProperty("glass.platform")); boolean glassHeadless = "Headless".equalsIgnoreCase(System.getProperty("glass.platform"));
if(headless || monocle) { if(headless || glassHeadless) {
currentInterface = TERMINAL; currentInterface = TERMINAL;
if(headless && !monocle) { if(headless && !glassHeadless) {
throw new UnsupportedOperationException("Headless environment detected but Monocle platform not found"); throw new UnsupportedOperationException("Headless environment detected but Headless platform not found");
} }
} else { } else {
currentInterface = DESKTOP; currentInterface = DESKTOP;