[java-atk-wrapper] Delegate getAccessibleChildrenCount call to EDT



commit c6657e18e679b475dc013bb499d2308ce824cea0
Author: Giuseppe <giuseppecapaldo93 gmail com>
Date:   Mon Jun 17 23:59:54 2019 +0200

    Delegate getAccessibleChildrenCount call to EDT

 jni/src/jawobject.c                            | 11 ++++-------
 wrapper/org/GNOME/Accessibility/AtkObject.java |  4 ++++
 2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/jni/src/jawobject.c b/jni/src/jawobject.c
index 965f469..c6de08f 100644
--- a/jni/src/jawobject.c
+++ b/jni/src/jawobject.c
@@ -397,13 +397,10 @@ jaw_object_get_n_children (AtkObject *atk_obj)
     return 0;
   }
 
-  jclass classAccessibleContext = (*jniEnv)->FindClass(jniEnv,
-                                                       "javax/accessibility/AccessibleContext" );
-  jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv,
-                                          classAccessibleContext,
-                                          "getAccessibleChildrenCount",
-                                          "()I");
-  jint count = (*jniEnv)->CallIntMethod( jniEnv, ac, jmid );
+  jclass atkObject = (*jniEnv)->FindClass (jniEnv, "org/GNOME/Accessibility/AtkObject");
+  jmethodID jmid = (*jniEnv)->GetStaticMethodID (jniEnv, atkObject, "getAccessibleChildrenCount", 
"(Ljavax/accessibility/AccessibleContext;)I");
+  jint count = (*jniEnv)->CallStaticIntMethod (jniEnv, atkObject, jmid, ac);
+
   (*jniEnv)->DeleteGlobalRef(jniEnv, ac);
 
   return (gint)count;
diff --git a/wrapper/org/GNOME/Accessibility/AtkObject.java b/wrapper/org/GNOME/Accessibility/AtkObject.java
index 3d9f1b5..b58e489 100644
--- a/wrapper/org/GNOME/Accessibility/AtkObject.java
+++ b/wrapper/org/GNOME/Accessibility/AtkObject.java
@@ -63,6 +63,10 @@ public class AtkObject{
         AtkUtil.invokeInSwing( () -> { ac.setAccessibleDescription(description); } );
     }
 
+    public static int getAccessibleChildrenCount(AccessibleContext ac){
+        return AtkUtil.invokeInSwing( () -> { return ac.getAccessibleChildrenCount(); }, 0);
+    }
+
     public static int hashCode(AccessibleContext ac){
         return AtkUtil.invokeInSwing( () -> { return ac.hashCode(); }, 0);
     }


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