[at-spi2-atk] Change the keystroke delivery methid re-entrancy from looping over the bus to entering a g_main_loop
- From: Mark Doffman <markdoffman src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [at-spi2-atk] Change the keystroke delivery methid re-entrancy from looping over the bus to entering a g_main_loop
- Date: Tue, 2 Feb 2010 16:59:10 +0000 (UTC)
commit 38b14df983445e90257e6c5bfae8baf18f31da51
Author: Mark Doffman <mark doffman codethink co uk>
Date: Tue Feb 2 16:58:56 2010 -0800
Change the keystroke delivery methid re-entrancy from
looping over the bus to entering a g_main_loop.
Modification to the 'Embed' method so that the address of
the desktop object (Application parent) is stored.
atk-adaptor/accessible-cache.c | 7 ++++++-
atk-adaptor/bridge.c | 32 +++++++++++++++++++++++++++++---
atk-adaptor/bridge.h | 2 ++
atk-adaptor/event.c | 29 +++++++++++++++++------------
atk-adaptor/object.c | 4 ++--
5 files changed, 56 insertions(+), 18 deletions(-)
---
diff --git a/atk-adaptor/accessible-cache.c b/atk-adaptor/accessible-cache.c
index c449657..813d03f 100644
--- a/atk-adaptor/accessible-cache.c
+++ b/atk-adaptor/accessible-cache.c
@@ -155,6 +155,11 @@ remove_object (GObject * source, GObject * gobj, gpointer data)
if (spi_cache_in (cache, gobj))
{
+#ifdef SPI_ATK_DEBUG
+ g_debug ("CACHE REM - %s - %d - %s\n", atk_object_get_name (ATK_OBJECT (gobj)),
+ atk_object_get_role (ATK_OBJECT (gobj)),
+ spi_register_object_to_path (spi_global_register, gobj));
+#endif
g_signal_emit (cache, cache_signals [OBJECT_REMOVED], 0, gobj);
g_hash_table_remove (cache->objects, gobj);
}
@@ -168,7 +173,7 @@ add_object (SpiCache * cache, GObject * gobj)
g_hash_table_insert (cache->objects, gobj, NULL);
#ifdef SPI_ATK_DEBUG
- g_debug ("CACHE - %s - %d - %s", atk_object_get_name (ATK_OBJECT (gobj)),
+ g_debug ("CACHE ADD - %s - %d - %s\n", atk_object_get_name (ATK_OBJECT (gobj)),
atk_object_get_role (ATK_OBJECT (gobj)),
spi_register_object_to_path (spi_global_register, gobj));
#endif
diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c
index dfa537c..e29314c 100644
--- a/atk-adaptor/bridge.c
+++ b/atk-adaptor/bridge.c
@@ -168,7 +168,7 @@ spi_atk_bridge_get_bus (void)
static void
register_application (SpiBridge * app)
{
- DBusMessage *message;
+ DBusMessage *message, *reply;
DBusMessageIter iter;
DBusError error;
@@ -178,13 +178,39 @@ register_application (SpiBridge * app)
SPI_DBUS_PATH_ROOT,
SPI_DBUS_INTERFACE_SOCKET,
"Embed");
- dbus_message_set_no_reply (message, TRUE);
dbus_message_iter_init_append (message, &iter);
spi_object_append_reference (&iter, app->root);
- dbus_connection_send (app->bus, message, NULL);
+
+ reply = dbus_connection_send_with_reply_and_block (app->bus, message, -1, &error);
+
if (message)
dbus_message_unref (message);
+
+ if (reply)
+ {
+ DBusMessageIter iter, iter_struct;
+ gchar *app_name, *obj_path;
+
+ dbus_message_iter_init (reply, &iter);
+ dbus_message_iter_recurse (&iter, &iter_struct);
+ if (!(dbus_message_iter_get_arg_type (&iter_struct) == DBUS_TYPE_STRING))
+ g_error ("AT-SPI: Could not obtain desktop path or name\n");
+ dbus_message_iter_get_basic (&iter_struct, &app_name);
+ if (!dbus_message_iter_next (&iter_struct))
+ g_error ("AT-SPI: Could not obtain desktop name");
+ if (!(dbus_message_iter_get_arg_type (&iter_struct) == DBUS_TYPE_OBJECT_PATH))
+ g_error ("AT-SPI: Could not obtain desktop path");
+ dbus_message_iter_get_basic (&iter_struct, &obj_path);
+
+ app->desktop_name = g_strdup (app_name);
+ app->desktop_path = g_strdup (obj_path);
+ }
+ else
+ {
+ g_error ("AT-SPI: Could not embed inside desktop: %s\n", error.message);
+ }
+
}
/*---------------------------------------------------------------------------*/
diff --git a/atk-adaptor/bridge.h b/atk-adaptor/bridge.h
index 2a95fcd..81abb92 100644
--- a/atk-adaptor/bridge.h
+++ b/atk-adaptor/bridge.h
@@ -47,6 +47,8 @@ struct _SpiBridge
SpiCache *cache;
SpiLeasing *leasing;
*/
+ gchar *desktop_name;
+ gchar *desktop_path;
};
extern SpiBridge *spi_global_app_data;
diff --git a/atk-adaptor/event.c b/atk-adaptor/event.c
index 3ba1ba8..0a523af 100644
--- a/atk-adaptor/event.c
+++ b/atk-adaptor/event.c
@@ -46,31 +46,36 @@ static gint atk_bridge_focus_tracker_id;
/*---------------------------------------------------------------------------*/
+typedef struct _SpiReentrantCallClosure
+{
+ GMainLoop *loop;
+ DBusMessage *reply;
+} SpiReentrantCallClosure;
+
static void
set_reply (DBusPendingCall * pending, void *user_data)
{
- void **replyptr = (void **) user_data;
+ SpiReentrantCallClosure* closure = (SpiReentrantCallClosure *) user_data;
- *replyptr = dbus_pending_call_steal_reply (pending);
+ closure->reply = dbus_pending_call_steal_reply (pending);
+ g_main_loop_quit (closure->loop);
}
static DBusMessage *
send_and_allow_reentry (DBusConnection * bus, DBusMessage * message)
{
DBusPendingCall *pending;
- DBusMessage *reply = NULL;
+ SpiReentrantCallClosure closure;
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;
+ dbus_pending_call_set_notify (pending, set_reply, (void *) &closure, NULL);
+ closure.loop = g_main_loop_new (NULL, FALSE);
+
+ g_main_loop_run (closure.loop);
+
+ g_main_loop_unref (closure.loop);
+ return closure.reply;
}
/*---------------------------------------------------------------------------*/
diff --git a/atk-adaptor/object.c b/atk-adaptor/object.c
index f1a47f5..beeada4 100644
--- a/atk-adaptor/object.c
+++ b/atk-adaptor/object.c
@@ -112,8 +112,8 @@ void
spi_object_append_desktop_reference (DBusMessageIter * iter)
{
DBusMessageIter iter_struct;
- const char *name = SPI_DBUS_NAME_REGISTRY;
- const char *path = SPI_DBUS_PATH_ROOT;
+ const char *name = spi_global_app_data->desktop_name;
+ const char *path = spi_global_app_data->desktop_path;
dbus_message_iter_open_container (iter, DBUS_TYPE_STRUCT, NULL,
&iter_struct);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]