[java-atk-wrapper] Fix jaw_object_set_name/description
- From: Samuel Thibault <sthibaul src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [java-atk-wrapper] Fix jaw_object_set_name/description
- Date: Sat, 1 Jun 2019 18:48:25 +0000 (UTC)
commit c96b1c58a78dd5c5795d326fe6373910d2522968
Author: Samuel Thibault <samuel thibault ens-lyon org>
Date: Sat Jun 1 20:47:47 2019 +0200
Fix jaw_object_set_name/description
jni/src/jawobject.c | 37 ++++++++++++++++---------------------
1 file changed, 16 insertions(+), 21 deletions(-)
---
diff --git a/jni/src/jawobject.c b/jni/src/jawobject.c
index 98f7827..36156e6 100644
--- a/jni/src/jawobject.c
+++ b/jni/src/jawobject.c
@@ -330,9 +330,10 @@ static void jaw_object_set_name (AtkObject *atk_obj, const gchar *name)
return;
}
- /* FIXME: this is not actually using the name parameter */
-
- atk_obj->name = (gchar *)ATK_OBJECT_CLASS (parent_class)->get_name (atk_obj);
+ jstring jstr = NULL;
+ if (name) {
+ jstr = (*jniEnv)->NewStringUTF(jniEnv, name);
+ }
jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv,
"javax/accessibility/AccessibleContext" );
@@ -340,8 +341,7 @@ static void jaw_object_set_name (AtkObject *atk_obj, const gchar *name)
classAccessibleContext,
"setAccessibleName",
"(Ljava/lang/String;)");
- /* FIXME: this should be CallVoidMethod, and be passed the name */
- jstring jstr = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid );
+ (*jniEnv)->CallVoidMethod( jniEnv, ac, jmid, jstr );
(*jniEnv)->DeleteGlobalRef(jniEnv, ac);
if (atk_obj->name != NULL)
@@ -359,11 +359,6 @@ static void jaw_object_set_name (AtkObject *atk_obj, const gchar *name)
jaw_obj->jstrName,
NULL);
}
- if (jstr == NULL)
- {
- name = "";
- return;
- }
}
static const gchar*
@@ -389,6 +384,7 @@ jaw_object_get_description (AtkObject *atk_obj)
{
(*jniEnv)->ReleaseStringUTFChars(jniEnv, jaw_obj->jstrDescription, atk_obj->description);
(*jniEnv)->DeleteGlobalRef(jniEnv, jaw_obj->jstrDescription);
+ jaw_obj->jstrDescription = NULL;
atk_obj->description = NULL;
}
@@ -412,7 +408,10 @@ static void jaw_object_set_description (AtkObject *atk_obj, const gchar *descrip
return;
}
- /* FIXME: this is not actually using the description parameter */
+ jstring jstr = NULL;
+ if (description) {
+ jstr = (*jniEnv)->NewStringUTF(jniEnv, description);
+ }
jclass classAccessibleContext = (*jniEnv)->FindClass( jniEnv,
"javax/accessibility/AccessibleContext" );
@@ -420,27 +419,23 @@ static void jaw_object_set_description (AtkObject *atk_obj, const gchar *descrip
classAccessibleContext,
"setAccessibleDescription",
"(Ljava/lang/String;)");
- /* FIXME: this should be CallVoidMethod, and be passed the description */
- jstring jstr = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid );
+ (*jniEnv)->CallVoidMethod( jniEnv, ac, jmid, jstr );
(*jniEnv)->DeleteGlobalRef(jniEnv, ac);
if (description != NULL)
{
(*jniEnv)->ReleaseStringUTFChars(jniEnv, jaw_obj->jstrDescription, description);
(*jniEnv)->DeleteGlobalRef(jniEnv, jaw_obj->jstrDescription);
- description = NULL;
+ jaw_obj->jstrDescription = NULL;
+ atk_obj->description = NULL;
}
if (jstr != NULL)
{
jaw_obj->jstrDescription = (*jniEnv)->NewGlobalRef(jniEnv, jstr);
- description = (gchar*)(*jniEnv)->GetStringUTFChars(jniEnv,
- jaw_obj->jstrDescription,
- NULL);
- }
- if (jstr != NULL)
- {
- description = "";
+ atk_obj->description = (gchar*)(*jniEnv)->GetStringUTFChars(jniEnv,
+ jaw_obj->jstrDescription,
+ NULL);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]