summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Piñeiro <apinheiro@igalia.com>2011-08-23 17:07:02 +0200
committerMike Gorse <mgorse@novell.com>2011-08-29 16:30:46 -0500
commit9c6a0bf23be6b7ec8459c32bef270e44c16e8af7 (patch)
tree4b311395f29b2b1631f563dc8e48952873f04341
parent524e78d6743b9d17f122f233122419728ae6372d (diff)
downloadat-spi2-atk-9c6a0bf23be6b7ec8459c32bef270e44c16e8af7.tar.gz
Using new format to register to window events
Now ATK has AtkWindow, so the format to register to window events is like any other ATK event We check if we need to register using the old format, assuming that if you are able to register to a window event using the old format is because the ATK implementor is still using the old one. This check should be temporal.
-rw-r--r--atk-adaptor/event.c48
-rw-r--r--configure.ac2
2 files changed, 40 insertions, 10 deletions
diff --git a/atk-adaptor/event.c b/atk-adaptor/event.c
index e940e00..6add6e7 100644
--- a/atk-adaptor/event.c
+++ b/atk-adaptor/event.c
@@ -2,6 +2,7 @@
* AT-SPI - Assistive Technology Service Provider Interface
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
*
+ * Copyright 2011, F123 Consulting & Mais Diferenças
* Copyright 2008, 2009, Codethink Ltd.
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.,
* Copyright 2001, 2002, 2003 Ximian, Inc.
@@ -1069,13 +1070,17 @@ generic_event_listener (GSignalInvocationHint * signal_hint,
* and stores the signal id returned so that the function may be
* de-registered later.
*/
-static void
+static guint
add_signal_listener (GSignalEmissionHook listener, const char *signal_name)
{
guint id;
id = atk_add_global_event_listener (listener, signal_name);
- g_array_append_val (listener_ids, id);
+
+ if (id > 0) /* id == 0 is a failure */
+ g_array_append_val (listener_ids, id);
+
+ return id;
}
/*
@@ -1092,6 +1097,7 @@ spi_atk_register_event_listeners (void)
*/
GObject *ao = g_object_new (ATK_TYPE_OBJECT, NULL);
AtkObject *bo = atk_no_op_object_new (ao);
+ guint id = 0;
g_object_unref (G_OBJECT (bo));
g_object_unref (ao);
@@ -1109,13 +1115,37 @@ spi_atk_register_event_listeners (void)
add_signal_listener (property_event_listener,
"Gtk:AtkObject:property-change");
- add_signal_listener (window_event_listener, "window:create");
- add_signal_listener (window_event_listener, "window:destroy");
- add_signal_listener (window_event_listener, "window:minimize");
- add_signal_listener (window_event_listener, "window:maximize");
- add_signal_listener (window_event_listener, "window:restore");
- add_signal_listener (window_event_listener, "window:activate");
- add_signal_listener (window_event_listener, "window:deactivate");
+
+ /* window events: we tentative try to register using the old format */
+ id = add_signal_listener (window_event_listener, "window:create");
+
+ if (id != 0)
+ {
+ /* If we are able to register using the old format, we assume
+ * that the ATK implementor is managing window events without
+ * AtkWindow. We can't use the opposite test because after
+ * including AtkWindow on ATK you would be able to register to
+ * that event, although the ATK implementor could or not use it.
+ */
+
+ add_signal_listener (window_event_listener, "window:destroy");
+ add_signal_listener (window_event_listener, "window:minimize");
+ add_signal_listener (window_event_listener, "window:maximize");
+ add_signal_listener (window_event_listener, "window:restore");
+ add_signal_listener (window_event_listener, "window:activate");
+ add_signal_listener (window_event_listener, "window:deactivate");
+ }
+ else
+ {
+ add_signal_listener (window_event_listener, "Atk:AtkWindow:create");
+ add_signal_listener (window_event_listener, "Atk:AtkWindow:destroy");
+ add_signal_listener (window_event_listener, "Atk:AtkWindow:minimize");
+ add_signal_listener (window_event_listener, "Atk:AtkWindow:maximize");
+ add_signal_listener (window_event_listener, "Atk:AtkWindow:restore");
+ add_signal_listener (window_event_listener, "Atk:AtkWindow:activate");
+ add_signal_listener (window_event_listener, "Atk:AtkWindow:deactivate");
+ }
+
add_signal_listener (document_event_listener,
"Gtk:AtkDocument:load-complete");
add_signal_listener (document_event_listener, "Gtk:AtkDocument:reload");
diff --git a/configure.ac b/configure.ac
index 3518873..ade7123 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,7 +51,7 @@ PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.0.0])
AC_SUBST(GMODULE_LIBS)
AC_SUBST(GMODULE_CFLAGS)
-PKG_CHECK_MODULES(ATK, [atk >= 2.1.0])
+PKG_CHECK_MODULES(ATK, [atk >= 2.1.5])
AC_SUBST(ATK_LIBS)
AC_SUBST(ATK_CFLAGS)