[java-atk-wrapper] Use xprop instead of gconftool-2 to check whether accessibility technology is on



commit b879b41941ec9971a1e1ed039bafb0bd05c63c75
Author: Ke Wang <ke wang sun com>
Date:   Mon Jul 6 17:19:19 2009 +0800

    Use xprop instead of gconftool-2 to check whether accessibility technology is on

 configure.in                                       |    6 +++++-
 .../{AtkWrapper.java => AtkWrapper.java.in}        |   14 +++++++++++---
 wrapper/org/GNOME/Accessibility/Makefile.am        |    7 +++++--
 3 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/configure.in b/configure.in
index 47e4edc..ccd8b8f 100644
--- a/configure.in
+++ b/configure.in
@@ -24,7 +24,6 @@ AC_ISC_POSIX
 AM_PROG_LIBTOOL
 
 m4_define([req_ver_atk], [1.17.0])
-m4_define([req_ver_gtk], [2.10.0])
 
 PKG_CHECK_MODULES(JAW, [
 	atk             >= req_ver_atk
@@ -121,6 +120,11 @@ AC_SUBST(JAVA_PROPERTIES_HOME)
 
 AC_SUBST(EXTRA_JARFILES)
 
+AC_PATH_PROG(XPROP,xprop,no)
+if test x$XPROP = xno; then
+  AC_MSG_ERROR([No xprop found])
+fi
+
 AC_OUTPUT([
 Makefile
 jni/Makefile
diff --git a/wrapper/org/GNOME/Accessibility/AtkWrapper.java b/wrapper/org/GNOME/Accessibility/AtkWrapper.java.in
similarity index 98%
rename from wrapper/org/GNOME/Accessibility/AtkWrapper.java
rename to wrapper/org/GNOME/Accessibility/AtkWrapper.java.in
index ecbd25c..6d74bb4 100644
--- a/wrapper/org/GNOME/Accessibility/AtkWrapper.java
+++ b/wrapper/org/GNOME/Accessibility/AtkWrapper.java.in
@@ -28,11 +28,19 @@ import javax.accessibility.*;
 public class AtkWrapper {
 	static {
 		try {
-			Process p = Runtime.getRuntime().exec ("gconftool-2 -g /desktop/gnome/interface/accessibility");
+			Process p = Runtime.getRuntime().exec("@XPROP@ -root");
 			BufferedReader b = new BufferedReader (
 					new InputStreamReader (p.getInputStream ()));
-			String result = b.readLine();
-			if ("true".equals(result)) {
+			String result;
+			boolean found = false;
+			while ((result = b.readLine()) != null) {
+				if (result.indexOf ("AT_SPI_IOR") >= 0) {
+					found = true;
+					break;
+				}
+			}
+			
+			if (found) {
 				// Set laf to Cross platform laf because GTK laf will be the default one in some
 				// environment, but GTK laf will not work well with gtk_main() started.
 				String lafClassName = (String)System.getProperty("swing.defaultlaf");
diff --git a/wrapper/org/GNOME/Accessibility/Makefile.am b/wrapper/org/GNOME/Accessibility/Makefile.am
index dfd196d..50b6714 100644
--- a/wrapper/org/GNOME/Accessibility/Makefile.am
+++ b/wrapper/org/GNOME/Accessibility/Makefile.am
@@ -1,15 +1,18 @@
 JAVA_SRC=$(wildcard $(srcdir)/*.java)
 CLASSES=$(patsubst %.java,%.class,$(JAVA_SRC))
-BUILD_CLASSES=$(patsubst $(srcdir)%,$(builddir)%,$(CLASSES))
+BUILD_CLASSES=$(patsubst $(srcdir)%,$(builddir)%,$(CLASSES)) $(builddir)/AtkWrapper.class
 
 EXTRA_DIST=$(JAVA_SRC)
 
 all-local: $(BUILD_CLASSES)
 
+AtkWrapper.java : AtkWrapper.java.in
+	sed -e "s;\ XPROP\@;${XPROP};g" \
+		< $< >$@
+
 %.class : %.java
 	CLASSPATH=$(top_srcdir)/wrapper $(JAVAC) -d $(top_builddir)/wrapper $<
 
 clean-local:
 	$(RM) *.class
 
-



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]