[java-atk-wrapper] JNI: Create JawWindow for AtkWindow signals
- From: Magdalen Berns <mberns src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [java-atk-wrapper] JNI: Create JawWindow for AtkWindow signals
- Date: Sat, 6 Jun 2015 12:31:31 +0000 (UTC)
commit cf4927aa81163b1333758c50aa8ed4d0fd19a488
Author: Magdalen Berns <m berns thismagpie com>
Date: Sat Jun 6 13:24:24 2015 +0100
JNI: Create JawWindow for AtkWindow signals
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=745343
jni/src/Makefile.am | 6 +-
jni/src/jawimpl.c | 1 +
jni/src/jawobject.c | 141 +-----------------
jni/src/jawtoplevel.c | 1 +
jni/src/jawutil.c | 1 +
jni/src/jawutil.h | 1 +
jni/src/jawwindow.c | 196 ++++++++++++++++++++++++
jni/src/jawwindow.h | 58 +++++++
wrapper/org/GNOME/Accessibility/AtkWindow.java | 27 ++++
9 files changed, 291 insertions(+), 141 deletions(-)
---
diff --git a/jni/src/Makefile.am b/jni/src/Makefile.am
index b1bd59c..2ca2dc0 100644
--- a/jni/src/Makefile.am
+++ b/jni/src/Makefile.am
@@ -14,13 +14,15 @@ libatk_wrapper_la_SOURCES = AtkWrapper.c \
jawimage.c \
jawselection.c \
jawvalue.c \
- jawtable.c
+ jawtable.c \
+ jawwindow.c
noinst_HEADERS = jawimpl.h \
jawobject.h \
jawhyperlink.h \
jawtoplevel.h \
- jawutil.h
+ jawutil.h \
+ jawwindow.h
libatk_wrapper_la_CFLAGS = $(JNI_INCLUDES)\
$(JAW_CFLAGS)
diff --git a/jni/src/jawimpl.c b/jni/src/jawimpl.c
index 5ca98c8..104642f 100644
--- a/jni/src/jawimpl.c
+++ b/jni/src/jawimpl.c
@@ -23,6 +23,7 @@
#include <glib.h>
#include <glib-object.h>
#include <glib/gprintf.h>
+#include "jawwindow.h"
#include "jawutil.h"
#include "jawimpl.h"
#include "jawtoplevel.h"
diff --git a/jni/src/jawobject.c b/jni/src/jawobject.c
index 1e97fdc..2728f4f 100644
--- a/jni/src/jawobject.c
+++ b/jni/src/jawobject.c
@@ -21,13 +21,12 @@
#include <atk/atk.h>
#include <glib.h>
#include "jawobject.h"
+#include "jawwindow.h"
#include "jawutil.h"
#include "jawtoplevel.h"
static void jaw_object_class_init(JawObjectClass *klass);
static void jaw_object_init(JawObject *object);
-static void jaw_object_dispose(GObject *gobject);
-static void jaw_object_finalize(GObject *gobject);
/* AtkObject */
static const gchar* jaw_object_get_name(AtkObject *atk_obj);
@@ -42,30 +41,11 @@ static AtkStateSet* jaw_object_ref_state_set(AtkObject *atk_obj);
static gpointer parent_class = NULL;
-enum {
- ACTIVATE,
- CREATE,
- DEACTIVATE,
- DESTROY,
- MAXIMIZE,
- MINIMIZE,
- MOVE,
- RESIZE,
- RESTORE,
- TOTAL_SIGNAL
-};
-
-static guint jaw_window_signals[TOTAL_SIGNAL] = { 0, };
-
G_DEFINE_TYPE (JawObject, jaw_object, ATK_TYPE_OBJECT);
static void
jaw_object_class_init (JawObjectClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
- gobject_class->dispose = jaw_object_dispose;
- gobject_class->finalize = jaw_object_finalize;
-
AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
@@ -92,80 +72,7 @@ jaw_object_class_init (JawObjectClass *klass)
atk_class->get_attributes = jaw_object_get_attributes;
*/
klass->get_interface_data = NULL;
-
- jaw_window_signals [ACTIVATE] = g_signal_new ("activate",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0, /* default signal handler */
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
- jaw_window_signals [CREATE] = g_signal_new ("create",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0, /* default signal handler */
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
- jaw_window_signals [DEACTIVATE] = g_signal_new ("deactivate",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0, /* default signal handler */
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- jaw_window_signals [DESTROY] = g_signal_new ("destroy",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0, /* default signal handler */
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
- jaw_window_signals [MAXIMIZE] = g_signal_new ("maximize",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0, /* default signal handler */
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- jaw_window_signals [MINIMIZE] = g_signal_new ("minimize",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0, /* default signal handler */
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- jaw_window_signals [MOVE] = g_signal_new ("move",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0, /* default signal handler */
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- jaw_window_signals [RESIZE] = g_signal_new ("resize",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0, /* default signal handler */
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
- jaw_window_signals [RESTORE] = g_signal_new ("restore",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0, /* default signal handler */
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
- }
+}
gpointer
jaw_object_get_interface_data (JawObject *jaw_obj, guint iface)
@@ -186,50 +93,6 @@ jaw_object_init (JawObject *object)
object->state_set = atk_state_set_new();
}
-static void
-jaw_object_dispose (GObject *gobject)
-{
- /* Customized dispose code */
-
- /* Chain up to parent's dispose method */
- G_OBJECT_CLASS(jaw_object_parent_class)->dispose(gobject);
-}
-
-static void
-jaw_object_finalize (GObject *gobject)
-{
- /* Customized finalize code */
- JawObject *jaw_obj = JAW_OBJECT(gobject);
- AtkObject *atk_obj = ATK_OBJECT(gobject);
- JNIEnv *jniEnv = jaw_util_get_jni_env();
-
- if (atk_obj->name != NULL)
- {
- (*jniEnv)->ReleaseStringUTFChars(jniEnv, jaw_obj->jstrName, atk_obj->name);
- (*jniEnv)->DeleteGlobalRef(jniEnv, jaw_obj->jstrName);
- jaw_obj->jstrName = NULL;
- atk_obj->name = NULL;
- }
-
- if (atk_obj->description != NULL)
- {
- (*jniEnv)->ReleaseStringUTFChars(jniEnv,
- jaw_obj->jstrDescription,
- atk_obj->description);
-
- (*jniEnv)->DeleteGlobalRef(jniEnv, jaw_obj->jstrDescription);
- jaw_obj->jstrDescription = NULL;
- atk_obj->description = NULL;
- }
-
- if (G_OBJECT(jaw_obj->state_set) != NULL)
- {
- g_object_unref(G_OBJECT(jaw_obj->state_set));
- /* Chain up to parent's finalize method */
- G_OBJECT_CLASS(jaw_object_parent_class)->finalize(gobject);
- }
-}
-
static const gchar*
jaw_object_get_name (AtkObject *atk_obj)
{
diff --git a/jni/src/jawtoplevel.c b/jni/src/jawtoplevel.c
index db8de88..e7bf120 100644
--- a/jni/src/jawtoplevel.c
+++ b/jni/src/jawtoplevel.c
@@ -22,6 +22,7 @@
#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 ce2d406..33941f1 100644
--- a/jni/src/jawutil.c
+++ b/jni/src/jawutil.c
@@ -26,6 +26,7 @@
#include <glib/gprintf.h>
#include "jawutil.h"
#include "jawtoplevel.h"
+#include "jawwindow.h"
#include "jawobject.h"
#ifdef __cplusplus
diff --git a/jni/src/jawutil.h b/jni/src/jawutil.h
index fceb182..59da9c7 100644
--- a/jni/src/jawutil.h
+++ b/jni/src/jawutil.h
@@ -40,6 +40,7 @@ JNIEnv *globalEnv;
#define INTERFACE_TABLE 0x00000200
#define INTERFACE_TEXT 0x00000400
#define INTERFACE_VALUE 0x00000800
+#define INTERFACE_WINDOW 0x00001000
#define JAW_TYPE_UTIL (jaw_util_get_type())
#define JAW_UTIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JAW_TYPE_UTIL, JawUtil))
diff --git a/jni/src/jawwindow.c b/jni/src/jawwindow.c
new file mode 100644
index 0000000..69104b0
--- /dev/null
+++ b/jni/src/jawwindow.c
@@ -0,0 +1,196 @@
+/*
+ * Java ATK Wrapper for GNOME
+ *
+ * Copyright (C) 2015 Magdalen Berns <m berns thismagpie com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <atk/atk.h>
+#include <glib.h>
+#include <string.h>
+#include "jawobject.h"
+#include "jawwindow.h"
+#include "jawutil.h"
+#include "jawtoplevel.h"
+
+static void jaw_window_class_init(JawWindowClass *klass);
+static void jaw_window_init(JawWindow *object);
+static void jaw_window_dispose(GObject *gobject);
+static void jaw_window_finalize(GObject *gobject);
+
+static gpointer parent_class = NULL;
+
+enum {
+ ACTIVATE,
+ CREATE,
+ DEACTIVATE,
+ DESTROY,
+ MAXIMIZE,
+ MINIMIZE,
+ MOVE,
+ RESIZE,
+ RESTORE,
+ TOTAL_SIGNAL
+};
+
+static guint jaw_window_signals[TOTAL_SIGNAL] = { 0, };
+
+G_DEFINE_TYPE(JawWindow, jaw_window, JAW_TYPE_OBJECT)
+
+static void
+jaw_window_class_init (JawWindowClass *klass)
+{
+
+ GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+ gobject_class->dispose = jaw_window_dispose;
+ gobject_class->finalize = jaw_window_finalize;
+ parent_class = g_type_class_peek_parent (klass);
+
+ klass->get_interface_data = NULL;
+
+ jaw_window_signals [ACTIVATE] = g_signal_new ("activate",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, /* default signal handler */
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+ jaw_window_signals [CREATE] = g_signal_new ("create",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, /* default signal handler */
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+ jaw_window_signals [DEACTIVATE] = g_signal_new ("deactivate",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, /* default signal handler */
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+ jaw_window_signals [DESTROY] = g_signal_new ("destroy",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, /* default signal handler */
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+ jaw_window_signals [MAXIMIZE] = g_signal_new ("maximize",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, /* default signal handler */
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+ jaw_window_signals [MINIMIZE] = g_signal_new ("minimize",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, /* default signal handler */
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+ jaw_window_signals [MOVE] = g_signal_new ("move",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, /* default signal handler */
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+ jaw_window_signals [RESIZE] = g_signal_new ("resize",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, /* default signal handler */
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+ jaw_window_signals [RESTORE] = g_signal_new ("restore",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, /* default signal handler */
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+}
+
+gpointer
+jaw_window_get_interface_data (JawWindow *jaw_win, guint iface)
+{
+
+ JawWindowClass *klass = JAW_WINDOW_GET_CLASS(jaw_win);
+ if (klass->get_interface_data)
+ return klass->get_interface_data(jaw_win, iface);
+
+ return NULL;
+}
+
+static void
+jaw_window_init (JawWindow *window)
+{
+ window->state_set = atk_state_set_new();
+}
+
+static void
+jaw_window_dispose (GObject *gobject)
+{
+ /* Chain up to parent's dispose method */
+ G_OBJECT_CLASS(parent_class)->dispose(gobject);
+}
+
+static void
+jaw_window_finalize (GObject *gobject)
+{
+ /* Customized finalize code */
+ JawObject *jaw_obj = JAW_OBJECT(gobject);
+ AtkObject *atk_obj = ATK_OBJECT(gobject);
+ JNIEnv *jniEnv = jaw_util_get_jni_env();
+
+ if (atk_obj->name != NULL)
+ {
+ (*jniEnv)->ReleaseStringUTFChars(jniEnv, jaw_obj->jstrName, atk_obj->name);
+ (*jniEnv)->DeleteGlobalRef(jniEnv, jaw_obj->jstrName);
+ jaw_obj->jstrName = NULL;
+ atk_obj->name = NULL;
+ }
+
+ if (atk_obj->description != NULL)
+ {
+ (*jniEnv)->ReleaseStringUTFChars(jniEnv,
+ jaw_obj->jstrDescription,
+ atk_obj->description);
+
+ (*jniEnv)->DeleteGlobalRef(jniEnv, jaw_obj->jstrDescription);
+ jaw_obj->jstrDescription = NULL;
+ atk_obj->description = NULL;
+ }
+
+ if (G_OBJECT(jaw_obj->state_set) != NULL)
+ {
+ g_object_unref(G_OBJECT(jaw_obj->state_set));
+ /* Chain up to parent's finalize method */
+ G_OBJECT_CLASS(parent_class)->finalize(gobject);
+ }
+}
+
diff --git a/jni/src/jawwindow.h b/jni/src/jawwindow.h
new file mode 100644
index 0000000..5b16243
--- /dev/null
+++ b/jni/src/jawwindow.h
@@ -0,0 +1,58 @@
+/*
+ * Java ATK Wrapper for GNOME
+ *
+ * Copyright (C) 2015 Magdalen Berns <m berns thismagpie com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _JAW_WINDOW_H_
+#define _JAW_WINDOW_H_
+
+#include <atk/atk.h>
+#include <jni.h>
+
+G_BEGIN_DECLS
+
+#define JAW_TYPE_WINDOW (jaw_window_get_type ())
+#define JAW_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JAW_TYPE_WINDOW, JawWindow))
+#define JAW_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), JAW_TYPE_WINDOW, JawWindowClass))
+#define JAW_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JAW_TYPE_WINDOW))
+#define JAW_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), JAW_TYPE_WINDOW))
+#define JAW_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), JAW_TYPE_WINDOW, JawWindowClass))
+
+typedef struct _JawWindow JawWindow;
+typedef struct _JawWindowClass JawWindowClass;
+
+struct _JawWindow
+{
+ AtkObject parent;
+ jobject acc_context;
+ AtkStateSet *state_set;
+};
+
+GType jaw_window_get_type (void);
+
+struct _JawWindowClass
+{
+ AtkObjectClass parent_class;
+ gpointer (*get_interface_data) (JawWindow*, guint);
+};
+
+gpointer jaw_window_get_interface_data (JawWindow*, guint);
+
+G_END_DECLS
+
+#endif
diff --git a/wrapper/org/GNOME/Accessibility/AtkWindow.java b/wrapper/org/GNOME/Accessibility/AtkWindow.java
new file mode 100644
index 0000000..a472a86
--- /dev/null
+++ b/wrapper/org/GNOME/Accessibility/AtkWindow.java
@@ -0,0 +1,27 @@
+/*
+ * Java ATK Wrapper for GNOME
+ * Copyright (C) 2015 Magdalen Berns <m berns thismagpie com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.GNOME.Accessibility;
+
+import javax.accessibility.*;
+
+public interface AtkWindow {
+
+ public AccessibleContext getAccessibleContext();
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]