From b81654c1ff0e2602963d8cdec23f910458486801 Mon Sep 17 00:00:00 2001 From: Mike Gorse Date: Fri, 6 Nov 2009 14:42:25 -0500 Subject: [PATCH] API changes for out--of-process accessibles, and support ParentOf Modified DBus api to return bus names along with object paths to support out-of-process children. This does not yet support AtkPlug and AtkSocket, since the relevant atk changes have not yet been committed. Also, support the new ParentOf relationship. --- atk-adaptor/accessible-adaptor.c | 6 +- atk-adaptor/accessible-marshaller.c | 68 ++++++++++++------- atk-adaptor/accessible-marshaller.h | 6 ++ atk-adaptor/relation-adaptor.c | 1 + atk-adaptor/tree-adaptor.c | 6 +- common/generated-types.h | 129 +++++++++--------------------------- 6 files changed, 88 insertions(+), 128 deletions(-) diff --git a/atk-adaptor/accessible-adaptor.c b/atk-adaptor/accessible-adaptor.c index cf92b0f..8c115f1 100644 --- a/atk-adaptor/accessible-adaptor.c +++ b/atk-adaptor/accessible-adaptor.c @@ -241,7 +241,7 @@ impl_GetRelationSet (DBusConnection *bus, if (!reply) return NULL; set = atk_object_ref_relation_set (object); dbus_message_iter_init_append (reply, &iter); - if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "(uao)", &iter_array)) + if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "(ua(so))", &iter_array)) { goto oom; } @@ -261,7 +261,7 @@ impl_GetRelationSet (DBusConnection *bus, goto oom; } dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_UINT32, &type); - if (!dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "o", &iter_targets)) + if (!dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "(so)", &iter_targets)) { goto oom; } @@ -276,7 +276,7 @@ impl_GetRelationSet (DBusConnection *bus, g_warning ("Unknown object in relation type %d\n", type); continue; } - dbus_message_iter_append_basic (&iter_targets, DBUS_TYPE_OBJECT_PATH, &path); + spi_dbus_append_name_and_path_inner (&iter_targets, NULL, path); } dbus_message_iter_close_container (&iter_struct, &iter_targets); dbus_message_iter_close_container (&iter_array, &iter_struct); diff --git a/atk-adaptor/accessible-marshaller.c b/atk-adaptor/accessible-marshaller.c index 4ef9b20..2d5e4fd 100644 --- a/atk-adaptor/accessible-marshaller.c +++ b/atk-adaptor/accessible-marshaller.c @@ -27,11 +27,45 @@ #include "accessible-register.h" #include "accessible-marshaller.h" +#include "bridge.h" #include "adaptors.h" /*---------------------------------------------------------------------------*/ +void +spi_dbus_append_name_and_path_inner (DBusMessageIter *iter, const char *bus_name, const char *path) +{ + DBusMessageIter iter_struct; + + if (!bus_name) + bus_name = ""; + + dbus_message_iter_open_container (iter, DBUS_TYPE_STRUCT, NULL, &iter_struct); + dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &bus_name); + dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_OBJECT_PATH, &path); + dbus_message_iter_close_container (iter, &iter_struct); +} + +void +spi_dbus_append_name_and_path (DBusMessage *message, DBusMessageIter *iter, AtkObject *obj, gboolean unref) +{ + gchar *path; + DBusMessageIter iter_struct; + const char *bus_name = dbus_message_get_sender (message); + + path = atk_dbus_object_to_path (obj, FALSE); + + if (!path) + path = g_strdup (SPI_DBUS_PATH_NULL); + + spi_dbus_append_name_and_path_inner (iter, bus_name, path); + + g_free (path); + if (obj && unref) + g_object_unref (obj); +} + /* * Marshals the D-Bus path of an AtkObject into a D-Bus message. * @@ -41,25 +75,14 @@ DBusMessage * spi_dbus_return_object (DBusMessage *message, AtkObject *obj, gboolean do_register, gboolean unref) { DBusMessage *reply; - gchar *path; - - path = atk_dbus_object_to_path (obj, do_register); - - if (obj && unref) - g_object_unref (obj); - - if (!path) - path = g_strdup (SPI_DBUS_PATH_NULL); - reply = dbus_message_new_method_return (message); if (reply) { - dbus_message_append_args (reply, DBUS_TYPE_OBJECT_PATH, &path, - DBUS_TYPE_INVALID); + DBusMessageIter iter; + dbus_message_iter_init_append (message, &iter); + spi_dbus_append_name_and_path (message, &iter, obj, unref); } - g_free (path); - return reply; } @@ -210,7 +233,7 @@ append_atk_object_interfaces (AtkObject *object, DBusMessageIter *iter) * Marshals the given AtkObject into the provided D-Bus iterator. * * The object is marshalled including all its client side cache data. - * The format of the structure is (ooaoassusau). + * The format of the structure is (o(so)a(so)assusau). * This is used in the updateTree signal and the GetTree method * of the org.freedesktop.atspi.Tree interface. * @@ -218,19 +241,17 @@ append_atk_object_interfaces (AtkObject *object, DBusMessageIter *iter) * be registered with D-Bus and have been given a D-Bus object path. */ void -spi_atk_append_accessible(AtkObject *obj, gpointer iter) +spi_atk_append_accessible(AtkObject *obj, gpointer data) { - DBusMessageIter *iter_array; DBusMessageIter iter_struct, iter_sub_array; dbus_uint32_t states [2]; int count; AtkStateSet *set; + DBusMessageIter *iter_array = (DBusMessageIter *)data; const char *name, *desc; dbus_uint32_t role; - iter_array = (DBusMessageIter *) iter; - set = atk_object_ref_state_set (obj); dbus_message_iter_open_container (iter_array, DBUS_TYPE_STRUCT, NULL, &iter_struct); { @@ -239,7 +260,6 @@ spi_atk_append_accessible(AtkObject *obj, gpointer iter) /* Marshall object path */ path = atk_dbus_object_to_path (obj, FALSE); - dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_OBJECT_PATH, &path); /* Marshall parent */ parent = atk_object_get_parent(obj); @@ -265,11 +285,13 @@ spi_atk_append_accessible(AtkObject *obj, gpointer iter) path_parent = atk_dbus_desktop_object_path (); } } - dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_OBJECT_PATH, &path_parent); + + dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_OBJECT_PATH, &path); + spi_dbus_append_name_and_path_inner (&iter_struct, NULL, path_parent); g_free(path_parent); /* Marshall children */ - dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "o", &iter_sub_array); + dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "(so)", &iter_sub_array); if (!atk_state_set_contains_state (set, ATK_STATE_MANAGES_DESCENDANTS)) { gint childcount, i; @@ -284,7 +306,7 @@ spi_atk_append_accessible(AtkObject *obj, gpointer iter) child_path = atk_dbus_object_to_path (child, FALSE); if (child_path) { - dbus_message_iter_append_basic (&iter_sub_array, DBUS_TYPE_OBJECT_PATH, &child_path); + spi_dbus_append_name_and_path_inner (&iter_sub_array, NULL, child_path); g_free (child_path); } g_object_unref(G_OBJECT(child)); diff --git a/atk-adaptor/accessible-marshaller.h b/atk-adaptor/accessible-marshaller.h index ed72967..588c50d 100644 --- a/atk-adaptor/accessible-marshaller.h +++ b/atk-adaptor/accessible-marshaller.h @@ -27,6 +27,12 @@ #include #include +void +spi_dbus_append_name_and_path_inner (DBusMessageIter *iter, const char *bus_name, const char *path); + +void +spi_dbus_append_name_and_path (DBusMessage *message, DBusMessageIter *iter, AtkObject *obj, gboolean unref); + DBusMessage * spi_dbus_return_object (DBusMessage *message, AtkObject *obj, gboolean do_register, gboolean unref); diff --git a/atk-adaptor/relation-adaptor.c b/atk-adaptor/relation-adaptor.c index 57267cb..eaa7d8b 100644 --- a/atk-adaptor/relation-adaptor.c +++ b/atk-adaptor/relation-adaptor.c @@ -46,6 +46,7 @@ spi_init_relation_type_table (Accessibility_RelationType *types) types[ATK_RELATION_LABELLED_BY] = Accessibility_RELATION_LABELLED_BY; types[ATK_RELATION_MEMBER_OF] = Accessibility_RELATION_MEMBER_OF; types[ATK_RELATION_NODE_CHILD_OF] = Accessibility_RELATION_NODE_CHILD_OF; + types[ATK_RELATION_NODE_PARENT_OF] = Accessibility_RELATION_NODE_PARENT_OF; types[ATK_RELATION_FLOWS_TO] = Accessibility_RELATION_FLOWS_TO; types[ATK_RELATION_FLOWS_FROM] = Accessibility_RELATION_FLOWS_FROM; types[ATK_RELATION_SUBWINDOW_OF] = Accessibility_RELATION_SUBWINDOW_OF; diff --git a/atk-adaptor/tree-adaptor.c b/atk-adaptor/tree-adaptor.c index 6f21fa6..3935b26 100644 --- a/atk-adaptor/tree-adaptor.c +++ b/atk-adaptor/tree-adaptor.c @@ -37,11 +37,11 @@ /* For use as a GHFunc */ static void -append_accessible_hf (gpointer key, gpointer obj_data, gpointer iter) +append_accessible_hf (gpointer key, gpointer obj_data, gpointer data) { /* Make sure it isn't a hyperlink */ if (ATK_IS_OBJECT (obj_data)) - spi_atk_append_accessible (ATK_OBJECT(obj_data), iter); + spi_atk_append_accessible (ATK_OBJECT(obj_data), data); } /*---------------------------------------------------------------------------*/ @@ -128,7 +128,7 @@ impl_GetTree (DBusConnection *bus, DBusMessage *message, void *user_data) reply = dbus_message_new_method_return (message); dbus_message_iter_init_append (reply, &iter); - dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(ooaoassusau)", &iter_array); + dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(o(so)a(so)assusau)", &iter_array); atk_dbus_foreach_registered(append_accessible_hf, &iter_array); dbus_message_iter_close_container(&iter, &iter_array); return reply; diff --git a/common/generated-types.h b/common/generated-types.h index c165cf6..228dffa 100644 --- a/common/generated-types.h +++ b/common/generated-types.h @@ -18,7 +18,6 @@ Accessibility::Hypertext\n Accessibility::Image\n Accessibility::Selection\n - Accessibility::StreamableContent\n Accessibility::Table\n Accessibility::Text\n Accessibility::EditableText\n @@ -98,6 +97,28 @@ typedef enum { /** * +Accessibility_COORD_TYPE: + * @Accessibility_COORD_TYPE_SCREEN: + * @Accessibility_COORD_TYPE_WINDOW: + * + * + * + * Bitfield/set of flags generated from the AT-SPI specification. + */ +typedef enum { + Accessibility_COORD_TYPE_SCREEN, + Accessibility_COORD_TYPE_WINDOW, +} Accessibility_COORD_TYPE; + +/** + * NUM_ACCESSIBILITY_COORD_TYPES: + * + * 1 higher than the highest valid value of #Accessibility_COORD_TYPE. + */ +#define NUM_ACCESSIBILITY_COORD_TYPES (1+1) + +/** + * Accessibility_Collection_SortOrder: * @Accessibility_Collection_SORT_ORDER_INVALID: * @Accessibility_Collection_SORT_ORDER_CANONICAL: @@ -187,7 +208,7 @@ Accessibility_ComponentLayer: * @Accessibility_LAYER_BACKGROUND: * @Accessibility_LAYER_CANVAS: * @Accessibility_LAYER_WIDGET: - * @Accessibility_LAYER_MDI: + * @Accessibility_LAYER_MDI: * @Accessibility_LAYER_POPUP: * @Accessibility_LAYER_OVERLAY: * @Accessibility_LAYER_WINDOW: @@ -218,30 +239,6 @@ typedef enum { /** * -Accessibility_SeekType: - * @Accessibility_SEEK_SET: - * @Accessibility_SEEK_CURRENT: - * @Accessibility_SEEK_END: - * - * - * - * Bitfield/set of flags generated from the AT-SPI specification. - */ -typedef enum { - Accessibility_SEEK_SET, - Accessibility_SEEK_CURRENT, - Accessibility_SEEK_END, -} Accessibility_SeekType; - -/** - * NUM_ACCESSIBILITY_SEEKTYPES: - * - * 1 higher than the highest valid value of #Accessibility_SeekType. - */ -#define NUM_ACCESSIBILITY_SEEKTYPES (2+1) - -/** - * Accessibility_TEXT_BOUNDARY_TYPE: * @Accessibility_TEXT_BOUNDARY_CHAR: * @Accessibility_TEXT_BOUNDARY_WORD_START: @@ -251,7 +248,7 @@ Accessibility_TEXT_BOUNDARY_TYPE: * @Accessibility_TEXT_BOUNDARY_LINE_START: * @Accessibility_TEXT_BOUNDARY_LINE_END: * - * + * * * Bitfield/set of flags generated from the AT-SPI specification. */ @@ -452,10 +449,10 @@ Accessibility_KeySynthType: * @Accessibility_KEY_PRESS: * @Accessibility_KEY_RELEASE: * @Accessibility_KEY_PRESSRELEASE: - * @Accessibility_KEY_SYM: + * @Accessibility_KEY_SYM: * @Accessibility_KEY_STRING: * - * + * * * Bitfield/set of flags generated from the AT-SPI specification. */ @@ -516,7 +513,8 @@ Accessibility_RelationType: * @Accessibility_RELATION_CONTROLLED_BY: * @Accessibility_RELATION_MEMBER_OF: * @Accessibility_RELATION_TOOLTIP_FOR: - * @Accessibility_RELATION_NODE_CHILD_OF: + * @Accessibility_RELATION_NODE_CHILD_OF: + * @Accessibility_RELATION_NODE_PARENT_OF: * @Accessibility_RELATION_EXTENDED: * @Accessibility_RELATION_FLOWS_TO: * @Accessibility_RELATION_FLOWS_FROM: @@ -542,6 +540,7 @@ typedef enum { Accessibility_RELATION_MEMBER_OF, Accessibility_RELATION_TOOLTIP_FOR, Accessibility_RELATION_NODE_CHILD_OF, + Accessibility_RELATION_NODE_PARENT_OF, Accessibility_RELATION_EXTENDED, Accessibility_RELATION_FLOWS_TO, Accessibility_RELATION_FLOWS_FROM, @@ -560,7 +559,7 @@ typedef enum { * * 1 higher than the highest valid value of #Accessibility_RelationType. */ -#define NUM_ACCESSIBILITY_RELATIONTYPES (18+1) +#define NUM_ACCESSIBILITY_RELATIONTYPES (19+1) /** * @@ -760,74 +759,6 @@ typedef enum { */ #define NUM_ACCESSIBILITY_ROLES (90+1) -/** - * -Accessibility_LoginHelper_DeviceReq: - * @Accessibility_LoginHelper_GUI_EVENTS: - * @Accessibility_LoginHelper_CORE_KEYBOARD: - * @Accessibility_LoginHelper_CORE_POINTER: - * @Accessibility_LoginHelper_EXT_INPUT: - * @Accessibility_LoginHelper_POST_WINDOWS: - * @Accessibility_LoginHelper_AUDIO_OUT: - * @Accessibility_LoginHelper_AUDIO_IN: - * @Accessibility_LoginHelper_NETWORK: - * @Accessibility_LoginHelper_LOCALHOST: - * @Accessibility_LoginHelper_SERIAL_OUT: - * @Accessibility_LoginHelper_SERIAL_IN: - * - * - * - * Bitfield/set of flags generated from the AT-SPI specification. - */ -typedef enum { - Accessibility_LoginHelper_GUI_EVENTS, - Accessibility_LoginHelper_CORE_KEYBOARD, - Accessibility_LoginHelper_CORE_POINTER, - Accessibility_LoginHelper_EXT_INPUT, - Accessibility_LoginHelper_POST_WINDOWS, - Accessibility_LoginHelper_AUDIO_OUT, - Accessibility_LoginHelper_AUDIO_IN, - Accessibility_LoginHelper_NETWORK, - Accessibility_LoginHelper_LOCALHOST, - Accessibility_LoginHelper_SERIAL_OUT, - Accessibility_LoginHelper_SERIAL_IN, -} Accessibility_LoginHelper_DeviceReq; - -/** - * NUM_ACCESSIBILITY_DEVICEREQS: - * - * 1 higher than the highest valid value of #Accessibility_LoginHelper_DeviceReq. - */ -#define NUM_ACCESSIBILITY_DEVICEREQS (10+1) - -/** - * -Accessibility_Selector_CommandResult: - * @Accessibility_Selector_COMMAND_RESULT_INVALID: - * @Accessibility_Selector_COMMAND_RESULT_SUCCESS: - * @Accessibility_Selector_COMMAND_RESULT_FAILED: - * @Accessibility_Selector_COMMAND_RESULT_OBSOLETE: - * @Accessibility_Selector_COMMAND_RESULT_LAST_DEFINED: - * - * - * - * Bitfield/set of flags generated from the AT-SPI specification. - */ -typedef enum { - Accessibility_Selector_COMMAND_RESULT_INVALID, - Accessibility_Selector_COMMAND_RESULT_SUCCESS, - Accessibility_Selector_COMMAND_RESULT_FAILED, - Accessibility_Selector_COMMAND_RESULT_OBSOLETE, - Accessibility_Selector_COMMAND_RESULT_LAST_DEFINED, -} Accessibility_Selector_CommandResult; - -/** - * NUM_ACCESSIBILITY_COMMANDRESULTS: - * - * 1 higher than the highest valid value of #Accessibility_Selector_CommandResult. - */ -#define NUM_ACCESSIBILITY_COMMANDRESULTS (4+1) - #ifdef __cplusplus } -- 2.7.4