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



commit fcdf00722294231a7dd8b3aafc67cc1545ab6b6f
Author: Giuseppe <giuseppecapaldo93 gmail com>
Date:   Mon Jun 17 23:57:04 2019 +0200

    Delegate getAccessibleDescription 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 5c3f7ff..d6c7e40 100644
--- a/jni/src/jawobject.c
+++ b/jni/src/jawobject.c
@@ -340,13 +340,10 @@ jaw_object_get_description (AtkObject *atk_obj)
     return NULL;
   }
 
-  jclass classAccessibleContext = (*jniEnv)->FindClass( jniEnv,
-                                                       "javax/accessibility/AccessibleContext" );
-  jmethodID jmid = (*jniEnv)->GetMethodID(jniEnv,
-                                          classAccessibleContext,
-                                          "getAccessibleDescription",
-                                          "()Ljava/lang/String;");
-  jstring jstr = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid );
+  jclass atkObject = (*jniEnv)->FindClass ( jniEnv, "org/GNOME/Accessibility/AtkObject");
+  jmethodID jmid = (*jniEnv)->GetStaticMethodID (jniEnv, atkObject, "getAccessibleDescription", 
"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");
+  jstring jstr = (*jniEnv)->CallStaticObjectMethod (jniEnv, atkObject, jmid, ac);
+
   (*jniEnv)->DeleteGlobalRef(jniEnv, ac);
 
   if (atk_obj->description != NULL)
diff --git a/wrapper/org/GNOME/Accessibility/AtkObject.java b/wrapper/org/GNOME/Accessibility/AtkObject.java
index 0bc8415..c4f0453 100644
--- a/wrapper/org/GNOME/Accessibility/AtkObject.java
+++ b/wrapper/org/GNOME/Accessibility/AtkObject.java
@@ -55,6 +55,10 @@ public class AtkObject{
         AtkUtil.invokeInSwing( () -> { ac.setAccessibleName(name); } );
     }
 
+    public static String getAccessibleDescription(AccessibleContext ac){
+        return AtkUtil.invokeInSwing( () -> { return ac.getAccessibleDescription(); }, "");
+    }
+
     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]