* 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.
#include <atk/atk.h>
#include <droute/droute.h>
+#include <atspi/atspi.h>
#include "bridge.h"
#include "accessible-register.h"
-#include "common/spi-dbus.h"
+#include "spi-dbus.h"
#include "event.h"
#include "object.h"
-#include "dbus/dbus-glib-lowlevel.h"
static GArray *listener_ids = NULL;
typedef struct _SpiReentrantCallClosure
{
+ DBusConnection *bus;
GMainLoop *loop;
DBusMessage *reply;
+ guint timeout;
} SpiReentrantCallClosure;
static void
switch_main_context (GMainContext *cnx)
{
-/* This code won't work on dbus-glib earlier than 0.9.0 because of FDO#30574 */
- if (spi_global_app_data->app_bus_addr [0] == '\0')
- return;
-
GList *list;
- dbus_server_setup_with_g_main (spi_global_app_data->server, cnx);
- dbus_connection_setup_with_g_main (spi_global_app_data->bus, cnx);
+ if (spi_global_app_data->server)
+ atspi_dbus_server_setup_with_g_main (spi_global_app_data->server, cnx);
+ atspi_dbus_connection_setup_with_g_main (spi_global_app_data->bus, cnx);
+ atspi_set_main_context (cnx);
for (list = spi_global_app_data->direct_connections; list; list = list->next)
- dbus_connection_setup_with_g_main (list->data, cnx);
+ atspi_dbus_connection_setup_with_g_main (list->data, cnx);
}
static void
g_main_loop_quit (closure->loop);
}
+static gboolean
+timeout_reply (void *data)
+{
+ SpiReentrantCallClosure *closure = data;
+
+ switch_main_context (NULL);
+ g_main_loop_quit (closure->loop);
+ closure->timeout = -1;
+ return FALSE;
+}
+
static DBusMessage *
send_and_allow_reentry (DBusConnection * bus, DBusMessage * message)
{
DBusPendingCall *pending;
SpiReentrantCallClosure closure;
- GMainContext *main_context;
+ GSource *source;
- main_context = (g_getenv ("AT_SPI_CLIENT") ? NULL :
- spi_global_app_data->main_context);
- closure.loop = g_main_loop_new (main_context, FALSE);
- switch_main_context (main_context);
+ closure.bus = bus;
+ closure.loop = g_main_loop_new (spi_global_app_data->main_context, FALSE);
+ closure.reply = NULL;
+ switch_main_context (spi_global_app_data->main_context);
- if (!dbus_connection_send_with_reply (bus, message, &pending, -1) || !pending)
+ if (!dbus_connection_send_with_reply (bus, message, &pending, 9000) || !pending)
{
switch_main_context (NULL);
return NULL;
}
dbus_pending_call_set_notify (pending, set_reply, (void *) &closure, NULL);
+ source = g_timeout_source_new (500);
+ g_source_set_callback (source, timeout_reply, &closure, NULL);
+ closure.timeout = g_source_attach (source, spi_global_app_data->main_context);
+ g_source_unref (source);
g_main_loop_run (closure.loop);
+ if (closure.timeout != -1)
+ g_source_destroy (source);
g_main_loop_unref (closure.loop);
+ if (!closure.reply)
+ dbus_pending_call_cancel (pending);
return closure.reply;
}
static gboolean
Accessibility_DeviceEventController_NotifyListenersSync (const
- Accessibility_DeviceEvent
+ AtspiDeviceEvent
* key_event)
{
DBusMessage *message;
- DBusError error;
dbus_bool_t consumed = FALSE;
message =
dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY,
- SPI_DBUS_PATH_DEC,
- SPI_DBUS_INTERFACE_DEC,
+ ATSPI_DBUS_PATH_DEC,
+ ATSPI_DBUS_INTERFACE_DEC,
"NotifyListenersSync");
- dbus_error_init (&error);
if (spi_dbus_marshal_deviceEvent (message, key_event))
{
DBusMessage *reply =
{
DBusError error;
dbus_error_init (&error);
- dbus_message_get_args (reply, &error, DBUS_TYPE_BOOLEAN, &consumed,
- DBUS_TYPE_INVALID);
+ if (!dbus_message_get_args (reply, &error, DBUS_TYPE_BOOLEAN,
+ &consumed, DBUS_TYPE_INVALID))
+ {
+ /* TODO: print a warning */
+ dbus_error_free (&error);
+ }
dbus_message_unref (reply);
}
}
}
static void
-spi_init_keystroke_from_atk_key_event (Accessibility_DeviceEvent * keystroke,
+spi_init_keystroke_from_atk_key_event (AtspiDeviceEvent * keystroke,
AtkKeyEventStruct * event)
{
keystroke->id = (dbus_int32_t) event->keyval;
switch (event->type)
{
case (ATK_KEY_EVENT_PRESS):
- keystroke->type = Accessibility_KEY_PRESSED_EVENT;
+ keystroke->type = ATSPI_KEY_PRESSED;
break;
case (ATK_KEY_EVENT_RELEASE):
- keystroke->type = Accessibility_KEY_RELEASED_EVENT;
+ keystroke->type = ATSPI_KEY_RELEASED;
break;
default:
keystroke->type = 0;
spi_atk_bridge_key_listener (AtkKeyEventStruct * event, gpointer data)
{
gboolean result;
- Accessibility_DeviceEvent key_event;
+ AtspiDeviceEvent key_event;
spi_init_keystroke_from_atk_key_event (&key_event, event);
/*---------------------------------------------------------------------------*/
-static gchar *
-convert_signal_name (const gchar * s)
-{
- gchar *ret = g_strdup (s);
- gchar *t;
-
- if (!ret)
- return NULL;
- ret[0] = toupper (ret[0]);
- while ((t = strchr (ret, '-')) != NULL)
- {
- memmove (t, t + 1, strlen (t));
- *t = toupper (*t);
- }
- return ret;
-}
-
static const void *
-replace_null (const gint type,
+validate_for_dbus (const gint type,
const void *val)
{
switch (type)
case DBUS_TYPE_OBJECT_PATH:
if (!val)
return "";
+ else if (!g_utf8_validate (val, -1, NULL))
+ {
+ g_warning ("atk-bridge: Received bad UTF-8 string when emitting event");
+ return "";
+ }
else
return val;
default:
dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, type, &sub);
- val = replace_null ((int) *type, val);
+ val = validate_for_dbus ((int) *type, val);
dbus_message_iter_append_basic(&sub, (int) *type, &val);
dbus_message_iter_close_container(iter, &sub);
return ret;
}
+void
+append_properties (GArray *properties, event_data *evdata)
+{
+ GSList *ls;
+ gint i;
+
+ for (ls = evdata->properties; ls; ls = ls->next)
+ {
+ gboolean dup = FALSE;
+ for (i = 0; i < properties->len; i++)
+ {
+ if (ls->data == g_array_index (properties, AtspiPropertyDefinition *, i))
+ {
+ dup = TRUE;
+ break;
+ }
+ }
+ if (!dup)
+ g_array_append_val (properties, ls->data);
+ }
+}
+
static gboolean
-signal_is_needed (const gchar *klass, const gchar *major, const gchar *minor)
+signal_is_needed (AtkObject *obj, const gchar *klass, const gchar *major,
+ const gchar *minor, GArray **properties)
{
gchar *data [4];
- GList *iter;
event_data *evdata;
gboolean ret = FALSE;
GList *list;
+ GArray *props = NULL;
if (!spi_global_app_data->events_initialized)
return TRUE;
- data [0] = ensure_proper_format (klass + 21);
+ data [0] = ensure_proper_format (klass[0] ? klass + 21 : klass);
data [1] = ensure_proper_format (major);
data [2] = ensure_proper_format (minor);
data [3] = NULL;
+ /* Hack: Always pass events that update the cache.
+ * TODO: FOr 2.2, have at-spi2-core define a special "cache listener" for
+ * this instead, so that we don't send these if no one is listening */
+ if (!g_strcmp0 (data [1], "ChildrenChanged") ||
+ ((!g_strcmp0 (data [1], "PropertyChange")) &&
+ (!g_strcmp0 (data [2], "AccessibleName") ||
+ !g_strcmp0 (data [2], "AccessibleDescription") ||
+ !g_strcmp0 (data [2], "AccessibleParent") ||
+ !g_strcmp0 (data [2], "AccessibleRole"))) ||
+ !g_strcmp0 (data [1], "StateChanged"))
+ {
+ if (minor && !g_strcmp0 (minor, "defunct"))
+ ret = TRUE;
+ else
+ {
+ AtkStateSet *set = atk_object_ref_state_set (obj);
+ AtkState state = ((!g_strcmp0 (data[1], "ChildrenChanged")) ?
+ ATK_STATE_MANAGES_DESCENDANTS : ATK_STATE_TRANSIENT);
+ ret = !atk_state_set_contains_state (set, state);
+ g_object_unref (set);
+ }
+ }
+
/* Hack: events such as "object::text-changed::insert:system" as
generated by Gecko */
data [2][strcspn (data [2], ":")] = '\0';
+
for (list = spi_global_app_data->events; list; list = list->next)
{
evdata = list->data;
if (spi_event_is_subtype (data, evdata->data))
{
ret = TRUE;
- break;
+ if (!props)
+ props = g_array_new (TRUE, TRUE, sizeof (AtspiPropertyDefinition *));
+ append_properties (props, evdata);
}
}
g_free (data [2]);
g_free (data [1]);
g_free (data [0]);
+ *properties = props;
+ return ret;
+}
+
+/* Convert a : to a / so that listeners can use arg0path to match only
+ * * the prefix */
+static char *
+adapt_minor_for_dbus (const char *source)
+{
+ gchar *ret = g_strdup (source);
+ int i = strcspn (ret, ":");
+ if (ret[i] == ':')
+ ret[i] = '/';
return ret;
}
+static void
+open_variant (DBusMessageIter *iter, const char *name, const char *type,
+ DBusMessageIter *out)
+{
+ dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &name);
+ dbus_message_iter_open_container (iter, DBUS_TYPE_VARIANT, type, out);
+}
+
/*
* Emits an AT-SPI event.
* AT-SPI events names are split into three parts:
void (*append_variant) (DBusMessageIter *, const char *, const void *))
{
DBusConnection *bus = spi_global_app_data->bus;
- const char *path;
+ char *path;
+ char *minor_dbus;
- gchar *cname, *t;
+ gchar *cname;
DBusMessage *sig;
- DBusMessageIter iter, iter_struct;
+ DBusMessageIter iter, iter_dict, iter_dict_entry, iter_variant, iter_array;
+ GArray *properties = NULL;
if (!klass) klass = "";
if (!major) major = "";
if (!minor) minor = "";
if (!type) type = "u";
- if (!signal_is_needed (klass, major, minor))
+ if (!signal_is_needed (obj, klass, major, minor, &properties))
return;
path = spi_register_object_to_path (spi_global_register, G_OBJECT (obj));
+ g_return_if_fail (path != NULL);
/*
* This is very annoying, but as '-' isn't a legal signal
dbus_message_iter_init_append(sig, &iter);
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &minor);
+ minor_dbus = adapt_minor_for_dbus (minor);
+ dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &minor_dbus);
+ g_free (minor_dbus);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &detail1);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &detail2);
append_variant (&iter, type, val);
- spi_object_append_reference (&iter, spi_global_app_data->root);
+
+ dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "{sv}", &iter_dict);
+ /* Add requested properties, unless the object is being marked defunct, in
+ which case it's safest not to touch it */
+ if (minor == NULL || strcmp (minor, "defunct") != 0 || detail1 == 0)
+ {
+ if (properties)
+ {
+ gint i;
+ for (i = 0; i < properties->len; i++)
+ {
+ AtspiPropertyDefinition *prop = g_array_index (properties, AtspiPropertyDefinition *, i);
+ dbus_message_iter_open_container (&iter_dict, DBUS_TYPE_DICT_ENTRY, NULL,
+ &iter_dict_entry);
+ dbus_message_iter_append_basic (&iter_dict_entry, DBUS_TYPE_STRING, &prop->name);
+ prop->func (&iter_dict_entry, obj);
+ dbus_message_iter_close_container (&iter_dict, &iter_dict_entry);
+ }
+ g_array_free (properties, TRUE);
+ }
+ }
+ dbus_message_iter_close_container (&iter, &iter_dict);
dbus_connection_send(bus, sig, NULL);
dbus_message_unref(sig);
const gchar *pname = NULL;
AtkObject *otemp;
- const gchar *s1, s2;
+ const gchar *s1;
gint i;
accessible = g_value_get_object (¶m_values[0]);
const GValue * param_values, gpointer data)
{
AtkObject *accessible;
- gchar *pname;
+ const gchar *pname;
guint detail1;
accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
- pname = g_strdup (g_value_get_string (¶m_values[1]));
+ pname = g_value_get_string (¶m_values[1]);
- /* TODO - Possibly ignore a change to the 'defunct' state.
- * This is because without reference counting defunct objects should be removed.
- */
detail1 = (g_value_get_boolean (¶m_values[2])) ? 1 : 0;
emit_event (accessible, ITF_EVENT_OBJECT, STATE_CHANGED, pname, detail1, 0,
DBUS_TYPE_INT32_AS_STRING, 0, append_basic);
- g_free (pname);
+
+ if (!g_strcmp0 (pname, "defunct") && detail1)
+ spi_register_deregister_object (spi_global_register, G_OBJECT (accessible),
+ TRUE);
return TRUE;
}
* Gtk:AtkDocument:load-complete -> document:load-complete
* Gtk:AtkDocument:load-stopped -> document:load-stopped
* Gtk:AtkDocument:reload -> document:reload
+ * Gtk:AtkDocument:page-changed -> document:page-changed
*/
static gboolean
document_event_listener (GSignalInvocationHint * signal_hint,
AtkObject *accessible;
GSignalQuery signal_query;
const gchar *name, *s;
+ gint detail1 = 0;
g_signal_query (signal_hint->signal_id, &signal_query);
name = signal_query.signal_name;
+ if (n_param_values > 0) // on the case of page-changed
+ if (G_VALUE_TYPE (¶m_values[1]) == G_TYPE_INT)
+ detail1 = g_value_get_int (¶m_values[1]);
+
accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
s = atk_object_get_name (accessible);
- emit_event (accessible, ITF_EVENT_DOCUMENT, name, "", 0, 0,
+ emit_event (accessible, ITF_EVENT_DOCUMENT, name, "", detail1, 0,
DBUS_TYPE_STRING_AS_STRING, s, append_basic);
return TRUE;
AtkObject *accessible;
AtkRectangle *atk_rect;
GSignalQuery signal_query;
- const gchar *name, *s;
+ const gchar *name;
g_signal_query (signal_hint->signal_id, &signal_query);
name = signal_query.signal_name;
AtkObject *accessible;
AtkObject *child;
GSignalQuery signal_query;
- const gchar *name, *minor;
+ const gchar *name;
gint detail1;
g_signal_query (signal_hint->signal_id, &signal_query);
accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
child = ATK_OBJECT (g_value_get_pointer (¶m_values[1]));
g_return_val_if_fail (ATK_IS_OBJECT (child), TRUE);
- minor = g_quark_to_string (signal_hint->detail);
detail1 = atk_object_get_index_in_parent (child);
AtkObject *accessible;
GSignalQuery signal_query;
const gchar *name, *minor;
- gint detail1;
+ gint detail1 = 0;
g_signal_query (signal_hint->signal_id, &signal_query);
name = signal_query.signal_name;
/*
* Handles the ATK signal 'Gtk:AtkText:text-changed' and
* converts it to the AT-SPI signal - 'object:text-changed'
+ * This signal is deprecated by Gtk:AtkText:text-insert
+ * and Gtk:AtkText:text-remove
*
*/
static gboolean
GSignalQuery signal_query;
const gchar *name, *minor;
gchar *selected;
- gint detail1, detail2;
+ gint detail1 = 0, detail2 = 0;
g_signal_query (signal_hint->signal_id, &signal_query);
name = signal_query.signal_name;
emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
DBUS_TYPE_STRING_AS_STRING, selected, append_basic);
+ g_free (selected);
+
return TRUE;
}
+/*
+ * Handles the ATK signal 'Gtk:AtkText:text-insert' and
+ * converts it to the AT-SPI signal - 'object:text-changed'
+ *
+ */
+static gboolean
+text_insert_event_listener (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values, gpointer data)
+{
+ AtkObject *accessible;
+ guint text_changed_signal_id;
+ GSignalQuery signal_query;
+ const gchar *name;
+ const gchar *minor_raw, *text;
+ gchar *minor;
+ gint detail1 = 0, detail2 = 0;
+
+ accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
+ /* Get signal name for 'Gtk:AtkText:text-changed' so
+ * we convert it to the AT-SPI signal - 'object:text-changed'
+ */
+ text_changed_signal_id = g_signal_lookup ("text-changed", G_OBJECT_TYPE (accessible));
+ g_signal_query (text_changed_signal_id, &signal_query);
+ name = signal_query.signal_name;
+
+
+ /* Add the insert and keep any detail coming from atk */
+ minor_raw = g_quark_to_string (signal_hint->detail);
+ if (minor_raw)
+ minor = g_strconcat ("insert:", minor_raw, NULL);
+ else
+ minor = g_strdup ("insert");
+
+ if (G_VALUE_TYPE (¶m_values[1]) == G_TYPE_INT)
+ detail1 = g_value_get_int (¶m_values[1]);
+
+ if (G_VALUE_TYPE (¶m_values[2]) == G_TYPE_INT)
+ detail2 = g_value_get_int (¶m_values[2]);
+
+ if (G_VALUE_TYPE (¶m_values[3]) == G_TYPE_STRING)
+ text = g_value_get_string (¶m_values[3]);
+
+ emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
+ DBUS_TYPE_STRING_AS_STRING, text, append_basic);
+ g_free (minor);
+ return TRUE;
+}
+
+/*
+ * Handles the ATK signal 'Gtk:AtkText:text-remove' and
+ * converts it to the AT-SPI signal - 'object:text-changed'
+ *
+ */
+static gboolean
+text_remove_event_listener (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values, gpointer data)
+{
+ AtkObject *accessible;
+ guint text_changed_signal_id;
+ GSignalQuery signal_query;
+ const gchar *name;
+ const gchar *minor_raw, *text;
+ gchar *minor;
+ gint detail1 = 0, detail2 = 0;
+
+ accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
+ /* Get signal name for 'Gtk:AtkText:text-changed' so
+ * we convert it to the AT-SPI signal - 'object:text-changed'
+ */
+ text_changed_signal_id = g_signal_lookup ("text-changed", G_OBJECT_TYPE (accessible));
+ g_signal_query (text_changed_signal_id, &signal_query);
+ name = signal_query.signal_name;
+
+ minor_raw = g_quark_to_string (signal_hint->detail);
+
+ /* Add the delete and keep any detail coming from atk */
+ if (minor_raw)
+ minor = g_strconcat ("delete:", minor_raw, NULL);
+ else
+ minor = g_strdup ("delete");
+
+ if (G_VALUE_TYPE (¶m_values[1]) == G_TYPE_INT)
+ detail1 = g_value_get_int (¶m_values[1]);
+
+ if (G_VALUE_TYPE (¶m_values[2]) == G_TYPE_INT)
+ detail2 = g_value_get_int (¶m_values[2]);
+
+ if (G_VALUE_TYPE (¶m_values[3]) == G_TYPE_STRING)
+ text = g_value_get_string (¶m_values[3]);
+
+ emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
+ DBUS_TYPE_STRING_AS_STRING, text, append_basic);
+ g_free (minor);
+ return TRUE;
+}
+
+
/*---------------------------------------------------------------------------*/
/*
AtkObject *accessible;
GSignalQuery signal_query;
const gchar *name, *minor;
- gint detail1, detail2;
g_signal_query (signal_hint->signal_id, &signal_query);
name = signal_query.signal_name;
accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
minor = g_quark_to_string (signal_hint->detail);
- if (G_VALUE_TYPE (¶m_values[1]) == G_TYPE_INT)
- detail1 = g_value_get_int (¶m_values[1]);
-
- if (G_VALUE_TYPE (¶m_values[2]) == G_TYPE_INT)
- detail2 = g_value_get_int (¶m_values[2]);
-
- emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
+ emit_event (accessible, ITF_EVENT_OBJECT, name, minor, 0, 0,
DBUS_TYPE_STRING_AS_STRING, "", append_basic);
return TRUE;
}
{
GSignalQuery signal_query;
const gchar *name, *minor;
- gint detail1, detail2 = 0;
+ gint detail1 = 0, detail2 = 0;
AtkObject *accessible, *ao=NULL;
gpointer child;
+ AtkStateSet *set;
+ gboolean ret;
g_signal_query (signal_hint->signal_id, &signal_query);
name = signal_query.signal_name;
+ /* If the accessible is on STATE_MANAGES_DESCENDANTS state,
+ children-changed signal are not forwarded. */
accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
+ set = atk_object_ref_state_set (accessible);
+ ret = atk_state_set_contains_state (set, ATK_STATE_MANAGES_DESCENDANTS);
+ g_object_unref (set);
+
+ if (ret)
+ return TRUE;
+
minor = g_quark_to_string (signal_hint->detail);
detail1 = g_value_get_uint (param_values + 1);
detail1);
emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
"(so)", ao, append_object);
+ g_object_unref (ao);
}
else
{
/*---------------------------------------------------------------------------*/
-static void
-toplevel_added_event_listener (AtkObject * accessible,
- guint index, AtkObject * child)
-{
- emit_event (accessible, ITF_EVENT_OBJECT, "children-changed", "add", index, 0,
- "(so)", child, append_object);
-}
-
-static void
-toplevel_removed_event_listener (AtkObject * accessible,
- guint index, AtkObject * child)
-{
- emit_event (accessible, ITF_EVENT_OBJECT, "children-changed", "remove", index, 0,
- "(so)", child, append_object);
-}
-
-/*---------------------------------------------------------------------------*/
-
/*
* Generic signal converter and forwarder.
*
* 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;
}
/*
*/
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);
+ if (listener_ids)
+ {
+ g_warning ("atk_bridge: spi_atk-register_event_listeners called multiple times");
+ return;
+ }
+
/* Register for focus event notifications, and register app with central registry */
listener_ids = g_array_sized_new (FALSE, TRUE, sizeof (guint), 16);
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");
add_signal_listener (document_event_listener,
"Gtk:AtkDocument:load-stopped");
+ add_signal_listener (document_event_listener,
+ "Gtk:AtkDocument:page-changed");
/* TODO Fake this event on the client side */
add_signal_listener (state_event_listener, "Gtk:AtkObject:state-change");
/* TODO */
"Gtk:AtkText:text-selection-changed");
add_signal_listener (text_changed_event_listener,
"Gtk:AtkText:text-changed");
+ add_signal_listener (text_insert_event_listener,
+ "Gtk:AtkText:text-insert");
+ add_signal_listener (text_remove_event_listener,
+ "Gtk:AtkText:text-remove");
add_signal_listener (link_selected_event_listener,
"Gtk:AtkHypertext:link-selected");
add_signal_listener (generic_event_listener,
"Gtk:AtkTable:column-reordered");
add_signal_listener (generic_event_listener, "Gtk:AtkTable:column-deleted");
add_signal_listener (generic_event_listener, "Gtk:AtkTable:model-changed");
-
- /* Children signal listeners */
- atk_add_global_event_listener (children_changed_event_listener,
- "Gtk:AtkObject:children-changed");
+ add_signal_listener (children_changed_event_listener, "Gtk:AtkObject:children-changed");
#if 0
g_signal_connect (G_OBJECT (spi_global_app_data->root),
listener_ids = NULL;
if (atk_bridge_focus_tracker_id)
+ {
atk_remove_focus_tracker (atk_bridge_focus_tracker_id);
+ atk_bridge_focus_tracker_id = 0;
+ }
- for (i = 0; ids && i < ids->len; i++)
+ if (ids)
{
- atk_remove_global_event_listener (g_array_index (ids, guint, i));
+ for (i = 0; i < ids->len; i++)
+ {
+ atk_remove_global_event_listener (g_array_index (ids, guint, i));
+ }
+ g_array_free (ids, TRUE);
}
if (atk_bridge_key_event_listener_id)
+ {
atk_remove_key_event_listener (atk_bridge_key_event_listener_id);
+ atk_bridge_key_event_listener_id = 0;
+ }
}
/*---------------------------------------------------------------------------*/