#include "bridge.h"
#include "accessible-register.h"
-#include "spi-common/spi-dbus.h"
+#include "common/spi-dbus.h"
static GArray *listener_ids = NULL;
#define ITF_EVENT_OBJECT "org.freedesktop.atspi.Event.Object"
#define ITF_EVENT_WINDOW "org.freedesktop.atspi.Event.Window"
-#define ITF_EVENT_DOCUMENT "org.freedekstop.atspi.Event.Document"
+#define ITF_EVENT_DOCUMENT "org.freedesktop.atspi.Event.Document"
#define ITF_EVENT_FOCUS "org.freedesktop.atspi.Event.Focus"
/*---------------------------------------------------------------------------*/
-/* When sending events it is safe to register an accessible object if
- * one does not already exist for a given AtkObject.
- * This is because the cache update signal should then be send before
- * the event signal is sent.
- */
-static gchar *
-get_object_path (AtkObject *accessible)
+static void
+set_reply (DBusPendingCall * pending, void *user_data)
+{
+ void **replyptr = (void **) user_data;
+
+ *replyptr = dbus_pending_call_steal_reply (pending);
+}
+
+static DBusMessage *
+send_and_allow_reentry (DBusConnection * bus, DBusMessage * message)
{
- guint ref;
+ DBusPendingCall *pending;
+ DBusMessage *reply = NULL;
- return atk_dbus_ref_to_path (ref);
+ if (!dbus_connection_send_with_reply (bus, message, &pending, -1))
+ {
+ return NULL;
+ }
+ dbus_pending_call_set_notify (pending, set_reply, (void *) &reply, NULL);
+ while (!reply)
+ {
+ if (!dbus_connection_read_write_dispatch (bus, -1))
+ return NULL;
+ }
+ return reply;
}
/*---------------------------------------------------------------------------*/
+/*
+ * Functionality related to sending device events from the application.
+ *
+ * This is used for forwarding key events on to the registry daemon.
+ */
+
static gboolean
-Accessibility_DeviceEventController_notifyListenersSync(const Accessibility_DeviceEvent *key_event)
+Accessibility_DeviceEventController_NotifyListenersSync (const
+ Accessibility_DeviceEvent
+ * key_event)
{
DBusMessage *message;
DBusError error;
dbus_bool_t consumed = FALSE;
- message =
- dbus_message_new_method_call(SPI_DBUS_NAME_REGISTRY,
- SPI_DBUS_PATH_REGISTRY,
- SPI_DBUS_INTERFACE_DEC,
- "notifyListenersSync");
+ message =
+ dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY,
+ SPI_DBUS_PATH_DEC,
+ SPI_DBUS_INTERFACE_DEC,
+ "NotifyListenersSync");
- dbus_error_init(&error);
- if (spi_dbus_marshal_deviceEvent(message, key_event))
- {
- DBusMessage *reply = dbus_connection_send_with_reply_and_block(atk_adaptor_app_data->bus, message, 1000, &error);
- if (reply)
+ dbus_error_init (&error);
+ if (spi_dbus_marshal_deviceEvent (message, key_event))
{
- DBusError error;
- dbus_error_init(&error);
- dbus_message_get_args(reply, &error, DBUS_TYPE_BOOLEAN, &consumed, DBUS_TYPE_INVALID);
- dbus_message_unref(reply);
+ DBusMessage *reply =
+ send_and_allow_reentry (spi_global_app_data->bus, message);
+ if (reply)
+ {
+ DBusError error;
+ dbus_error_init (&error);
+ dbus_message_get_args (reply, &error, DBUS_TYPE_BOOLEAN, &consumed,
+ DBUS_TYPE_INVALID);
+ dbus_message_unref (reply);
+ }
}
- }
- dbus_message_unref(message);
+ dbus_message_unref (message);
return consumed;
}
static void
-spi_init_keystroke_from_atk_key_event (Accessibility_DeviceEvent *keystroke,
- AtkKeyEventStruct *event)
+spi_init_keystroke_from_atk_key_event (Accessibility_DeviceEvent * keystroke,
+ AtkKeyEventStruct * event)
{
- keystroke->id = (dbus_int32_t) event->keyval;
- keystroke->hw_code = (dbus_int16_t) event->keycode;
+ keystroke->id = (dbus_int32_t) event->keyval;
+ keystroke->hw_code = (dbus_int16_t) event->keycode;
keystroke->timestamp = (dbus_uint32_t) event->timestamp;
keystroke->modifiers = (dbus_uint16_t) (event->state & 0xFFFF);
if (event->string)
keystroke->type = 0;
break;
}
-#if 0
- g_print ("key_event type %d; val=%d code=%d modifiers=%x name=%s is_text=%d, time=%lx\n",
- (int) keystroke->type, (int) keystroke->id, (int) keystroke->hw_code,
- (int) keystroke->modifiers,
- keystroke->event_string, (int) keystroke->is_text, (unsigned long) keystroke->timestamp);
+#if 0
+ g_print
+ ("key_event type %d; val=%d code=%d modifiers=%x name=%s is_text=%d, time=%lx\n",
+ (int) keystroke->type, (int) keystroke->id, (int) keystroke->hw_code,
+ (int) keystroke->modifiers, keystroke->event_string,
+ (int) keystroke->is_text, (unsigned long) keystroke->timestamp);
#endif
}
static gint
-spi_atk_bridge_key_listener (AtkKeyEventStruct *event, gpointer data)
+spi_atk_bridge_key_listener (AtkKeyEventStruct * event, gpointer data)
{
- gboolean result;
+ gboolean result;
Accessibility_DeviceEvent key_event;
spi_init_keystroke_from_atk_key_event (&key_event, event);
- result = Accessibility_DeviceEventController_notifyListenersSync (&key_event);
+ result =
+ Accessibility_DeviceEventController_NotifyListenersSync (&key_event);
- if (key_event.event_string) g_free (key_event.event_string);
+ if (key_event.event_string)
+ g_free (key_event.event_string);
return result;
}
-
/*---------------------------------------------------------------------------*/
-/*
- * Emits an AT-SPI event.
- * AT-SPI events names are split into three parts:
- * class:major:minor
- * This is mapped onto D-Bus events as:
- * D-Bus Interface:Signal Name:Detail argument
- *
- * Marshals a basic type into the 'any_data' attribute of
- * the AT-SPI 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;
+}
-/*
- * This is a rather annoying function needed to replace
- * NULL values of strings with the empty string. Null string
- * values can be created by the atk_object_get_name or text selection
- */
static const void *
-provide_defaults(const gint type,
- const void *val)
+replace_null (const gint type,
+ const void *val)
{
switch (type)
{
}
}
-static void
-emit(AtkObject *accessible,
- const char *klass,
- const char *major,
- const char *minor,
- dbus_int32_t detail1,
- dbus_int32_t detail2,
- const char *type,
- const void *val)
+static void
+append_basic (DBusMessageIter *iter,
+ const char *type,
+ const void *val)
{
- DBusMessage *sig;
- DBusMessageIter iter, sub;
- gchar *path, *cname, *t;
+ DBusMessageIter sub;
- path = get_object_path (accessible);
+ dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, type, &sub);
- /* Tough decision here
- * We won't send events from accessible
- * objects that have not yet been added to the accessible tree.
- */
- if (path == NULL)
- return;
+ val = replace_null ((int) *type, val);
+ dbus_message_iter_append_basic(&sub, (int) *type, &val);
- if (!klass) klass = "";
- if (!major) major = "";
- if (!minor) minor = "";
+ dbus_message_iter_close_container(iter, &sub);
+}
- /*
- * This is very annoying, but as '-' isn't a legal signal
- * name in D-Bus (Why not??!?) The names need converting
- * on this side, and again on the client side.
- */
- cname = g_strdup(major);
- while ((t = strchr(cname, '-')) != NULL) *t = '_';
+static void
+append_rect (DBusMessageIter *iter,
+ const char *type,
+ const void *val)
+{
+ DBusMessageIter variant, sub;
+ const AtkRectangle *rect = (const AtkRectangle *) val;
- sig = dbus_message_new_signal(path, klass, cname);
- g_free(cname);
- g_free(path);
+ dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, type, &variant);
- dbus_message_iter_init_append(sig, &iter);
+ dbus_message_iter_open_container (&variant, DBUS_TYPE_STRUCT, NULL, &sub);
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &minor);
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &detail1);
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &detail2);
+ dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &(rect->x));
+ dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &(rect->y));
+ dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &(rect->width));
+ dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &(rect->height));
- dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT, type, &sub);
- /*
- * I need to convert the string signature to an integer type signature.
- * DBUS_TYPE_INT32 is defined as 'i' whereas the string is "i".
- * I should just be able to cast the first character of the string to an
- * integer.
- */
- val = provide_defaults((int) *type, val);
- dbus_message_iter_append_basic(&sub, (int) *type, &val);
- dbus_message_iter_close_container(&iter, &sub);
+ dbus_message_iter_close_container (&variant, &sub);
- dbus_connection_send(atk_adaptor_app_data->bus, sig, NULL);
- dbus_message_unref(sig);
+ dbus_message_iter_close_container(iter, &variant);
}
-/*---------------------------------------------------------------------------*/
+static void
+append_object (DBusMessageIter *iter,
+ const char *type,
+ const void *val)
+{
+ spi_object_append_v_reference (iter, ATK_OBJECT (val));
+}
/*
- * Emits an AT-SPI event, marshalling a BoundingBox structure into the
- * 'any_data' variant of the event.
+ * Emits an AT-SPI event.
+ * AT-SPI events names are split into three parts:
+ * class:major:minor
+ * This is mapped onto D-Bus events as:
+ * D-Bus Interface:Signal Name:Detail argument
+ *
+ * Marshals a basic type into the 'any_data' attribute of
+ * the AT-SPI event.
*/
-static void
-emit_rect(AtkObject *accessible,
- const char *klass,
- const char *major,
- const char *minor,
- AtkRectangle *rect)
+static void
+emit_event (AtkObject *obj,
+ const char *klass,
+ const char *major,
+ const char *minor,
+ dbus_int32_t detail1,
+ dbus_int32_t detail2,
+ const char *type,
+ const void *val,
+ void (*append_variant) (DBusMessageIter *, const char *, const void *))
{
- DBusMessage *sig;
- DBusMessageIter iter, variant, sub;
- gchar *path, *cname, *t;
- dbus_int32_t dummy = 0;
-
- path = get_object_path (accessible);
-
- /* Tough decision here
- * We won't send events from accessible
- * objects that have not yet been added to the accessible tree.
- */
- if (path == NULL)
- return;
+ DBusConnection *bus = spi_global_app_data->bus;
+ const char *path = spi_register_object_to_path (spi_global_register,
+ G_OBJECT (obj));
+ gchar *cname, *t;
+ DBusMessage *sig;
+ DBusMessageIter iter, iter_struct;
+
if (!klass) klass = "";
if (!major) major = "";
if (!minor) minor = "";
+ if (!type) type = "u";
/*
* This is very annoying, but as '-' isn't a legal signal
*/
cname = g_strdup(major);
while ((t = strchr(cname, '-')) != NULL) *t = '_';
-
sig = dbus_message_new_signal(path, klass, cname);
- g_free(path);
g_free(cname);
- dbus_message_iter_init_append (sig, &iter);
+ dbus_message_iter_init_append(sig, &iter);
+
+ spi_object_append_reference (&iter, spi_global_app_data->root);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &minor);
- dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &dummy);
- dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &dummy);
+ dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &detail1);
+ dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &detail2);
- dbus_message_iter_open_container (&iter, DBUS_TYPE_VARIANT, "(iiii)", &variant);
- dbus_message_iter_open_container (&variant, DBUS_TYPE_STRUCT, NULL, &sub);
- dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &(rect->x));
- dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &(rect->y));
- dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &(rect->width));
- dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &(rect->height));
- dbus_message_iter_close_container (&variant, &sub);
- dbus_message_iter_close_container (&iter, &variant);
+ append_variant (&iter, type, val);
- dbus_connection_send(atk_adaptor_app_data->bus, sig, NULL);
+ dbus_connection_send(bus, sig, NULL);
+ dbus_message_unref(sig);
}
/*---------------------------------------------------------------------------*/
* as the AT-SPI event, 'focus:'
*/
static void
-focus_tracker (AtkObject *accessible)
+focus_tracker (AtkObject * accessible)
{
- emit(accessible, ITF_EVENT_FOCUS, "focus", "", 0, 0, DBUS_TYPE_INT32_AS_STRING, 0);
+ emit_event (accessible, ITF_EVENT_FOCUS, "focus", "", 0, 0,
+ DBUS_TYPE_INT32_AS_STRING, 0, append_basic);
}
/*---------------------------------------------------------------------------*/
* The property-name is part of the ATK property-change signal.
*/
static gboolean
-property_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
+property_event_listener (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values, gpointer data)
{
AtkObject *accessible;
AtkPropertyValues *values;
const gchar *pname = NULL;
AtkObject *otemp;
- const gchar *stemp;
+ const gchar *s1, s2;
gint i;
-
+
accessible = g_value_get_object (¶m_values[0]);
- values = (AtkPropertyValues*) g_value_get_pointer (¶m_values[1]);
+ values = (AtkPropertyValues *) g_value_get_pointer (¶m_values[1]);
pname = values[0].property_name;
/* TODO Could improve this control statement by matching
* on only the end of the signal names,
*/
+ if (strcmp (pname, "accessible-name") == 0)
+ {
+ s1 = atk_object_get_name (accessible);
+ if (s1 != NULL)
+ emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
+ DBUS_TYPE_STRING_AS_STRING, s1, append_basic);
+ }
+ if (strcmp (pname, "accessible-description") == 0)
+ {
+ s1 = atk_object_get_description (accessible);
+ if (s1 != NULL)
+ emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
+ DBUS_TYPE_STRING_AS_STRING, s1, append_basic);
+ }
+ if (strcmp (pname, "accessible-parent") == 0)
+ {
+ otemp = atk_object_get_parent (accessible);
+ if (otemp != NULL)
+ emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
+ "(so)", otemp, append_object);
+ }
if (strcmp (pname, "accessible-table-summary") == 0)
{
- otemp = atk_table_get_summary(ATK_TABLE (accessible));
- stemp = get_object_path (otemp);
- emit(accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0, DBUS_TYPE_OBJECT_PATH_AS_STRING, stemp);
+ otemp = atk_table_get_summary (ATK_TABLE (accessible));
+ if (otemp != NULL)
+ emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
+ "(so)", otemp, append_object);
}
else if (strcmp (pname, "accessible-table-column-header") == 0)
{
i = g_value_get_int (&(values->new_value));
- otemp = atk_table_get_column_header(ATK_TABLE (accessible), i);
- stemp = get_object_path (otemp);
- emit(accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0, DBUS_TYPE_OBJECT_PATH_AS_STRING, stemp);
+ otemp = atk_table_get_column_header (ATK_TABLE (accessible), i);
+ if (otemp != NULL)
+ emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
+ "(so)", otemp, append_object);
}
else if (strcmp (pname, "accessible-table-row-header") == 0)
{
i = g_value_get_int (&(values->new_value));
- otemp = atk_table_get_row_header(ATK_TABLE (accessible), i);
- stemp = get_object_path (otemp);
- emit(accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0, DBUS_TYPE_OBJECT_PATH_AS_STRING, stemp);
+ otemp = atk_table_get_row_header (ATK_TABLE (accessible), i);
+ if (otemp != NULL)
+ emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
+ "(so)", otemp, append_object);
}
else if (strcmp (pname, "accessible-table-row-description") == 0)
{
i = g_value_get_int (&(values->new_value));
- stemp = atk_table_get_row_description(ATK_TABLE (accessible), i);
- emit(accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0, DBUS_TYPE_STRING_AS_STRING, stemp);
+ s1 = atk_table_get_row_description (ATK_TABLE (accessible), i);
+ emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
+ DBUS_TYPE_STRING_AS_STRING, s1, append_basic);
}
else if (strcmp (pname, "accessible-table-column-description") == 0)
{
i = g_value_get_int (&(values->new_value));
- stemp = atk_table_get_column_description(ATK_TABLE (accessible), i);
- emit(accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0, DBUS_TYPE_STRING_AS_STRING, stemp);
+ s1 = atk_table_get_column_description (ATK_TABLE (accessible), i);
+ emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
+ DBUS_TYPE_STRING_AS_STRING, s1, append_basic);
}
else if (strcmp (pname, "accessible-table-caption-object") == 0)
{
- otemp = atk_table_get_caption(ATK_TABLE(accessible));
- stemp = atk_object_get_name(otemp);
- emit(accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0, DBUS_TYPE_STRING_AS_STRING, stemp);
+ otemp = atk_table_get_caption (ATK_TABLE (accessible));
+ emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
+ "(so)", otemp, append_object);
}
else
{
- emit(accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0, DBUS_TYPE_INT32_AS_STRING, 0);
+ emit_event (accessible, ITF_EVENT_OBJECT, PCHANGE, pname, 0, 0,
+ DBUS_TYPE_INT32_AS_STRING, 0, append_basic);
}
return TRUE;
}
* the param-name is part of the ATK state-change signal.
*/
static gboolean
-state_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
+state_event_listener (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values, gpointer data)
{
AtkObject *accessible;
gchar *pname;
guint detail1;
- accessible = ATK_OBJECT(g_value_get_object (¶m_values[0]));
+ accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
pname = g_strdup (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(accessible, ITF_EVENT_OBJECT, STATE_CHANGED, pname, detail1, 0, DBUS_TYPE_INT32_AS_STRING, 0);
+ emit_event (accessible, ITF_EVENT_OBJECT, STATE_CHANGED, pname, detail1, 0,
+ DBUS_TYPE_INT32_AS_STRING, 0, append_basic);
g_free (pname);
return TRUE;
}
* window:deactivate -> window:deactivate
*/
static gboolean
-window_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
+window_event_listener (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values, gpointer data)
{
AtkObject *accessible;
GSignalQuery signal_query;
const gchar *name, *s;
-
+
g_signal_query (signal_hint->signal_id, &signal_query);
name = signal_query.signal_name;
- accessible = ATK_OBJECT(g_value_get_object(¶m_values[0]));
+ accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
s = atk_object_get_name (accessible);
- emit(accessible, ITF_EVENT_WINDOW, name, "", 0, 0, DBUS_TYPE_STRING_AS_STRING, s);
+ emit_event (accessible, ITF_EVENT_WINDOW, name, "", 0, 0,
+ DBUS_TYPE_STRING_AS_STRING, s, append_basic);
return TRUE;
}
* Gtk:AtkDocument:reload -> document:reload
*/
static gboolean
-document_event_listener (GSignalInvocationHint *signal_hint,
+document_event_listener (GSignalInvocationHint * signal_hint,
guint n_param_values,
- const GValue *param_values,
- gpointer data)
+ const GValue * param_values, gpointer data)
{
AtkObject *accessible;
GSignalQuery signal_query;
g_signal_query (signal_hint->signal_id, &signal_query);
name = signal_query.signal_name;
- accessible = ATK_OBJECT(g_value_get_object(¶m_values[0]));
+ accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
s = atk_object_get_name (accessible);
- emit(accessible, ITF_EVENT_DOCUMENT, name, "", 0, 0, DBUS_TYPE_STRING_AS_STRING, s);
+ emit_event (accessible, ITF_EVENT_DOCUMENT, name, "", 0, 0,
+ DBUS_TYPE_STRING_AS_STRING, s, append_basic);
return TRUE;
}
* this to an AT-SPI event - "object:bounds-changed".
*/
static gboolean
-bounds_event_listener (GSignalInvocationHint *signal_hint,
+bounds_event_listener (GSignalInvocationHint * signal_hint,
guint n_param_values,
- const GValue *param_values,
- gpointer data)
+ const GValue * param_values, gpointer data)
{
AtkObject *accessible;
AtkRectangle *atk_rect;
g_signal_query (signal_hint->signal_id, &signal_query);
name = signal_query.signal_name;
- accessible = ATK_OBJECT(g_value_get_object(¶m_values[0]));
+ accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
if (G_VALUE_HOLDS_BOXED (param_values + 1))
+ {
atk_rect = g_value_get_boxed (param_values + 1);
- emit_rect(accessible, ITF_EVENT_OBJECT, name, "", atk_rect);
+ emit_event (accessible, ITF_EVENT_OBJECT, name, "", 0, 0,
+ "(iiii)", atk_rect, append_rect);
+ }
return TRUE;
}
*
*/
static gboolean
-active_descendant_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
+active_descendant_event_listener (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values, gpointer data)
{
AtkObject *accessible;
AtkObject *child;
g_signal_query (signal_hint->signal_id, &signal_query);
name = signal_query.signal_name;
- accessible = ATK_OBJECT(g_value_get_object(¶m_values[0]));
- child = ATK_OBJECT(g_value_get_pointer (¶m_values[1]));
+ 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);
- s = get_object_path (child);
- emit(accessible, ITF_EVENT_OBJECT, name, "", detail1, 0, DBUS_TYPE_OBJECT_PATH_AS_STRING, s);
- g_free(s);
+ emit_event (accessible, ITF_EVENT_OBJECT, name, "", detail1, 0,
+ "(so)", child, append_object);
+ g_free (s);
return TRUE;
}
*
*/
static gboolean
-link_selected_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
+link_selected_event_listener (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values, gpointer data)
{
AtkObject *accessible;
GSignalQuery signal_query;
g_signal_query (signal_hint->signal_id, &signal_query);
name = signal_query.signal_name;
- accessible = ATK_OBJECT(g_value_get_object(¶m_values[0]));
+ 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]);
+ detail1 = g_value_get_int (¶m_values[1]);
- emit(accessible, ITF_EVENT_OBJECT, name, minor, detail1, 0, DBUS_TYPE_INT32_AS_STRING, 0);
+ emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, 0,
+ DBUS_TYPE_INT32_AS_STRING, 0, append_basic);
return TRUE;
}
*
*/
static gboolean
-text_changed_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
+text_changed_event_listener (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values, gpointer data)
{
AtkObject *accessible;
GSignalQuery signal_query;
g_signal_query (signal_hint->signal_id, &signal_query);
name = signal_query.signal_name;
- accessible = ATK_OBJECT(g_value_get_object(¶m_values[0]));
+ 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]);
+ 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]);
+ detail2 = g_value_get_int (¶m_values[2]);
- selected = atk_text_get_text (ATK_TEXT (accessible), detail1, detail1+detail2);
+ selected =
+ atk_text_get_text (ATK_TEXT (accessible), detail1, detail1 + detail2);
- emit(accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2, DBUS_TYPE_STRING_AS_STRING, selected);
+ emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
+ DBUS_TYPE_STRING_AS_STRING, selected, append_basic);
return TRUE;
}
*
*/
static gboolean
-text_selection_changed_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
+text_selection_changed_event_listener (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values,
+ gpointer data)
{
AtkObject *accessible;
GSignalQuery signal_query;
g_signal_query (signal_hint->signal_id, &signal_query);
name = signal_query.signal_name;
- accessible = ATK_OBJECT(g_value_get_object(¶m_values[0]));
+ 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]);
+ 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]);
+ detail2 = g_value_get_int (¶m_values[2]);
- emit(accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2, DBUS_TYPE_STRING_AS_STRING, "");
+ emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
+ DBUS_TYPE_STRING_AS_STRING, "", append_basic);
return TRUE;
}
* any_data is NULL.
*/
static gboolean
-generic_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
+generic_event_listener (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values, gpointer data)
{
AtkObject *accessible;
GSignalQuery signal_query;
const gchar *name;
+ int detail1 = 0, detail2 = 0;
g_signal_query (signal_hint->signal_id, &signal_query);
name = signal_query.signal_name;
- accessible = ATK_OBJECT(g_value_get_object(¶m_values[0]));
- emit(accessible, ITF_EVENT_OBJECT, name, "", 0, 0, DBUS_TYPE_INT32_AS_STRING, 0);
+ accessible = ATK_OBJECT (g_value_get_object (¶m_values[0]));
+
+ if (n_param_values > 1 && G_VALUE_TYPE (¶m_values[1]) == G_TYPE_INT)
+ detail1 = g_value_get_int (¶m_values[1]);
+
+ if (n_param_values > 2 && G_VALUE_TYPE (¶m_values[2]) == G_TYPE_INT)
+ detail2 = g_value_get_int (¶m_values[2]);
+
+ emit_event (accessible, ITF_EVENT_OBJECT, name, "", detail1, detail2,
+ DBUS_TYPE_INT32_AS_STRING, 0, append_basic);
return TRUE;
}
* Kludge to make sure the Atk interface types are registered, otherwise
* the AtkText signal handlers below won't get registered
*/
- GObject *ao = g_object_new (ATK_TYPE_OBJECT, NULL);
+ GObject *ao = g_object_new (ATK_TYPE_OBJECT, NULL);
AtkObject *bo = atk_no_op_object_new (ao);
g_object_unref (G_OBJECT (bo));
atk_bridge_focus_tracker_id = atk_add_focus_tracker (focus_tracker);
- 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");
- 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 (state_event_listener, "Gtk:AtkObject:state-change");
- add_signal_listener (active_descendant_event_listener, "Gtk:AtkObject:active-descendant-changed");
- add_signal_listener (bounds_event_listener, "Gtk:AtkComponent:bounds-changed");
- add_signal_listener (text_selection_changed_event_listener, "Gtk:AtkText:text-selection-changed");
- add_signal_listener (text_changed_event_listener, "Gtk:AtkText:text-changed");
- add_signal_listener (link_selected_event_listener, "Gtk:AtkHypertext:link-selected");
- add_signal_listener (generic_event_listener, "Gtk:AtkObject:visible-data-changed");
- add_signal_listener (generic_event_listener, "Gtk:AtkSelection:selection-changed");
- add_signal_listener (generic_event_listener, "Gtk:AtkText:text-caret-moved");
- add_signal_listener (generic_event_listener, "Gtk:AtkTable:row-inserted");
- add_signal_listener (generic_event_listener, "Gtk:AtkTable:row-reordered");
- add_signal_listener (generic_event_listener, "Gtk:AtkTable:row-deleted");
- add_signal_listener (generic_event_listener, "Gtk:AtkTable:column-inserted");
- 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");
+ 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");
+ 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");
+ /* TODO Fake this event on the client side */
+ add_signal_listener (state_event_listener, "Gtk:AtkObject:state-change");
+ /* TODO */
+ add_signal_listener (active_descendant_event_listener,
+ "Gtk:AtkObject:active-descendant-changed");
+ add_signal_listener (bounds_event_listener,
+ "Gtk:AtkComponent:bounds-changed");
+ add_signal_listener (text_selection_changed_event_listener,
+ "Gtk:AtkText:text-selection-changed");
+ add_signal_listener (text_changed_event_listener,
+ "Gtk:AtkText:text-changed");
+ add_signal_listener (link_selected_event_listener,
+ "Gtk:AtkHypertext:link-selected");
+ add_signal_listener (generic_event_listener,
+ "Gtk:AtkObject:visible-data-changed");
+ add_signal_listener (generic_event_listener,
+ "Gtk:AtkSelection:selection-changed");
+ add_signal_listener (generic_event_listener,
+ "Gtk:AtkText:text-attributes-changed");
+ add_signal_listener (generic_event_listener,
+ "Gtk:AtkText:text-caret-moved");
+ add_signal_listener (generic_event_listener, "Gtk:AtkTable:row-inserted");
+ add_signal_listener (generic_event_listener, "Gtk:AtkTable:row-reordered");
+ add_signal_listener (generic_event_listener, "Gtk:AtkTable:row-deleted");
+ add_signal_listener (generic_event_listener,
+ "Gtk:AtkTable:column-inserted");
+ 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");
/*
* May add the following listeners to implement preemptive key listening for GTK+
* atk_add_global_event_listener (spi_atk_bridge_widgetkey_listener, "Gtk:GtkWidget:key-press-event");
* atk_add_global_event_listener (spi_atk_bridge_widgetkey_listener, "Gtk:GtkWidget:key-release-event");
*/
- atk_bridge_key_event_listener_id = atk_add_key_event_listener (spi_atk_bridge_key_listener, NULL);
+ atk_bridge_key_event_listener_id =
+ atk_add_key_event_listener (spi_atk_bridge_key_listener, NULL);
}
/*---------------------------------------------------------------------------*/
listener_ids = NULL;
if (atk_bridge_focus_tracker_id)
- atk_remove_focus_tracker (atk_bridge_focus_tracker_id);
-
+ atk_remove_focus_tracker (atk_bridge_focus_tracker_id);
+
for (i = 0; ids && i < ids->len; i++)
{
- atk_remove_global_event_listener (g_array_index (ids, guint, i));
+ atk_remove_global_event_listener (g_array_index (ids, guint, i));
}
-
+
if (atk_bridge_key_event_listener_id)
- atk_remove_key_event_listener (atk_bridge_key_event_listener_id);
+ atk_remove_key_event_listener (atk_bridge_key_event_listener_id);
}
/*---------------------------------------------------------------------------*/
AtkObject *child;
AtkStateSet *stateset;
const gchar *name;
-
+
child = atk_object_ref_accessible_child (root, i);
stateset = atk_object_ref_state_set (child);
-
+
name = atk_object_get_name (child);
if (atk_state_set_contains_state (stateset, ATK_STATE_ACTIVE))
{
- emit(child, ITF_EVENT_WINDOW, "deactivate", NULL, 0, 0, DBUS_TYPE_STRING_AS_STRING, name);
+ emit_event (child, ITF_EVENT_WINDOW, "deactivate", NULL, 0, 0,
+ DBUS_TYPE_STRING_AS_STRING, name, append_basic);
}
g_object_unref (stateset);
- emit(child, ITF_EVENT_WINDOW, "destroy", NULL, 0, 0, DBUS_TYPE_STRING_AS_STRING, name);
+ emit_event (child, ITF_EVENT_WINDOW, "destroy", NULL, 0, 0,
+ DBUS_TYPE_STRING_AS_STRING, name, append_basic);
g_object_unref (child);
}
}