[java-atk-wrapper] Fixed bug 591792 - Java application tooltips are not accessible to orca screen reader



commit def8b17dbc0f6bba83ac83552d688e8adc071c07
Author: Ke Wang <ke wang sun com>
Date:   Thu Sep 3 13:01:20 2009 +0800

    Fixed bug 591792 - Java application tooltips are not accessible to orca screen reader

 jni/src/AtkWrapper.c                               |   37 ++++++++++++++++++++
 wrapper/org/GNOME/Accessibility/AtkWrapper.java.in |   10 +++++
 2 files changed, 47 insertions(+), 0 deletions(-)
---
diff --git a/jni/src/AtkWrapper.c b/jni/src/AtkWrapper.c
index ee0b80c..4314c68 100644
--- a/jni/src/AtkWrapper.c
+++ b/jni/src/AtkWrapper.c
@@ -874,6 +874,11 @@ component_added_handler (gpointer p)
 	JNIEnv *jniEnv = jaw_util_get_jni_env();
 	JawImpl* jaw_impl = jaw_impl_get_instance(jniEnv, global_ac);
 	
+	AtkObject* atk_obj = ATK_OBJECT(jaw_impl);
+	if (atk_object_get_role(atk_obj) == ATK_ROLE_TOOL_TIP) {
+		atk_object_notify_state_change(atk_obj, ATK_STATE_SHOWING, 1);
+	}
+
 	free_callback_para(para);
 
 	return FALSE;
@@ -888,6 +893,38 @@ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_componentAdded(
 }
 
 static gboolean
+component_removed_handler (gpointer p)
+{
+	CallbackPara *para = (CallbackPara*)p;
+	jobject global_ac = para->global_ac;
+
+	JNIEnv *jniEnv = jaw_util_get_jni_env();
+	JawImpl* jaw_impl = jaw_impl_find_instance(jniEnv, global_ac);
+
+	if (!jaw_impl) {
+		free_callback_para(para);
+		return FALSE;
+	}
+
+	AtkObject* atk_obj = ATK_OBJECT(jaw_impl);
+	if (atk_object_get_role(atk_obj) == ATK_ROLE_TOOL_TIP) {
+		atk_object_notify_state_change(atk_obj, ATK_STATE_SHOWING, 0);
+	}
+
+	free_callback_para(para);
+
+	return FALSE;
+}
+
+JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_componentRemoved(
+		JNIEnv *jniEnv, jclass jClass, jobject jAccContext) {
+	jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
+	CallbackPara *para = alloc_callback_para(global_ac);
+
+	g_idle_add(component_removed_handler, para);
+}
+
+static gboolean
 key_dispatch_handler (gpointer p)
 {
 	g_mutex_lock(key_dispatch_mutex);
diff --git a/wrapper/org/GNOME/Accessibility/AtkWrapper.java.in b/wrapper/org/GNOME/Accessibility/AtkWrapper.java.in
index 2f1c876..50893cb 100644
--- a/wrapper/org/GNOME/Accessibility/AtkWrapper.java.in
+++ b/wrapper/org/GNOME/Accessibility/AtkWrapper.java.in
@@ -160,6 +160,15 @@ public class AtkWrapper {
 						}
 						break;
 					}
+					case ContainerEvent.COMPONENT_REMOVED:
+					{
+						java.awt.Component c = ((ContainerEvent)e).getChild();
+						if (c instanceof javax.accessibility.Accessible) {
+							AccessibleContext ac = ((javax.accessibility.Accessible)c).getAccessibleContext();
+							AtkWrapper.componentRemoved(ac);
+						}
+						break;
+					}
 				default:
 					break;
 				}
@@ -492,6 +501,7 @@ public class AtkWrapper {
 	public native static void objectStateChange(javax.accessibility.AccessibleContext ac, java.lang.Object state, boolean value);
 
 	public native static void componentAdded(javax.accessibility.AccessibleContext ac);
+	public native static void componentRemoved(javax.accessibility.AccessibleContext ac);
 
 	public native static boolean dispatchKeyEvent(AtkKeyEvent e);
 



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