[java-atk-wrapper/wip] JNI: Create jaw_object_ref_child
- From: Magdalen Berns <mberns src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [java-atk-wrapper/wip] JNI: Create jaw_object_ref_child
- Date: Thu, 25 Jun 2015 18:20:38 +0000 (UTC)
commit 2167afcb56ef3e813c544d3972e0b54020a66d55
Author: Magdalen Berns <m berns thismagpie com>
Date: Thu Jun 25 19:18:54 2015 +0100
JNI: Create jaw_object_ref_child
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=750640
jni/src/jawobject.c | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/jni/src/jawobject.c b/jni/src/jawobject.c
index eba953a..bef6fe3 100644
--- a/jni/src/jawobject.c
+++ b/jni/src/jawobject.c
@@ -53,6 +53,7 @@ static void jaw_object_set_parent(AtkObject *atk_obj, AtkObject *parent);
static void jaw_object_set_role (AtkObject *atk_obj, AtkRole role);
static const gchar *jaw_object_get_object_locale (AtkObject *atk_obj);
static AtkRelationSet *jaw_object_ref_relation_set (AtkObject *atk_obj);
+static AtkObject *jaw_object_ref_child(AtkObject *atk_obj, gint i);
static gpointer parent_class = NULL;
static GHashTable *object_table = NULL;
@@ -110,6 +111,7 @@ jaw_object_class_init (JawObjectClass *klass)
atk_class->set_role = jaw_object_set_role;
atk_class->get_object_locale = jaw_object_get_object_locale;
atk_class->ref_relation_set = jaw_object_ref_relation_set;
+ atk_class->ref_child = jaw_object_ref_child;
atk_class->ref_state_set = jaw_object_ref_state_set;
atk_class->initialize = jaw_object_initialize;
@@ -612,6 +614,39 @@ jaw_object_ref_relation_set (AtkObject *atk_obj)
return atk_obj->relation_set;
}
+static AtkObject*
+jaw_object_ref_child(AtkObject *atk_obj, gint i)
+{
+ 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,
+ "getAccessibleChild",
+ "(I)Ljavax/accessibility/Accessible;" );
+ jobject jchild = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid, i );
+ if (jchild == NULL)
+ {
+ return NULL;
+ }
+
+ jclass classAccessible = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/Accessible" );
+ jmid = (*jniEnv)->GetMethodID(jniEnv,
+ classAccessible,
+ "getAccessibleContext",
+ "()Ljavax/accessibility/AccessibleContext;" );
+ jobject child_ac = (*jniEnv)->CallObjectMethod( jniEnv, jchild, jmid );
+
+ AtkObject *obj = (AtkObject*) jaw_impl_get_instance( jniEnv, child_ac );
+ if (G_OBJECT(obj) != NULL)
+ g_object_ref(G_OBJECT(obj));
+
+ return obj;
+}
+
static JawObject*
jaw_object_table_lookup (JNIEnv *jniEnv, jobject ac)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]