[java-atk-wrapper] Improve debugging log



commit b35dcd24e965964109051ea06088e08bf93adf17
Author: Samuel Thibault <samuel thibault ens-lyon org>
Date:   Thu Aug 15 10:54:56 2019 +0200

    Improve debugging log
    
    Details of role/states retrieval, and getting the jni env, is too verbose.
    We however like to see the object name and role

 jni/src/jawobject.c | 6 ++++++
 jni/src/jawutil.c   | 5 -----
 2 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/jni/src/jawobject.c b/jni/src/jawobject.c
index 3507cfb..3769ad6 100644
--- a/jni/src/jawobject.c
+++ b/jni/src/jawobject.c
@@ -280,6 +280,8 @@ jaw_object_get_name (AtkObject *atk_obj)
       {
         const gchar* name = atk_object_get_name(child);
         g_object_unref(child);
+        if (name)
+          JAW_DEBUG_C("-> %s", name);
         return name;
       }
     }
@@ -309,6 +311,8 @@ jaw_object_get_name (AtkObject *atk_obj)
                                                          NULL);
   }
 
+  if (atk_obj->name)
+    JAW_DEBUG_C("-> %s", atk_obj->name);
   return atk_obj->name;
 }
 
@@ -419,6 +423,7 @@ jaw_object_get_role (AtkObject *atk_obj)
   JAW_DEBUG_C("%p", atk_obj);
   if (atk_obj->role != ATK_ROLE_INVALID
    && atk_obj->role != ATK_ROLE_UNKNOWN) {
+    JAW_DEBUG_C("-> %d", atk_obj->role);
     return atk_obj->role;
   }
 
@@ -426,6 +431,7 @@ jaw_object_get_role (AtkObject *atk_obj)
 
   AtkRole role = jaw_util_get_atk_role_from_AccessibleContext(ac);
   (*jniEnv)->DeleteGlobalRef(jniEnv, ac);
+  JAW_DEBUG_C("-> %d", role);
   return role;
 }
 
diff --git a/jni/src/jawutil.c b/jni/src/jawutil.c
index 9505198..b8f5d48 100644
--- a/jni/src/jawutil.c
+++ b/jni/src/jawutil.c
@@ -248,7 +248,6 @@ JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *jvm, void *reserve)
 JNIEnv*
 jaw_util_get_jni_env(void)
 {
-  JAW_DEBUG_C("");
   JNIEnv *env;
   env  = NULL;
   static int i;
@@ -307,7 +306,6 @@ jaw_util_detach(void)
 static jobject
 jaw_util_get_java_acc_role (JNIEnv *jniEnv, const gchar* roleName)
 {
-  JAW_DEBUG_C("%p, %s", jniEnv, roleName);
   jclass classAccessibleRole = (*jniEnv)->FindClass(jniEnv,
                                                     "javax/accessibility/AccessibleRole");
   jfieldID jfid = (*jniEnv)->GetStaticFieldID(jniEnv,
@@ -322,7 +320,6 @@ jaw_util_get_java_acc_role (JNIEnv *jniEnv, const gchar* roleName)
 static gboolean
 jaw_util_is_java_acc_role (JNIEnv *jniEnv, jobject acc_role, const gchar* roleName)
 {
-  JAW_DEBUG_C("%p, %p, %s", jniEnv, acc_role, roleName);
   jobject jrole = jaw_util_get_java_acc_role (jniEnv, roleName);
 
   if ((*jniEnv)->IsSameObject(jniEnv, acc_role, jrole))
@@ -561,7 +558,6 @@ jaw_util_get_atk_role_from_AccessibleContext (jobject jAccessibleContext)
 static gboolean
 is_same_java_state (JNIEnv *jniEnv, jobject jobj, const gchar* strState)
 {
-  JAW_DEBUG_C("%p, %p, %s", jniEnv, jobj, strState);
   jclass classAccessibleState = (*jniEnv)->FindClass(jniEnv,
                                                      "javax/accessibility/AccessibleState");
   jfieldID jfid = (*jniEnv)->GetStaticFieldID(jniEnv,
@@ -580,7 +576,6 @@ is_same_java_state (JNIEnv *jniEnv, jobject jobj, const gchar* strState)
 AtkStateType
 jaw_util_get_atk_state_type_from_java_state (JNIEnv *jniEnv, jobject jobj)
 {
-  JAW_DEBUG_C("%p, %p", jniEnv, jobj);
   if (is_same_java_state( jniEnv, jobj, "ACTIVE" ))
     return ATK_STATE_ACTIVE;
 


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