From 683739dea15d7c02c217a404d8c5d9d7af076a57 Mon Sep 17 00:00:00 2001 From: Mike Gorse Date: Sun, 16 Jun 2013 14:04:01 -0500 Subject: [PATCH] Use atspi_is_initialized to decide whether to expose p2p connection Previously, direct D-Bus connections were not exposed if AT_SPI_CLIENT was set in the environment, since they are causing deadlock if the application and the AT are in the same process. However, AT_SPI_CLIENT was only being set by pyatspi, meaning that libatspi consumers not using pyatspi (Javascript embedded in gnome-shell that uses the libatspi introspection bindings directly, for instance) would still have problems when attempting to inspect their own accessibles. Also removed the code in event.c to disable main loop context switching when AT_SPI_CLIENT was set. Modifying it to also check atspi_is_initialized would cause deadlock with gnome-shell when Orca is running. Hopefully that code is not needed anymore. --- atk-adaptor/adaptors/application-adaptor.c | 2 +- atk-adaptor/event.c | 9 +++------ configure.ac | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/atk-adaptor/adaptors/application-adaptor.c b/atk-adaptor/adaptors/application-adaptor.c index 260a4d7..b74e5be 100644 --- a/atk-adaptor/adaptors/application-adaptor.c +++ b/atk-adaptor/adaptors/application-adaptor.c @@ -110,7 +110,7 @@ DBusMessage *reply; reply = dbus_message_new_method_return(msg); if (reply) { - const char *retval = (g_getenv ("AT_SPI_CLIENT") ? + const char *retval = (atspi_is_initialized () ? "": spi_global_app_data->app_bus_addr); if (!retval) diff --git a/atk-adaptor/event.c b/atk-adaptor/event.c index 440d436..dc4e3ec 100644 --- a/atk-adaptor/event.c +++ b/atk-adaptor/event.c @@ -98,15 +98,12 @@ 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.bus = bus; - closure.loop = g_main_loop_new (main_context, FALSE); + closure.loop = g_main_loop_new (spi_global_app_data->main_context, FALSE); closure.reply = NULL; - switch_main_context (main_context); + switch_main_context (spi_global_app_data->main_context); if (!dbus_connection_send_with_reply (bus, message, &pending, 9000) || !pending) { @@ -116,7 +113,7 @@ send_and_allow_reentry (DBusConnection * bus, DBusMessage * message) 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, main_context); + 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) diff --git a/configure.ac b/configure.ac index fd338b4..a42688b 100644 --- a/configure.ac +++ b/configure.ac @@ -55,7 +55,7 @@ PKG_CHECK_MODULES(ATK, [atk >= 2.7.90]) AC_SUBST(ATK_LIBS) AC_SUBST(ATK_CFLAGS) -PKG_CHECK_MODULES(ATSPI, [atspi-2 >= 2.7.5]) +PKG_CHECK_MODULES(ATSPI, [atspi-2 >= 2.9.3]) AC_SUBST(ATSPI_LIBS) AC_SUBST(ATSPI_CFLAGS) -- 2.7.4