[Libreoffice-commits] core.git: include/jvmfwk jvmfwk/plugins jvmfwk/source

Michael Meeks michael.meeks at collabora.com
Wed Oct 30 12:11:54 CET 2013


 include/jvmfwk/framework.h                 |    8 +++++++-
 jvmfwk/plugins/sunmajor/pluginlib/util.cxx |   16 +++++++++++++---
 jvmfwk/source/fwkutil.cxx                  |   22 +++++-----------------
 3 files changed, 25 insertions(+), 21 deletions(-)

New commits:
commit 72b954df59d64fa47f6380e4322243401afb683f
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed Oct 23 19:59:23 2013 +0100

    Avoid using gconftool. Atk provides a11y not Java on Unix.
    
    cf. comment in framework header. Should have no impact on real
    run-time Java a11y, which would be enabled later as-needed; only
    on JRE selection. For extreme corner-cases, where your auto-selected
    JRE has no a11y support either select another JRE in the UI or:
    
    $ export JFW_PLUGIN_FORCE_ACCESSIBILITY=1
    
    to override.
    
    Change-Id: I59a6428e5a11664b75c29580cad76eb9500db45a

diff --git a/include/jvmfwk/framework.h b/include/jvmfwk/framework.h
index c404a95..7099f50 100644
--- a/include/jvmfwk/framework.h
+++ b/include/jvmfwk/framework.h
@@ -73,7 +73,7 @@ extern "C" {
     </p>
 
     <p>Setting the class path used by a Java VM should not be necesarry. The locations
-    of Jar files should be knows by a class loader. If a jar file depends on another
+    of Jar files should be known by a class loader. If a jar file depends on another
     jar file then it can be referenced in the manifest file of the first jar. However,
     a user may add jars to the class path by using this API. If it becomes necessary
     to add files to the class path which is to be used by all users then one can use
@@ -168,6 +168,12 @@ extern "C" {
     It may be removed in the future. By setting it to 1, the framework will not try to
     find out if the system is configured to use accessibility tools or if a JRE has an
     accessibiliy bridge installed</dd>
+    <dt>JFW_PLUGIN_FORCE_ACCESSIBILITY</dt>
+    <dd>This is a unofficial variable which was introduced to workaround external issues.
+    It may be removed in the future. By setting it to 1, the framework will override a
+    platform's desire not to probe each java backend to determine if it has an accessibility
+    bridge installed. If the JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY is set this variable has
+    no effect, and is Unix specific.</dd>
     </dl>
 */
 
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index 75c3412..832616f 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -364,6 +364,12 @@ void AsynchReader::execute()
     }
 }
 
+static bool isEnvVarSetToOne(const OUString &aVar)
+{
+    OUString aValue;
+    getBootstrap()->getFrom(aVar, aValue);
+    return aValue == "1";
+}
 
 bool getJavaProps(const OUString & exePath,
 #ifdef JVM_ONE_PATH_CHECK
@@ -393,8 +399,7 @@ bool getJavaProps(const OUString & exePath,
     //If the bootstrap variable is "1" then we pass the argument
     //"noaccessibility" to JREProperties.class. This will prevent
     //that it calls   java.awt.Toolkit.getDefaultToolkit();
-    OUString sValue;
-    getBootstrap()->getFrom("JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY", sValue);
+    bool bNoAccessibility = isEnvVarSetToOne("JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY");
 
     //prepare the arguments
     sal_Int32 cArgs = 3;
@@ -404,8 +409,13 @@ bool getJavaProps(const OUString & exePath,
     OUString arg4 = "noaccessibility";
     rtl_uString *args[4] = {arg1.pData, arg2.pData, arg3.pData};
 
+#ifdef UNX
+    // Java is no longer required for a11y - we use atk directly.
+    bNoAccessibility = !isEnvVarSetToOne("JFW_PLUGIN_FORCE_ACCESSIBILITY");
+#endif
+
     // Only add the fourth param if the bootstrap parameter is set.
-    if (sValue.equals(OUString::number( 1)))
+    if (bNoAccessibility)
     {
         args[3] = arg4.pData;
         cArgs = 4;
diff --git a/jvmfwk/source/fwkutil.cxx b/jvmfwk/source/fwkutil.cxx
index 2998695..993ddb3 100644
--- a/jvmfwk/source/fwkutil.cxx
+++ b/jvmfwk/source/fwkutil.cxx
@@ -56,9 +56,8 @@ namespace jfw
 bool isAccessibilitySupportDesired()
 {
     OUString sValue;
-    if ((sal_True == ::rtl::Bootstrap::get(
-        OUString("JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY"), sValue)) && sValue == "1"
-        )
+    if (::rtl::Bootstrap::get( "JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY", sValue) &&
+        sValue == "1" )
         return false;
 
     bool retVal = false;
@@ -103,24 +102,13 @@ bool isAccessibilitySupportDesired()
     RegCloseKey(hKey);
 
 #elif defined UNX
-    char buf[16];
-    // use 2 shells to suppress the eventual "gcontool-2 not found" message
-    // of the shell trying to execute the command
-    FILE* fp = popen( "/bin/sh 2>/dev/null -c \"gconftool-2 -g /desktop/gnome/interface/accessibility\"", "r" );
-    if( fp )
-    {
-        if( fgets( buf, sizeof(buf), fp ) )
-        {
-            int nCompare = strncasecmp( buf, "true", 4 );
-            retVal = (nCompare == 0 ? true : false);
-        }
-        pclose( fp );
-    }
+    // Java is no longer required for a11y - we use atk directly.
+    retVal = ::rtl::Bootstrap::get( "JFW_PLUGIN_FORCE_ACCESSIBILITY", sValue) && sValue == "1";
 #endif
+
     return retVal;
 }
 
-
 rtl::ByteSequence encodeBase16(const rtl::ByteSequence& rawData)
 {
     static const char EncodingTable[] =


More information about the Libreoffice-commits mailing list