From 67b05aa1dde10b581428a70ed951396bd4a37c6e Mon Sep 17 00:00:00 2001 From: Glenn Adams Date: Fri, 13 Apr 2012 06:28:25 +0000 Subject: [PATCH] Bugzilla #50062: Invoke JVM in headless mode from FOP command scripts and JS shell to prevent stealing focus from GUI applications. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1325624 13f79535-47bb-0310-9956-ffa450edef68 --- fop | 3 ++- fop.bat | 2 +- fop.js | 4 ++++ status.xml | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/fop b/fop index 3f2ac6f7d..aca642be7 100755 --- a/fop +++ b/fop @@ -18,6 +18,7 @@ # Shell script to run FOP, adapted from the Jakarta-Ant project. rpm_mode=true +java_exec_args="-Djava.awt.headless=true" fop_exec_args= no_config=false fop_exec_debug=false @@ -247,7 +248,7 @@ fi # Execute FOP using eval/exec to preserve spaces in paths, # java options, and FOP args -fop_exec_command="exec \"$JAVACMD\" $LOGCHOICE $LOGLEVEL -classpath \"$LOCALCLASSPATH\" $FOP_OPTS org.apache.fop.cli.Main $fop_exec_args" +fop_exec_command="exec \"$JAVACMD\" $java_exec_args $LOGCHOICE $LOGLEVEL -classpath \"$LOCALCLASSPATH\" $FOP_OPTS org.apache.fop.cli.Main $fop_exec_args" if $fop_exec_debug ; then echo $fop_exec_command fi diff --git a/fop.bat b/fop.bat index 3a0538d5e..54e93cca4 100644 --- a/fop.bat +++ b/fop.bat @@ -58,7 +58,7 @@ set LIBDIR=%LOCAL_FOP_HOME%lib set LOCALCLASSPATH=%FOP_HYPHENATION_PATH% for %%l in (%LOCAL_FOP_HOME%build\*.jar %LIBDIR%\*.jar) do set LOCALCLASSPATH=!LOCALCLASSPATH!;%%l -set JAVAOPTS=-Denv.windir=%WINDIR% +set JAVAOPTS=-Denv.windir=%WINDIR% -Djava.awt.headless=true if "%JAVA_HOME%" == "" goto noJavaHome if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome diff --git a/fop.js b/fop.js index f92d06b4c..34bd390e2 100644 --- a/fop.js +++ b/fop.js @@ -18,6 +18,7 @@ // rpm_mode is irrelevant on Windows // var rpm_mode=true; +var java_exec_args = "-Djava.awt.headless=true"; var fop_exec_args = ""; var no_config=false; var fop_exec_debug=false; @@ -62,6 +63,7 @@ function read_args() { WScript.Echo("keepopen: " + keep_open); WScript.Echo("noconfig: " + no_config); WScript.Echo("help: " + show_help); + WScript.Echo("java arguments: " + java_exec_args); WScript.Echo("fop arguments: " + fop_exec_args); } } @@ -220,6 +222,7 @@ function get_local_classpath() { // Execute fop via shell.Exec function fop_exec() { var fop_exec_command = "\"" + javacmd + "\" " + + java_exec_args + " " + (config.Exists("JAVA_OPTS")?config.Item("JAVA_OPTS") + " ":"") + (config.Exists("LOGCHOICE")?config.Item("LOGCHOICE") + " ":"") + (config.Exists("LOGLEVEL")?config.Item("LOGLEVEL") + " ":"") @@ -252,6 +255,7 @@ function fop_exec() { function fop_run() { var fop_exec_command = "cmd /" + (keep_open?"K":"C") + " \"" + "\"" + javacmd + "\" " + + java_exec_args + " " + (config.Exists("JAVA_OPTS")?config.Item("JAVA_OPTS") + " ":"") + (config.Exists("LOGCHOICE")?config.Item("LOGCHOICE") + " ":"") + (config.Exists("LOGLEVEL")?config.Item("LOGLEVEL") + " ":"") diff --git a/status.xml b/status.xml index c2885ef23..3d91908f2 100644 --- a/status.xml +++ b/status.xml @@ -62,6 +62,9 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> + + Invoke JVM in headless mode from FOP command scripts and JS shell to prevent stealing focus from GUI applications. + Take leading derived space before/after into account when computing rows for TXT renderer. -- 2.39.5