[java-atk-wrapper/gnome-2-28] Fix regression - conflict with GTK look and feel



commit 8fc82724c9b9f4ad31ae95ae998a10954d1f9cc8
Author: Ke Wang <ke wang sun com>
Date:   Fri Feb 26 18:24:19 2010 +0800

    Fix regression - conflict with GTK look and feel

 jni/src/AtkWrapper.c                               |   14 ++++++++++++--
 wrapper/org/GNOME/Accessibility/AtkWrapper.java.in |    9 +++++++--
 2 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/jni/src/AtkWrapper.c b/jni/src/AtkWrapper.c
index 7036c0d..682f70a 100644
--- a/jni/src/AtkWrapper.c
+++ b/jni/src/AtkWrapper.c
@@ -152,6 +152,10 @@ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_initNativeLibrary
 	// Set NO_GAIL to "1" to prevent gail from executing
 	g_setenv("NO_GAIL", "1", TRUE);
 	
+	// Disable ATK Bridge temporarily to aoid the loading
+	// of ATK Bridge by GTK look and feel
+	g_setenv("NO_AT_BRIDGE", "1", TRUE);
+
 	g_type_class_unref(g_type_class_ref(JAW_TYPE_UTIL));
 	g_type_class_unref(g_type_class_ref(JAW_TYPE_MISC));
 	// Force to invoke base initialization function of each ATK interfaces
@@ -170,11 +174,17 @@ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_initNativeLibrary
 	key_dispatch_mutex = g_mutex_new();
 	key_dispatch_cond = g_cond_new();
 
-	GMainLoop *main_loop = g_main_loop_new( NULL, FALSE );
-	
 	// Dummy idle function for jaw_idle_dispatch to get
 	// the address of gdk_threads_dispatch
 	gdk_threads_add_idle(jaw_dummy_idle_func, NULL);
+}
+
+JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_loadAtkBridge(JNIEnv *jniEnv, jclass jClass) {
+	// Enable ATK Bridge so we can load it now
+	g_setenv("NO_AT_BRIDGE", "1", TRUE);
+
+	GMainLoop *main_loop = g_main_loop_new( NULL, FALSE );
+	
 	g_idle_add(jaw_load_atk_bridge, NULL);
 
 	// We need to wait for the completion of the loading of ATK Bridge
diff --git a/wrapper/org/GNOME/Accessibility/AtkWrapper.java.in b/wrapper/org/GNOME/Accessibility/AtkWrapper.java.in
index d82830b..34132cb 100644
--- a/wrapper/org/GNOME/Accessibility/AtkWrapper.java.in
+++ b/wrapper/org/GNOME/Accessibility/AtkWrapper.java.in
@@ -40,6 +40,11 @@ public class AtkWrapper {
 					break;
 				}
 			}
+
+			if (accessibilityEnabled) {
+				System.loadLibrary("atk-wrapper");
+				AtkWrapper.initNativeLibrary();
+			}
 			
 		} catch (Exception e) {
 			e.printStackTrace();
@@ -138,8 +143,7 @@ public class AtkWrapper {
 			if (firstEvent && accessibilityEnabled) {
 				firstEvent = false;
 				try {
-					System.loadLibrary("atk-wrapper");
-					AtkWrapper.initNativeLibrary();
+					AtkWrapper.loadAtkBridge();
 				} catch (Exception ex) {
 					ex.printStackTrace();
 				}
@@ -494,6 +498,7 @@ public class AtkWrapper {
 	}
 
 	public native static void initNativeLibrary();
+	public native static void loadAtkBridge();
 
 	public native static void focusNotify(javax.accessibility.AccessibleContext ac);
 



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