[java-atk-wrapper] remove dependency on gtk+-2.0
- From: Ke Wang <kewang src gnome org>
- To: svn-commits-list gnome org
- Subject: [java-atk-wrapper] remove dependency on gtk+-2.0
- Date: Mon, 6 Jul 2009 08:02:22 +0000 (UTC)
commit 88222cce78190b61a678c51ed343eb99f459b49a
Author: Ke Wang <ke wang sun com>
Date: Mon Jul 6 15:46:27 2009 +0800
remove dependency on gtk+-2.0
configure.in | 2 +-
jni/src/AtkWrapper.c | 67 +++++++++++++++++----------------------------
jni/src/jawaction.c | 2 +-
jni/src/jawcomponent.c | 2 +-
jni/src/jaweditabletext.c | 2 +-
jni/src/jawhyperlink.c | 2 +-
jni/src/jawhypertext.c | 2 +-
jni/src/jawimage.c | 2 +-
jni/src/jawimpl.c | 2 +-
jni/src/jawobject.c | 2 +-
jni/src/jawselection.c | 2 +-
jni/src/jawtable.c | 2 +-
jni/src/jawtext.c | 2 +-
jni/src/jawtoplevel.c | 2 +-
jni/src/jawutil.c | 8 ++---
jni/src/jawvalue.c | 2 +-
16 files changed, 42 insertions(+), 61 deletions(-)
---
diff --git a/configure.in b/configure.in
index df020b1..47e4edc 100644
--- a/configure.in
+++ b/configure.in
@@ -28,7 +28,7 @@ m4_define([req_ver_gtk], [2.10.0])
PKG_CHECK_MODULES(JAW, [
atk >= req_ver_atk
- gtk+-2.0 >= req_ver_gtk
+ glib-2.0
gthread-2.0
gmodule-2.0
])
diff --git a/jni/src/AtkWrapper.c b/jni/src/AtkWrapper.c
index ad17ede..97636c3 100644
--- a/jni/src/AtkWrapper.c
+++ b/jni/src/AtkWrapper.c
@@ -19,7 +19,8 @@
#include <jni.h>
#include <stdio.h>
-#include <gtk/gtk.h>
+#include <glib.h>
+#include <gmodule.h>
#include "jawutil.h"
#include "jawimpl.h"
#include "jawtoplevel.h"
@@ -28,6 +29,11 @@
#define KEY_DISPATCH_CONSUMED 1
#define KEY_DISPATCH_NOT_CONSUMED 2
+#define GDK_SHIFT_MASK (1 << 0)
+#define GDK_CONTROL_MASK (1 << 2)
+#define GDK_MOD1_MASK (1 << 3)
+#define GDK_META_MASK (1 << 28)
+
GMutex *key_dispatch_mutex = NULL;
GCond *key_dispatch_cond = NULL;
static gint key_dispatch_result = KEY_DISPATCH_NOT_DISPATCHED;
@@ -62,9 +68,10 @@ gpointer jni_main_loop(gpointer data) {
(*dl_init)();
g_atexit( dl_shutdown );
- gdk_threads_enter();
- gtk_main();
- gdk_threads_leave();
+ //gdk_threads_enter();
+ GMainLoop *main_loop = g_main_loop_new( NULL, FALSE );
+ g_main_loop_run( main_loop );
+ //gdk_threads_leave();
return NULL;
}
@@ -77,12 +84,9 @@ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_initNativeLibrary
/* Force to invoke base initialization function of each ATK interfaces */
g_type_class_unref(g_type_class_ref(ATK_TYPE_NO_OP_OBJECT));
- //gdk_init(NULL, NULL);
-
if (!g_thread_supported()) {
g_thread_init(NULL);
- gdk_threads_init();
- //XInitThreads();
+ //gdk_threads_init();
}
jaw_impl_init_mutex();
@@ -178,7 +182,7 @@ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_focusNotify(
jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
CallbackPara *para = alloc_callback_para(global_ac);
- gdk_threads_add_idle(focus_notify_handler, para);
+ g_idle_add(focus_notify_handler, para);
}
static gboolean
@@ -224,7 +228,7 @@ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowOpen(
CallbackPara *para = alloc_callback_para(global_ac);
para->is_toplevel = (jIsToplevel == JNI_TRUE) ? TRUE : FALSE;
- gdk_threads_add_idle(window_open_handler, para);
+ g_idle_add(window_open_handler, para);
}
static gboolean
@@ -276,7 +280,7 @@ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowClose(
CallbackPara *para = alloc_callback_para(global_ac);
para->is_toplevel = (jIsToplevel == JNI_TRUE) ? TRUE : FALSE;
- gdk_threads_add_idle(window_close_handler, para);
+ g_idle_add(window_close_handler, para);
}
static gboolean
@@ -306,7 +310,7 @@ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowMinimize(
jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
CallbackPara *para = alloc_callback_para(global_ac);
- gdk_threads_add_idle(window_minimize_handler, para);
+ g_idle_add(window_minimize_handler, para);
}
static gboolean
@@ -337,7 +341,7 @@ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowMaximize(
jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
CallbackPara *para = alloc_callback_para(global_ac);
- gdk_threads_add_idle(window_maximize_handler, para);
+ g_idle_add(window_maximize_handler, para);
}
static gboolean
@@ -368,7 +372,7 @@ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowRestore(
jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
CallbackPara *para = alloc_callback_para(global_ac);
- gdk_threads_add_idle(window_restore_handler, para);
+ g_idle_add(window_restore_handler, para);
}
static gboolean
@@ -399,7 +403,7 @@ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowActivate(
jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
CallbackPara *para = alloc_callback_para(global_ac);
- gdk_threads_add_idle(window_activate_handler, para);
+ g_idle_add(window_activate_handler, para);
}
static gboolean
@@ -430,7 +434,7 @@ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowDeactivate(
jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
CallbackPara *para = alloc_callback_para(global_ac);
- gdk_threads_add_idle(window_deactivate_handler, para);
+ g_idle_add(window_deactivate_handler, para);
}
static gboolean
@@ -461,7 +465,7 @@ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_windowStateChange
jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
CallbackPara *para = alloc_callback_para(global_ac);
- gdk_threads_add_idle(window_state_change_handler, para);
+ g_idle_add(window_state_change_handler, para);
}
static gchar
@@ -758,7 +762,7 @@ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_emitSignal(
para->signal_id = (gint)id;
para->args = global_args;
- gdk_threads_add_idle(signal_emit_handler, para);
+ g_idle_add(signal_emit_handler, para);
}
static gboolean
@@ -797,7 +801,7 @@ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_objectStateChange
para->state_value = FALSE;
}
- gdk_threads_add_idle(object_state_change_handler, para);
+ g_idle_add(object_state_change_handler, para);
}
static gboolean
@@ -819,7 +823,7 @@ JNIEXPORT void JNICALL Java_org_GNOME_Accessibility_AtkWrapper_componentAdded(
jobject global_ac = (*jniEnv)->NewGlobalRef(jniEnv, jAccContext);
CallbackPara *para = alloc_callback_para(global_ac);
- gdk_threads_add_idle(component_added_handler, para);
+ g_idle_add(component_added_handler, para);
}
static gboolean
@@ -888,27 +892,6 @@ key_dispatch_handler (gpointer p)
jfieldID jfidKeycode = (*jniEnv)->GetFieldID(jniEnv, classAtkKeyEvent, "keycode", "I");
event->keycode = (gint)(*jniEnv)->GetIntField(jniEnv, jAtkKeyEvent, jfidKeycode);
- /*GdkKeymapKey *keys = NULL;
- gint n_keys = 0;
- gboolean res = gdk_keymap_get_entries_for_keyval(
- gdk_keymap_get_default(),
- event->keyval,
- &keys,
- &n_keys);
- if (res) {
- event->keycode = 0;
- for (int i = 0; i < n_keys; i++) {
- if (keys[i].group == 0) {
- event->keycode = keys[i].keycode;
- break;
- }
- }
-
- if (event->keycode == 0) {
- event->keycode = keys[0].keycode;
- }
- }*/
-
// timestamp
jfieldID jfidTimestamp = (*jniEnv)->GetFieldID(jniEnv, classAtkKeyEvent, "timestamp", "I");
event->timestamp = (guint32)(*jniEnv)->GetIntField(jniEnv, jAtkKeyEvent, jfidTimestamp);
@@ -938,7 +921,7 @@ JNIEXPORT jboolean JNICALL Java_org_GNOME_Accessibility_AtkWrapper_dispatchKeyEv
g_mutex_lock(key_dispatch_mutex);
- gdk_threads_add_idle(key_dispatch_handler, (gpointer)global_key_event);
+ g_idle_add(key_dispatch_handler, (gpointer)global_key_event);
while (key_dispatch_result == KEY_DISPATCH_NOT_DISPATCHED) {
g_cond_wait(key_dispatch_cond, key_dispatch_mutex);
diff --git a/jni/src/jawaction.c b/jni/src/jawaction.c
index d42f83e..fe145f7 100644
--- a/jni/src/jawaction.c
+++ b/jni/src/jawaction.c
@@ -18,7 +18,7 @@
*/
#include <atk/atk.h>
-#include <gtk/gtk.h>
+#include <glib.h>
#include "jawimpl.h"
#include "jawutil.h"
diff --git a/jni/src/jawcomponent.c b/jni/src/jawcomponent.c
index 5594678..505a5e1 100644
--- a/jni/src/jawcomponent.c
+++ b/jni/src/jawcomponent.c
@@ -18,7 +18,7 @@
*/
#include <atk/atk.h>
-#include <gtk/gtk.h>
+#include <glib.h>
#include "jawimpl.h"
#include "jawutil.h"
diff --git a/jni/src/jaweditabletext.c b/jni/src/jaweditabletext.c
index 9993a87..1e92093 100644
--- a/jni/src/jaweditabletext.c
+++ b/jni/src/jaweditabletext.c
@@ -18,7 +18,7 @@
*/
#include <atk/atk.h>
-#include <gtk/gtk.h>
+#include <glib.h>
#include "jawimpl.h"
#include "jawutil.h"
diff --git a/jni/src/jawhyperlink.c b/jni/src/jawhyperlink.c
index dc7898c..364c6fa 100644
--- a/jni/src/jawhyperlink.c
+++ b/jni/src/jawhyperlink.c
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <gtk/gtk.h>
+#include <glib.h>
#include "jawhyperlink.h"
#include "jawutil.h"
#include "jawimpl.h"
diff --git a/jni/src/jawhypertext.c b/jni/src/jawhypertext.c
index 511db34..ed538a0 100644
--- a/jni/src/jawhypertext.c
+++ b/jni/src/jawhypertext.c
@@ -18,7 +18,7 @@
*/
#include <atk/atk.h>
-#include <gtk/gtk.h>
+#include <glib.h>
#include "jawimpl.h"
#include "jawutil.h"
#include "jawhyperlink.h"
diff --git a/jni/src/jawimage.c b/jni/src/jawimage.c
index d4768d1..500923b 100644
--- a/jni/src/jawimage.c
+++ b/jni/src/jawimage.c
@@ -18,7 +18,7 @@
*/
#include <atk/atk.h>
-#include <gtk/gtk.h>
+#include <glib.h>
#include "jawimpl.h"
#include "jawutil.h"
diff --git a/jni/src/jawimpl.c b/jni/src/jawimpl.c
index ec1a187..05bdde5 100644
--- a/jni/src/jawimpl.c
+++ b/jni/src/jawimpl.c
@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <stdio.h>
-#include <gtk/gtk.h>
+#include <glib.h>
#include "jawutil.h"
#include "jawimpl.h"
#include "jawtoplevel.h"
diff --git a/jni/src/jawobject.c b/jni/src/jawobject.c
index 7666bf4..5238e31 100644
--- a/jni/src/jawobject.c
+++ b/jni/src/jawobject.c
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <gtk/gtk.h>
+#include <glib.h>
#include "jawobject.h"
#include "jawutil.h"
#include "jawtoplevel.h"
diff --git a/jni/src/jawselection.c b/jni/src/jawselection.c
index 835b6d0..1573cd2 100644
--- a/jni/src/jawselection.c
+++ b/jni/src/jawselection.c
@@ -18,7 +18,7 @@
*/
#include <atk/atk.h>
-#include <gtk/gtk.h>
+#include <glib.h>
#include "jawimpl.h"
#include "jawutil.h"
diff --git a/jni/src/jawtable.c b/jni/src/jawtable.c
index e439900..d6954e9 100644
--- a/jni/src/jawtable.c
+++ b/jni/src/jawtable.c
@@ -18,7 +18,7 @@
*/
#include <atk/atk.h>
-#include <gtk/gtk.h>
+#include <glib.h>
#include "jawimpl.h"
#include "jawutil.h"
diff --git a/jni/src/jawtext.c b/jni/src/jawtext.c
index 4721782..c7c1ac3 100644
--- a/jni/src/jawtext.c
+++ b/jni/src/jawtext.c
@@ -18,7 +18,7 @@
*/
#include <atk/atk.h>
-#include <gtk/gtk.h>
+#include <glib.h>
#include "jawimpl.h"
#include "jawutil.h"
diff --git a/jni/src/jawtoplevel.c b/jni/src/jawtoplevel.c
index 8391338..e33da72 100644
--- a/jni/src/jawtoplevel.c
+++ b/jni/src/jawtoplevel.c
@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <stdio.h>
-#include <gtk/gtk.h>
+#include <glib.h>
#include "jawtoplevel.h"
static void jaw_toplevel_class_init (JawToplevelClass *klass);
diff --git a/jni/src/jawutil.c b/jni/src/jawutil.c
index 1c937cb..2b95a75 100644
--- a/jni/src/jawutil.c
+++ b/jni/src/jawutil.c
@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <stdio.h>
-#include <gtk/gtk.h>
+#include <glib.h>
#include "jawutil.h"
#include "jawtoplevel.h"
#include "jawobject.h"
@@ -904,13 +904,11 @@ jaw_misc_init (JawMisc *misc)
static void jaw_misc_threads_enter (AtkMisc *misc)
{
- gdk_threads_enter();
- //GDK_THREADS_ENTER ();
+ //gdk_threads_enter();
}
static void jaw_misc_threads_leave (AtkMisc *misc)
{
- gdk_threads_leave();
- //GDK_THREADS_LEAVE ();
+ //gdk_threads_leave();
}
diff --git a/jni/src/jawvalue.c b/jni/src/jawvalue.c
index 4be06dd..8836e8e 100644
--- a/jni/src/jawvalue.c
+++ b/jni/src/jawvalue.c
@@ -18,7 +18,7 @@
*/
#include <atk/atk.h>
-#include <gtk/gtk.h>
+#include <glib.h>
#include "jawimpl.h"
#include "jawutil.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]