[java-atk-wrapper] JNI: remove need for jawwindow.h



commit 383c469fe9d0d6b4c8e13d87dc150b53d6c66a9d
Author: Magdalen Berns <m berns thismagpie com>
Date:   Sat Jun 13 18:14:31 2015 +0100

    JNI: remove need for jawwindow.h
    
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=75085

 jni/src/AtkWrapper.c  |    1 -
 jni/src/Makefile.am   |    3 +-
 jni/src/jawobject.c   |    1 -
 jni/src/jawtoplevel.c |    1 -
 jni/src/jawutil.c     |    5 +--
 jni/src/jawwindow.c   |   67 +++++++++++++++++++++++++++++++++---------------
 jni/src/jawwindow.h   |   58 ------------------------------------------
 7 files changed, 49 insertions(+), 87 deletions(-)
---
diff --git a/jni/src/AtkWrapper.c b/jni/src/AtkWrapper.c
index 3a565ee..971ac56 100644
--- a/jni/src/AtkWrapper.c
+++ b/jni/src/AtkWrapper.c
@@ -29,7 +29,6 @@
 #include <X11/Xlib.h>
 #include "jawutil.h"
 #include "jawimpl.h"
-#include "jawwindow.h"
 #include "jawtoplevel.h"
 
 #ifdef __cplusplus
diff --git a/jni/src/Makefile.am b/jni/src/Makefile.am
index 0720755..91c7b0d 100644
--- a/jni/src/Makefile.am
+++ b/jni/src/Makefile.am
@@ -21,8 +21,7 @@ noinst_HEADERS = jawimpl.h \
                  jawobject.h \
                  jawhyperlink.h \
                  jawtoplevel.h \
-                 jawutil.h \
-                 jawwindow.h
+                 jawutil.h
 
 libatk_wrapper_la_CFLAGS = $(JAW_CFLAGS) \
                            $(JNI_INCLUDES)
diff --git a/jni/src/jawobject.c b/jni/src/jawobject.c
index 82e5f42..4db2803 100644
--- a/jni/src/jawobject.c
+++ b/jni/src/jawobject.c
@@ -21,7 +21,6 @@
 #include <atk/atk.h>
 #include <glib.h>
 #include "jawobject.h"
-#include "jawwindow.h"
 #include "jawutil.h"
 #include "jawimpl.h"
 #include "jawtoplevel.h"
diff --git a/jni/src/jawtoplevel.c b/jni/src/jawtoplevel.c
index e7bf120..db8de88 100644
--- a/jni/src/jawtoplevel.c
+++ b/jni/src/jawtoplevel.c
@@ -22,7 +22,6 @@
 #include <string.h>
 #include <glib.h>
 #include "jawtoplevel.h"
-#include "jawwindow.h"
 
 static void jaw_toplevel_class_init(JawToplevelClass *klass);
 static void jaw_toplevel_init(JawToplevel *toplevel);
diff --git a/jni/src/jawutil.c b/jni/src/jawutil.c
index eea77b7..45b8bc7 100644
--- a/jni/src/jawutil.c
+++ b/jni/src/jawutil.c
@@ -26,7 +26,6 @@
 #include <glib/gprintf.h>
 #include "jawutil.h"
 #include "jawtoplevel.h"
-#include "jawwindow.h"
 #include "jawobject.h"
 
 #ifdef __cplusplus
@@ -426,8 +425,8 @@ jaw_util_get_tflag_from_jobj(JNIEnv *jniEnv, jobject jObj)
 
   jmid = (*jniEnv)->GetMethodID(jniEnv,
                                 classAccessibleContext,
-                                "getAccessibleContext",
-                                "()Ljavax/accessibility/AccessibleContext;");
+                                "getAccessibleComponent",
+                                "()Ljavax/accessibility/AccessibleComponent;");
   iface = (*jniEnv)->CallObjectMethod(jniEnv, ac, jmid);
   if (iface != NULL)
   {
diff --git a/jni/src/jawwindow.c b/jni/src/jawwindow.c
index 2073d83..fbd5a77 100644
--- a/jni/src/jawwindow.c
+++ b/jni/src/jawwindow.c
@@ -21,27 +21,66 @@
 #include <atk/atk.h>
 #include <glib.h>
 #include "jawobject.h"
-#include "jawwindow.h"
+#include "jawimpl.h"
 #include "jawutil.h"
 #include "jawtoplevel.h"
 
-static void jaw_window_interface_init (AtkWindowIface *iface);
-static void jaw_window_init(JawWindow *object);
-
 extern void jaw_window_interface_init (AtkWindowIface*);
 extern gpointer jaw_window_data_init (jobject ac);
 extern void jaw_window_data_finalize (gpointer p);
 
 typedef struct _WindowData {
   jobject atk_window;
-  gchar* description;
-  jstring jstrDescription;
 } WindowData;
 
+enum {
+  ACTIVATE,
+  CREATE,
+  DEACTIVATE,
+  DESTROY,
+  MAXIMIZE,
+  MINIMIZE,
+  MOVE,
+  RESIZE,
+  RESTORE,
+  LAST_SIGNAL
+};
+
+static guint atk_window_signals[LAST_SIGNAL] = { 0 };
+
+static guint
+jaw_window_add_signal (const gchar *name)
+{
+  return g_signal_new (name,
+                       JAW_TYPE_OBJECT,
+                       G_SIGNAL_RUN_LAST,
+                       0,
+                       (GSignalAccumulator) NULL, NULL,
+                       g_cclosure_marshal_VOID__VOID,
+                       G_TYPE_NONE,
+                       0);
+}
+
+typedef struct _JawWindowIface JawWindowIface;
+
 void
 jaw_window_interface_init (AtkWindowIface *iface)
 {
-  // Signals
+ static gboolean initialized = FALSE;
+
+  if (!initialized)
+    {
+      atk_window_signals[ACTIVATE]    = jaw_window_add_signal ("activate");
+      atk_window_signals[CREATE]      = jaw_window_add_signal ("create");
+      atk_window_signals[DEACTIVATE]  = jaw_window_add_signal ("deactivate");
+      atk_window_signals[DESTROY]     = jaw_window_add_signal ("destroy");
+      atk_window_signals[MAXIMIZE]    = jaw_window_add_signal ("maximize");
+      atk_window_signals[MINIMIZE]    = jaw_window_add_signal ("minimize");
+      atk_window_signals[MOVE]        = jaw_window_add_signal ("move");
+      atk_window_signals[RESIZE]      = jaw_window_add_signal ("resize");
+      atk_window_signals[RESTORE]     = jaw_window_add_signal ("restore");
+      initialized = TRUE;
+    }
 }
 
 gpointer
@@ -58,12 +97,6 @@ jaw_window_data_init (jobject ac)
   return data;
 }
 
-static void
-jaw_window_init (JawWindow *window)
-{
-  window->state_set = atk_state_set_new();
-}
-
 void
 jaw_window_data_finalize (gpointer p)
 {
@@ -72,14 +105,6 @@ jaw_window_data_finalize (gpointer p)
 
   if (data && data->atk_window)
   {
-    if (data->description != NULL)
-    {
-      (*jniEnv)->ReleaseStringUTFChars(jniEnv, data->jstrDescription, data->description);
-      (*jniEnv)->DeleteGlobalRef(jniEnv, data->jstrDescription);
-      data->jstrDescription = NULL;
-      data->description = NULL;
-    }
-
     (*jniEnv)->DeleteGlobalRef(jniEnv, data->atk_window);
     data->atk_window = NULL;
   }


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