[java-atk-wrapper] JNI: Create jaw_object_notify_state_change



commit c3f1bd4c0b77147cfbfb1af41253300affda8b8a
Author: Magdalen Berns <m berns thismagpie com>
Date:   Tue Jun 9 13:47:36 2015 +0100

    JNI: Create jaw_object_notify_state_change
    
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=750632

 jni/src/AtkWrapper.c |   16 +++++++++-------
 jni/src/jawobject.c  |   30 ++++++++++++++++++++++++++++++
 jni/src/jawobject.h  |    3 +++
 3 files changed, 42 insertions(+), 7 deletions(-)
---
diff --git a/jni/src/AtkWrapper.c b/jni/src/AtkWrapper.c
index e60fc51..7cfb8cc 100644
--- a/jni/src/AtkWrapper.c
+++ b/jni/src/AtkWrapper.c
@@ -242,8 +242,8 @@ focus_notify_handler (gpointer p)
   }
 
   AtkObject* atk_obj = ATK_OBJECT(jaw_impl);
-  atk_object_notify_state_change(atk_obj,
-                                 ATK_STATE_SHOWING,
+  jaw_object_notify_state_change(atk_obj,
+                                 (const gchar*) ATK_STATE_SHOWING,
                                  1);
 
   free_callback_para(para);
@@ -1082,8 +1082,8 @@ object_state_change_handler (gpointer p)
     return G_SOURCE_REMOVE;
   }
 
-  atk_object_notify_state_change(ATK_OBJECT(jaw_impl),
-                                 para->atk_state,
+  jaw_object_notify_state_change(ATK_OBJECT(jaw_impl),
+                                 (const gchar*)para->atk_state,
                                  para->state_value);
 
   free_callback_para(para);
@@ -1147,8 +1147,8 @@ component_added_handler (gpointer p)
   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,
+    jaw_object_notify_state_change(atk_obj,
+                                   (const gchar*)ATK_STATE_SHOWING,
                                    1);
   }
 
@@ -1209,7 +1209,9 @@ component_removed_handler (gpointer p)
     return G_SOURCE_REMOVE;
   }
   if (atk_object_get_role(atk_obj) == ATK_ROLE_TOOL_TIP)
-    atk_object_notify_state_change(atk_obj, ATK_STATE_SHOWING, FALSE);
+    jaw_object_notify_state_change(atk_obj,
+                                   (const gchar*) ATK_STATE_SHOWING,
+                                   FALSE);
   free_callback_para(para);
 
   return G_SOURCE_REMOVE;
diff --git a/jni/src/jawobject.c b/jni/src/jawobject.c
index e036579..469bd12 100644
--- a/jni/src/jawobject.c
+++ b/jni/src/jawobject.c
@@ -40,6 +40,9 @@ static AtkRole jaw_object_get_role(AtkObject *atk_obj);
 static AtkStateSet* jaw_object_ref_state_set(AtkObject *atk_obj);
 static void jaw_object_initialize(AtkObject *jaw_obj, gpointer data);
 static AtkObject* jaw_object_get_parent(AtkObject *obj);
+static void jaw_object_state_change (AtkObject   *atk_obj,
+                                     const gchar *state,
+                                     gboolean    state_set);
 
 static gpointer parent_class = NULL;
 
@@ -61,6 +64,7 @@ jaw_object_class_init (JawObjectClass *klass)
   atk_class->get_mdi_zorder = NULL;
   atk_class->ref_state_set = jaw_object_ref_state_set;
   atk_class->initialize = jaw_object_initialize;
+  atk_class->state_change = jaw_object_state_change;
 /*     atk_class->set_name = jaw_object_set_name;
        atk_class->set_description = jaw_object_set_description;
        atk_class->set_parent = jaw_object_set_parent;
@@ -103,6 +107,32 @@ jaw_object_initialize(AtkObject *atk_obj, gpointer data)
  ATK_OBJECT_CLASS (jaw_object_parent_class)->initialize(atk_obj, data);
 }
 
+static void jaw_object_state_change (AtkObject   *atk_obj,
+                                            const gchar *state,
+                                            gboolean    state_set)
+{
+  JawObject *jaw_obj = JAW_OBJECT(atk_obj);
+  jobject ac = jaw_obj->acc_context;
+  JNIEnv *jniEnv = jaw_util_get_jni_env();
+
+  jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv,
+                                                       "javax/accessibility/AccessibleContext" );
+  jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv,
+                                          classAccessibleContext,
+                                          "firePropertyChange",
+                                          "()Ljavax/accessibility/AccessibleContext;");
+  (*jniEnv)->CallVoidMethod( jniEnv, ac, jmid );
+
+  return;
+}
+
+void jaw_object_notify_state_change (AtkObject   *atk_obj,
+                                     const gchar *state,
+                                     gboolean    state_set)
+{
+  jaw_object_state_change(atk_obj, state, state_set);
+}
+
 static AtkObject* jaw_object_get_parent(AtkObject *atk_obj)
 {
   JawObject *jaw_obj = JAW_OBJECT(atk_obj);
diff --git a/jni/src/jawobject.h b/jni/src/jawobject.h
index 0709f79..b81677f 100644
--- a/jni/src/jawobject.h
+++ b/jni/src/jawobject.h
@@ -58,6 +58,9 @@ struct _JawObjectClass
 };
 
 gpointer jaw_object_get_interface_data (JawObject*, guint);
+void jaw_object_notify_state_change(AtkObject   *atk_obj,
+                                    const gchar *state,
+                                    gboolean    state_set);
 
 G_END_DECLS
 


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