-}
-
-void
-gnome_accessibility_module_init (void)
-{
- atk_bridge_init (NULL, NULL);
-
- if (g_getenv ("AT_BRIDGE_SHUTDOWN"))
- {
- g_print("Atk Accessibility bridge initialized\n");
- }
-}
-
-void
-gnome_accessibility_module_shutdown (void)
-{
- int i;
- GArray *ids = listener_ids;
-
- if (!atk_bridge_initialized)
- {
- return;
- }
- during_init_shutdown = TRUE;
- atk_bridge_initialized = FALSE;
-
- if (g_getenv ("AT_BRIDGE_SHUTDOWN"))
- {
- g_print("Atk Accessibility bridge shutdown\n");
- }
-
- listener_ids = NULL;
- if (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));
- }
-
- if (atk_bridge_key_event_listener_id)
- atk_remove_key_event_listener (atk_bridge_key_event_listener_id);
-
- deregister_application (this_app);
- this_app = NULL;
-
- misc = NULL;
-}
-
-static void emit(AtkObject *object, const char *name, const char *detail, dbus_int32_t detail1, dbus_int32_t detail2, int type, const void *val)
-{
- DBusMessage *sig;
- char *path = spi_dbus_get_path(object);
- DBusMessageIter iter, sub;
- const char *type_as_string = NULL;
- dbus_int32_t dummy = 0;
-
- spi_dbus_update_cache(&this_app->droute);
- if (type == DBUS_TYPE_OBJECT_PATH)
- {
- type_as_string = "o";
- if (!val) val = "";
- }
- else if (type == DBUS_TYPE_STRING) type_as_string = "s";
- else if (type == DBUS_TYPE_INT32) type_as_string = "i";
- else if (type == DBUS_TYPE_UINT32) type_as_string = "u";
- else if (type == DBUS_TYPE_INVALID)
- {
- type = DBUS_TYPE_UINT32;
- type_as_string = "u";
- if (!val) val = &dummy;
- }
- else
- {
- g_warning("Unknown type %d in property change signal", type);
- }
- sig = dbus_message_new_signal(path, "org.freedesktop.atspi.Accessible", name);
- dbus_message_iter_init_append(sig, &iter);
- if (!detail) detail = "";
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &detail);
- 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, type_as_string, &sub);
- dbus_message_iter_append_basic(&sub, type, &val);
- dbus_message_iter_close_container(&iter, &sub);
-printf("emit: %s %s\n", name, detail);
- dbus_connection_send(this_app->droute.bus, sig, NULL);
- g_free(path);
- dbus_message_unref(sig);
-}
-
-static void
-spi_atk_bridge_focus_tracker (AtkObject *object)
-{
- emit(object, "focus", NULL, 0, 0, DBUS_TYPE_INVALID, NULL);
-}
-
-static void emit_rect(AtkObject *object, const char *name, const char *detail, AtkRectangle *rect)
-{
- DBusMessage *sig;
- char *path = spi_dbus_get_path(object);
- DBusMessageIter iter, iter_variant, sub;
- dbus_uint32_t x, y, width, height;
- dbus_int32_t dummy = 0;
-
- spi_dbus_update_cache(&this_app->droute);
- x = rect->x;
- y = rect->y;
- width = rect->width;
- height = rect->height;
- sig = dbus_message_new_signal(path, "org.freedesktop.atspi.Accessible", name);
- if (!detail) detail = "";
- if (sig)
- {
- dbus_message_iter_init_append (sig, &iter);
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &detail);
- dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &dummy);
- dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &dummy);
- if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_VARIANT, "(iiii)", &iter_variant))
- goto oom;
- if (!dbus_message_iter_open_container (&iter_variant, DBUS_TYPE_STRUCT, NULL, &sub))
- goto oom;
- dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &x);
- dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &y);
- dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &width);
- dbus_message_iter_append_basic (&sub, DBUS_TYPE_INT32, &height);
- if (!dbus_message_iter_close_container (&iter_variant, &sub))
- goto oom;
- if (!dbus_message_iter_close_container (&iter, &iter_variant))
- goto oom;
- }
- dbus_connection_send(this_app->droute.bus, sig, NULL);
-oom:
- g_free(path);
- dbus_message_unref(sig);
-}
-
-static const char *PropertyChange = "object_property_change";
-
-static gboolean
-spi_atk_bridge_property_event_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
-{
- AtkPropertyValues *values;
- AtkObject *obj;
- const gchar *prop_name;
- const gchar *sp = NULL;
- AtkObject *ao;
- char *s_ao = NULL;
- gint i;
- const gchar *name = NULL;
-
-#ifdef SPI_BRIDGE_DEBUG
- GSignalQuery signal_query;
- const gchar *signame;
- const gchar *s, *s2;
-
- g_signal_query (signal_hint->signal_id, &signal_query);
- signame = signal_query.signal_name;
-
- s2 = g_type_name (G_OBJECT_TYPE (g_value_get_object (param_values + 0)));
- s = atk_object_get_name (ATK_OBJECT (g_value_get_object (param_values + 0)));
- values = (AtkPropertyValues*) g_value_get_pointer (param_values + 1);
- DBG (2, g_message ("Received (property) signal %s:%s:%s from object %s (gail %s)\n",
- g_type_name (signal_query.itype), signame, values->property_name, s, s2));
-