[java-atk-wrapper] JNI: create jaw_object_ref_relation_set
- From: Magdalen Berns <mberns src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [java-atk-wrapper] JNI: create jaw_object_ref_relation_set
- Date: Tue, 9 Jun 2015 14:15:44 +0000 (UTC)
commit a3d160018b6aaad9496ba34972a6cc817fc623c5
Author: Magdalen Berns <m berns thismagpie com>
Date: Tue Jun 9 15:14:02 2015 +0100
JNI: create jaw_object_ref_relation_set
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=750641
HACKING | 1 -
jni/src/jawimpl.c | 81 ---------------------------------------------------
jni/src/jawobject.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 81 insertions(+), 82 deletions(-)
---
diff --git a/HACKING b/HACKING
index cfb2390..04b6c43 100644
--- a/HACKING
+++ b/HACKING
@@ -40,7 +40,6 @@ Object base class:
AtkFunction
implementor_ref_accessible
peek_parent
- ref_relation_set
set_name
set_description
set_parent
diff --git a/jni/src/jawimpl.c b/jni/src/jawimpl.c
index 3693cd3..9ca242f 100644
--- a/jni/src/jawimpl.c
+++ b/jni/src/jawimpl.c
@@ -43,7 +43,6 @@ static gpointer jaw_impl_get_interface_data(JawObject *jaw_obj, guint iface);
/* AtkObject */
static void jaw_impl_initialize(AtkObject *atk_obj, gpointer data);
static AtkObject* jaw_impl_get_parent(AtkObject *atk_obj);
-static AtkRelationSet* jaw_impl_ref_relation_set(AtkObject *atk_obj);
extern void jaw_action_interface_init(AtkActionIface*);
extern gpointer jaw_action_data_init(jobject);
@@ -451,7 +450,6 @@ jaw_impl_class_init(JawImplClass *klass)
AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
atk_class->initialize = jaw_impl_initialize;
atk_class->get_parent = jaw_impl_get_parent;
- atk_class->ref_relation_set = jaw_impl_ref_relation_set;
JawObjectClass *jaw_class = JAW_OBJECT_CLASS (klass);
jaw_class->get_interface_data = jaw_impl_get_interface_data;
@@ -664,85 +662,6 @@ get_atk_relation_type_from_java_key (JNIEnv *jniEnv, jstring jrel_key)
return ATK_RELATION_NULL;
}
-static AtkRelationSet*
-jaw_impl_ref_relation_set (AtkObject *atk_obj)
-{
- if (atk_obj->relation_set)
- g_object_unref(G_OBJECT(atk_obj->relation_set));
- atk_obj->relation_set = atk_relation_set_new();
- if(atk_obj == NULL)
- return NULL;
-
- 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,
- "getAccessibleRelationSet",
- "()Ljavax/accessibility/AccessibleRelationSet;" );
- jobject jrel_set = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid );
-
- jclass classAccessibleRelationSet = (*jniEnv)->FindClass( jniEnv,
- "javax/accessibility/AccessibleRelationSet");
- jmid = (*jniEnv)->GetMethodID(jniEnv,
- classAccessibleRelationSet,
- "toArray",
- "()[Ljavax/accessibility/AccessibleRelation;");
- jobjectArray jrel_arr = (*jniEnv)->CallObjectMethod(jniEnv, jrel_set, jmid);
- jsize jarr_size = (*jniEnv)->GetArrayLength(jniEnv, jrel_arr);
-
- jsize i;
- for (i = 0; i < jarr_size; i++)
- {
- jobject jrel = (*jniEnv)->GetObjectArrayElement(jniEnv, jrel_arr, i);
- jclass classAccessibleRelation = (*jniEnv)->FindClass(jniEnv,
- "javax/accessibility/AccessibleRelation");
- jmid = (*jniEnv)->GetMethodID(jniEnv,
- classAccessibleRelation,
- "getKey",
- "()Ljava/lang/String;");
- jstring jrel_key = (*jniEnv)->CallObjectMethod( jniEnv, jrel, jmid );
- AtkRelationType rel_type = get_atk_relation_type_from_java_key(jniEnv, jrel_key);
-
- jmid = (*jniEnv)->GetMethodID(jniEnv,
- classAccessibleRelation,
- "getTarget",
- "()[Ljava/lang/Object;");
- jobjectArray jtarget_arr = (*jniEnv)->CallObjectMethod(jniEnv, jrel, jmid);
- jsize jtarget_size = (*jniEnv)->GetArrayLength(jniEnv, jtarget_arr);
-
- jsize j;
- for (j = 0; j < jtarget_size; j++)
- {
- jobject jtarget = (*jniEnv)->GetObjectArrayElement(jniEnv, jtarget_arr, j);
- jclass classAccessible = (*jniEnv)->FindClass( jniEnv,
- "javax/accessibility/Accessible");
- if ((*jniEnv)->IsInstanceOf(jniEnv, jtarget, classAccessible))
- {
- jmid = (*jniEnv)->GetMethodID(jniEnv,
- classAccessible,
- "getAccessibleContext",
- "()Ljavax/accessibility/AccessibleContext;");
- jobject target_ac = (*jniEnv)->CallObjectMethod(jniEnv, jtarget, jmid);
-
- JawImpl *target_obj = jaw_impl_get_instance(jniEnv, target_ac);
- if(target_obj == NULL)
- return NULL;
- atk_object_add_relationship(atk_obj, rel_type, (AtkObject*) target_obj);
- }
- }
- }
- if(atk_obj->relation_set == NULL)
- return NULL;
- if (G_OBJECT(atk_obj->relation_set) != NULL)
- g_object_ref (atk_obj->relation_set);
-
- return atk_obj->relation_set;
-}
-
#ifdef __cplusplus
}
#endif
diff --git a/jni/src/jawobject.c b/jni/src/jawobject.c
index adf3f21..4bd8040 100644
--- a/jni/src/jawobject.c
+++ b/jni/src/jawobject.c
@@ -45,6 +45,7 @@ static void jaw_object_state_change (AtkObject *atk_obj,
const gchar *state,
gboolean state_set);
static AtkObject * jaw_object_ref_child (AtkObject *atk_obj, gint i);
+static AtkRelationSet* jaw_object_ref_relation_set(AtkObject *atk_obj);
static gpointer parent_class = NULL;
@@ -68,6 +69,7 @@ jaw_object_class_init (JawObjectClass *klass)
atk_class->initialize = jaw_object_initialize;
atk_class->state_change = jaw_object_state_change;
atk_class->ref_child = jaw_object_ref_child;
+ atk_class->ref_relation_set = jaw_object_ref_relation_set;
/* atk_class->set_name = jaw_object_set_name;
atk_class->set_description = jaw_object_set_description;
atk_class->set_parent = jaw_object_set_parent;
@@ -361,3 +363,82 @@ jaw_object_ref_state_set (AtkObject *atk_obj)
return state_set;
}
+static AtkRelationSet*
+jaw_object_ref_relation_set (AtkObject *atk_obj)
+{
+ if (atk_obj->relation_set)
+ g_object_unref(G_OBJECT(atk_obj->relation_set));
+ atk_obj->relation_set = atk_relation_set_new();
+ if(atk_obj == NULL)
+ return NULL;
+
+ 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,
+ "getAccessibleRelationSet",
+ "()Ljavax/accessibility/AccessibleRelationSet;" );
+ jobject jrel_set = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid );
+
+ jclass classAccessibleRelationSet = (*jniEnv)->FindClass( jniEnv,
+ "javax/accessibility/AccessibleRelationSet");
+ jmid = (*jniEnv)->GetMethodID(jniEnv,
+ classAccessibleRelationSet,
+ "toArray",
+ "()[Ljavax/accessibility/AccessibleRelation;");
+ jobjectArray jrel_arr = (*jniEnv)->CallObjectMethod(jniEnv, jrel_set, jmid);
+ jsize jarr_size = (*jniEnv)->GetArrayLength(jniEnv, jrel_arr);
+
+ jsize i;
+ for (i = 0; i < jarr_size; i++)
+ {
+ jobject jrel = (*jniEnv)->GetObjectArrayElement(jniEnv, jrel_arr, i);
+ jclass classAccessibleRelation = (*jniEnv)->FindClass(jniEnv,
+ "javax/accessibility/AccessibleRelation");
+ jmid = (*jniEnv)->GetMethodID(jniEnv,
+ classAccessibleRelation,
+ "getKey",
+ "()Ljava/lang/String;");
+ jstring jrel_key = (*jniEnv)->CallObjectMethod( jniEnv, jrel, jmid );
+ AtkRelationType rel_type = get_atk_relation_type_from_java_key(jniEnv, jrel_key);
+
+ jmid = (*jniEnv)->GetMethodID(jniEnv,
+ classAccessibleRelation,
+ "getTarget",
+ "()[Ljava/lang/Object;");
+ jobjectArray jtarget_arr = (*jniEnv)->CallObjectMethod(jniEnv, jrel, jmid);
+ jsize jtarget_size = (*jniEnv)->GetArrayLength(jniEnv, jtarget_arr);
+
+ jsize j;
+ for (j = 0; j < jtarget_size; j++)
+ {
+ jobject jtarget = (*jniEnv)->GetObjectArrayElement(jniEnv, jtarget_arr, j);
+ jclass classAccessible = (*jniEnv)->FindClass( jniEnv,
+ "javax/accessibility/Accessible");
+ if ((*jniEnv)->IsInstanceOf(jniEnv, jtarget, classAccessible))
+ {
+ jmid = (*jniEnv)->GetMethodID(jniEnv,
+ classAccessible,
+ "getAccessibleContext",
+ "()Ljavax/accessibility/AccessibleContext;");
+ jobject target_ac = (*jniEnv)->CallObjectMethod(jniEnv, jtarget, jmid);
+
+ JawImpl *target_obj = jaw_impl_get_instance(jniEnv, target_ac);
+ if(target_obj == NULL)
+ return NULL;
+ atk_object_add_relationship(atk_obj, rel_type, (AtkObject*) target_obj);
+ }
+ }
+ }
+ if(atk_obj->relation_set == NULL)
+ return NULL;
+ if (G_OBJECT(atk_obj->relation_set) != NULL)
+ g_object_ref (atk_obj->relation_set);
+
+ return atk_obj->relation_set;
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]