diff options
| author | Federico Mena Quintero <federico@gnome.org> | 2022-12-06 20:44:48 -0600 |
|---|---|---|
| committer | Federico Mena Quintero <federico@gnome.org> | 2022-12-06 20:50:13 -0600 |
| commit | b10fcf21b1ef49dd3d6297ac657434ece3b23578 (patch) | |
| tree | d560f8449f3ae75fea343887dcb6d5f4df7b434c /atspi | |
| parent | bf4d71a38b970699f63ce7b701e9bf4c9d31f717 (diff) | |
| download | at-spi2-core-b10fcf21b1ef49dd3d6297ac657434ece3b23578.tar.gz | |
Reformat all the *.[ch] files with clang-format
I ran this on each directory with C files:
clang-format -i *.[ch]
"-i" is the in-place option.
I also adjusted the order of #includes for some files which failed to
build after that:
Clang-format reorders blocks of #include directives alphabetically,
but they can be grouped and separated by blank lines. If there is a
blank line between blocks, like
#include "zork.h"
#include "bar.h"
#include "foo.h"
then it will not put zork.h after the other two. The last two header
files will be sorted alphabetically.
We can adjust the formatting of chunks of code by hand with comments
like these:
/* clang-format off */
this code {
is, formatted, by, hand;
}
/* clang-format on */
See https://clang.llvm.org/docs/ClangFormat.html for the general
manual and https://clang.llvm.org/docs/ClangFormatStyleOptions.html
for the style options and the comments described above.
Diffstat (limited to 'atspi')
65 files changed, 3819 insertions, 3820 deletions
diff --git a/atspi/atspi-accessible-private.h b/atspi/atspi-accessible-private.h index e7e748b9..e92260ee 100644 --- a/atspi/atspi-accessible-private.h +++ b/atspi/atspi-accessible-private.h @@ -26,11 +26,13 @@ #ifndef _ATSPI_ACCESSIBLE_PRIVATE_H_ #define _ATSPI_ACCESSIBLE_PRIVATE_H_ -G_BEGIN_DECLS +#include <glib.h> #include "atspi-accessible.h" #include "atspimarshal.h" +G_BEGIN_DECLS + struct _AtspiAccessiblePrivate { GHashTable *cache; @@ -44,4 +46,4 @@ void _atspi_accessible_unref_cache (AtspiAccessible *accessible); G_END_DECLS -#endif /* _ATSPI_ACCESSIBLE_H_ */ +#endif /* _ATSPI_ACCESSIBLE_H_ */ diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c index d7d3f833..e3587433 100644 --- a/atspi/atspi-accessible.c +++ b/atspi/atspi-accessible.c @@ -22,8 +22,8 @@ * Boston, MA 02110-1301, USA. */ -#include "atspi-private.h" #include "atspi-accessible-private.h" +#include "atspi-private.h" #include <string.h> /** @@ -36,7 +36,8 @@ * actually have children. */ -enum { +enum +{ REGION_CHANGED, MODE_CHANGED, LAST_SIGNAL @@ -45,13 +46,15 @@ enum { static gboolean enable_caching = FALSE; static guint quark_locale; -static guint atspi_accessible_signals[LAST_SIGNAL] = { 0, }; +static guint atspi_accessible_signals[LAST_SIGNAL] = { + 0, +}; static gboolean screen_reader_signal_watcher (GSignalInvocationHint *signal_hint, - guint n_param_values, - const GValue *param_values, - gpointer data) + guint n_param_values, + const GValue *param_values, + gpointer data) { GObject *object; AtspiAccessible *accessible; @@ -64,7 +67,7 @@ screen_reader_signal_watcher (GSignalInvocationHint *signal_hint, gchar *dbus_name; object = g_value_get_object (param_values + 0); - g_return_val_if_fail (ATSPI_IS_ACCESSIBLE(object), FALSE); + g_return_val_if_fail (ATSPI_IS_ACCESSIBLE (object), FALSE); g_signal_query (signal_hint->signal_id, &signal_query); name = signal_query.signal_name; @@ -98,7 +101,7 @@ screen_reader_signal_watcher (GSignalInvocationHint *signal_hint, dbus_message_iter_close_container (&iter, &iter_array); dbus_connection_send (_atspi_bus (), signal, NULL); dbus_message_unref (signal); - return TRUE; + return TRUE; } static void @@ -161,20 +164,7 @@ atspi_value_interface_init (AtspiValue *value) { } -G_DEFINE_TYPE_WITH_CODE (AtspiAccessible, atspi_accessible, ATSPI_TYPE_OBJECT, - G_ADD_PRIVATE (AtspiAccessible) - G_IMPLEMENT_INTERFACE (ATSPI_TYPE_ACTION, atspi_action_interface_init) - G_IMPLEMENT_INTERFACE (ATSPI_TYPE_COLLECTION, atspi_collection_interface_init) - G_IMPLEMENT_INTERFACE (ATSPI_TYPE_COMPONENT, atspi_component_interface_init) - G_IMPLEMENT_INTERFACE (ATSPI_TYPE_DOCUMENT, atspi_document_interface_init) - G_IMPLEMENT_INTERFACE (ATSPI_TYPE_EDITABLE_TEXT, atspi_editable_text_interface_init) - G_IMPLEMENT_INTERFACE (ATSPI_TYPE_HYPERTEXT, atspi_hypertext_interface_init) - G_IMPLEMENT_INTERFACE (ATSPI_TYPE_IMAGE, atspi_image_interface_init) - G_IMPLEMENT_INTERFACE (ATSPI_TYPE_SELECTION, atspi_selection_interface_init) - G_IMPLEMENT_INTERFACE (ATSPI_TYPE_TABLE, atspi_table_interface_init) - G_IMPLEMENT_INTERFACE (ATSPI_TYPE_TABLE_CELL, atspi_table_cell_interface_init) - G_IMPLEMENT_INTERFACE (ATSPI_TYPE_TEXT, atspi_text_interface_init) - G_IMPLEMENT_INTERFACE (ATSPI_TYPE_VALUE, atspi_value_interface_init)) +G_DEFINE_TYPE_WITH_CODE (AtspiAccessible, atspi_accessible, ATSPI_TYPE_OBJECT, G_ADD_PRIVATE (AtspiAccessible) G_IMPLEMENT_INTERFACE (ATSPI_TYPE_ACTION, atspi_action_interface_init) G_IMPLEMENT_INTERFACE (ATSPI_TYPE_COLLECTION, atspi_collection_interface_init) G_IMPLEMENT_INTERFACE (ATSPI_TYPE_COMPONENT, atspi_component_interface_init) G_IMPLEMENT_INTERFACE (ATSPI_TYPE_DOCUMENT, atspi_document_interface_init) G_IMPLEMENT_INTERFACE (ATSPI_TYPE_EDITABLE_TEXT, atspi_editable_text_interface_init) G_IMPLEMENT_INTERFACE (ATSPI_TYPE_HYPERTEXT, atspi_hypertext_interface_init) G_IMPLEMENT_INTERFACE (ATSPI_TYPE_IMAGE, atspi_image_interface_init) G_IMPLEMENT_INTERFACE (ATSPI_TYPE_SELECTION, atspi_selection_interface_init) G_IMPLEMENT_INTERFACE (ATSPI_TYPE_TABLE, atspi_table_interface_init) G_IMPLEMENT_INTERFACE (ATSPI_TYPE_TABLE_CELL, atspi_table_cell_interface_init) G_IMPLEMENT_INTERFACE (ATSPI_TYPE_TEXT, atspi_text_interface_init) G_IMPLEMENT_INTERFACE (ATSPI_TYPE_VALUE, atspi_value_interface_init)) #ifdef DEBUG_REF_COUNTS static gint accessible_count = 0; @@ -184,7 +174,7 @@ static void atspi_accessible_unref (GObject *accessible) { if (accessible != NULL) - g_object_unref(accessible); + g_object_unref (accessible); } static void @@ -193,7 +183,7 @@ atspi_accessible_init (AtspiAccessible *accessible) #ifdef DEBUG_REF_COUNTS accessible_count++; g_hash_table_insert (_atspi_get_live_refs (), accessible, NULL); - g_print("at-spi: init: %d objects\n", accessible_count); + g_print ("at-spi: init: %d objects\n", accessible_count); #endif accessible->priv = atspi_accessible_get_instance_private (accessible); @@ -221,30 +211,31 @@ atspi_accessible_dispose (GObject *object) parent = accessible->accessible_parent; if (parent) - { - accessible->accessible_parent = NULL; - if (parent->children) - g_ptr_array_remove (parent->children, accessible); - g_object_unref (parent); - } - - if (accessible->children) for (i = accessible->children->len - 1; i >= 0; i--) - { - AtspiAccessible *child = g_ptr_array_index (accessible->children, i); - if (child && child->accessible_parent == accessible) { - child->accessible_parent = NULL; - g_object_unref (accessible); + accessible->accessible_parent = NULL; + if (parent->children) + g_ptr_array_remove (parent->children, accessible); + g_object_unref (parent); } - } if (accessible->children) - { - g_ptr_array_free (accessible->children, TRUE); - accessible->children = NULL; - } + for (i = accessible->children->len - 1; i >= 0; i--) + { + AtspiAccessible *child = g_ptr_array_index (accessible->children, i); + if (child && child->accessible_parent == accessible) + { + child->accessible_parent = NULL; + g_object_unref (accessible); + } + } + + if (accessible->children) + { + g_ptr_array_free (accessible->children, TRUE); + accessible->children = NULL; + } - G_OBJECT_CLASS (atspi_accessible_parent_class) ->dispose (object); + G_OBJECT_CLASS (atspi_accessible_parent_class)->dispose (object); } static void @@ -296,14 +287,14 @@ atspi_accessible_class_init (AtspiAccessibleClass *klass) * needed to highlight the object that the screen reader is reading. */ atspi_accessible_signals[REGION_CHANGED] = - g_signal_new ("region_changed", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (AtspiAccessibleClass, region_changed), - NULL, NULL, - atspi_marshal_VOID__INT_INT, - G_TYPE_NONE, - 2, G_TYPE_INT, G_TYPE_INT); + g_signal_new ("region_changed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AtspiAccessibleClass, region_changed), + NULL, NULL, + atspi_marshal_VOID__INT_INT, + G_TYPE_NONE, + 2, G_TYPE_INT, G_TYPE_INT); /** * AtspiAccessible::mode-changed: @@ -318,16 +309,16 @@ atspi_accessible_class_init (AtspiAccessibleClass *klass) * mouse-review * say-all * caret-tracking - */ + */ atspi_accessible_signals[MODE_CHANGED] = - g_signal_new ("mode_changed", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, - G_STRUCT_OFFSET (AtspiAccessibleClass, mode_changed), - NULL, NULL, - atspi_marshal_VOID__INT_STRING, - G_TYPE_NONE, - 2, G_TYPE_INT, G_TYPE_STRING); + g_signal_new ("mode_changed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, + G_STRUCT_OFFSET (AtspiAccessibleClass, mode_changed), + NULL, NULL, + atspi_marshal_VOID__INT_STRING, + G_TYPE_NONE, + 2, G_TYPE_INT, G_TYPE_STRING); g_signal_add_emission_hook (atspi_accessible_signals[REGION_CHANGED], 0, screen_reader_signal_watcher, NULL, @@ -343,7 +334,7 @@ atspi_accessible_class_init (AtspiAccessibleClass *klass) * * Gets the name of an #AtspiAccessible object. * - * Returns: a UTF-8 string indicating the name of the #AtspiAccessible object + * Returns: a UTF-8 string indicating the name of the #AtspiAccessible object * or NULL on exception. **/ gchar * @@ -352,14 +343,14 @@ atspi_accessible_get_name (AtspiAccessible *obj, GError **error) g_return_val_if_fail (obj != NULL, g_strdup ("")); if (!_atspi_accessible_test_cache (obj, ATSPI_CACHE_NAME)) - { - g_free (obj->name); - obj->name = NULL; - if (!_atspi_dbus_get_property (obj, atspi_interface_accessible, "Name", error, - "s", &obj->name)) - return g_strdup (""); - _atspi_accessible_add_cache (obj, ATSPI_CACHE_NAME); - } + { + g_free (obj->name); + obj->name = NULL; + if (!_atspi_dbus_get_property (obj, atspi_interface_accessible, "Name", error, + "s", &obj->name)) + return g_strdup (""); + _atspi_accessible_add_cache (obj, ATSPI_CACHE_NAME); + } return g_strdup (obj->name); } @@ -369,7 +360,7 @@ atspi_accessible_get_name (AtspiAccessible *obj, GError **error) * * Gets the description of an #AtspiAccessible object. * - * Returns: a UTF-8 string describing the #AtspiAccessible object + * Returns: a UTF-8 string describing the #AtspiAccessible object * or NULL on exception. **/ gchar * @@ -378,15 +369,15 @@ atspi_accessible_get_description (AtspiAccessible *obj, GError **error) g_return_val_if_fail (obj != NULL, g_strdup ("")); if (!_atspi_accessible_test_cache (obj, ATSPI_CACHE_DESCRIPTION)) - { - g_free (obj->description); - obj->description = NULL; - if (!_atspi_dbus_get_property (obj, atspi_interface_accessible, - "Description", error, "s", - &obj->description)) - return g_strdup (""); - _atspi_accessible_add_cache (obj, ATSPI_CACHE_DESCRIPTION); - } + { + g_free (obj->description); + obj->description = NULL; + if (!_atspi_dbus_get_property (obj, atspi_interface_accessible, + "Description", error, "s", + &obj->description)) + return g_strdup (""); + _atspi_accessible_add_cache (obj, ATSPI_CACHE_DESCRIPTION); + } return g_strdup (obj->description); } @@ -410,34 +401,34 @@ atspi_accessible_get_parent (AtspiAccessible *obj, GError **error) g_return_val_if_fail (obj != NULL, NULL); if (!_atspi_accessible_test_cache (obj, ATSPI_CACHE_PARENT)) - { - DBusMessage *message, *reply; - DBusMessageIter iter, iter_variant; - if (!obj->parent.app) - return NULL; - message = dbus_message_new_method_call (obj->parent.app->bus_name, - obj->parent.path, - DBUS_INTERFACE_PROPERTIES, "Get"); - if (!message) - return NULL; - dbus_message_append_args (message, DBUS_TYPE_STRING, &atspi_interface_accessible, - DBUS_TYPE_STRING, &str_parent, - DBUS_TYPE_INVALID); - reply = _atspi_dbus_send_with_reply_and_block (message, error); - if (!reply) - return NULL; - if (strcmp (dbus_message_get_signature (reply), "v") != 0) { + DBusMessage *message, *reply; + DBusMessageIter iter, iter_variant; + if (!obj->parent.app) + return NULL; + message = dbus_message_new_method_call (obj->parent.app->bus_name, + obj->parent.path, + DBUS_INTERFACE_PROPERTIES, "Get"); + if (!message) + return NULL; + dbus_message_append_args (message, DBUS_TYPE_STRING, &atspi_interface_accessible, + DBUS_TYPE_STRING, &str_parent, + DBUS_TYPE_INVALID); + reply = _atspi_dbus_send_with_reply_and_block (message, error); + if (!reply) + return NULL; + if (strcmp (dbus_message_get_signature (reply), "v") != 0) + { + dbus_message_unref (reply); + return NULL; + } + dbus_message_iter_init (reply, &iter); + dbus_message_iter_recurse (&iter, &iter_variant); + g_clear_object (&obj->accessible_parent); + obj->accessible_parent = _atspi_dbus_consume_accessible (&iter_variant); dbus_message_unref (reply); - return NULL; + _atspi_accessible_add_cache (obj, ATSPI_CACHE_PARENT); } - dbus_message_iter_init (reply, &iter); - dbus_message_iter_recurse (&iter, &iter_variant); - g_clear_object (&obj->accessible_parent); - obj->accessible_parent = _atspi_dbus_consume_accessible (&iter_variant); - dbus_message_unref (reply); - _atspi_accessible_add_cache (obj, ATSPI_CACHE_PARENT); - } if (!obj->accessible_parent) return NULL; return g_object_ref (obj->accessible_parent); @@ -459,16 +450,16 @@ atspi_accessible_get_child_count (AtspiAccessible *obj, GError **error) g_return_val_if_fail (obj != NULL, -1); if (!_atspi_accessible_test_cache (obj, ATSPI_CACHE_CHILDREN)) - { - dbus_int32_t ret; - if (!_atspi_dbus_get_property (obj, atspi_interface_accessible, - "ChildCount", error, "i", &ret)) - return -1; - return ret; - } + { + dbus_int32_t ret; + if (!_atspi_dbus_get_property (obj, atspi_interface_accessible, + "ChildCount", error, "i", &ret)) + return -1; + return ret; + } if (!obj->children) - return 0; /* assume it's disposed */ + return 0; /* assume it's disposed */ return obj->children->len; } @@ -485,8 +476,8 @@ atspi_accessible_get_child_count (AtspiAccessible *obj, GError **error) **/ AtspiAccessible * atspi_accessible_get_child_at_index (AtspiAccessible *obj, - gint child_index, - GError **error) + gint child_index, + GError **error) { AtspiAccessible *child; DBusMessage *reply; @@ -494,28 +485,28 @@ atspi_accessible_get_child_at_index (AtspiAccessible *obj, g_return_val_if_fail (obj != NULL, NULL); if (_atspi_accessible_test_cache (obj, ATSPI_CACHE_CHILDREN)) - { - if (!obj->children) - return NULL; /* assume disposed */ + { + if (!obj->children) + return NULL; /* assume disposed */ - child = g_ptr_array_index (obj->children, child_index); - if (child) - return g_object_ref (child); - } + child = g_ptr_array_index (obj->children, child_index); + if (child) + return g_object_ref (child); + } reply = _atspi_dbus_call_partial (obj, atspi_interface_accessible, - "GetChildAtIndex", error, "i", child_index); + "GetChildAtIndex", error, "i", child_index); child = _atspi_dbus_return_accessible_from_message (reply); if (!child) return NULL; if (_atspi_accessible_test_cache (obj, ATSPI_CACHE_CHILDREN)) - { + { if (child_index >= obj->children->len) g_ptr_array_set_size (obj->children, child_index + 1); - g_ptr_array_index (obj->children, child_index) = g_object_ref (child); - } + g_ptr_array_index (obj->children, child_index) = g_object_ref (child); + } return child; } @@ -523,7 +514,7 @@ atspi_accessible_get_child_at_index (AtspiAccessible *obj, * atspi_accessible_get_index_in_parent: * @obj: a pointer to the #AtspiAccessible object on which to operate. * - * Gets the index of an #AtspiAccessible object within its parent's + * Gets the index of an #AtspiAccessible object within its parent's * #AtspiAccessible children list. * * Returns: a #glong indicating the index of the #AtspiAccessible object @@ -538,17 +529,17 @@ atspi_accessible_get_index_in_parent (AtspiAccessible *obj, GError **error) g_return_val_if_fail (obj != NULL, -1); if (_atspi_accessible_test_cache (obj, ATSPI_CACHE_PARENT)) - { - if (!obj->accessible_parent) - return -1; + { + if (!obj->accessible_parent) + return -1; - if (!_atspi_accessible_test_cache (obj->accessible_parent, ATSPI_CACHE_CHILDREN) || !obj->accessible_parent->children) + if (!_atspi_accessible_test_cache (obj->accessible_parent, ATSPI_CACHE_CHILDREN) || !obj->accessible_parent->children) goto dbus; - for (i = 0; i < obj->accessible_parent->children->len; i++) - if (g_ptr_array_index (obj->accessible_parent->children, i) == obj) - return i; - } + for (i = 0; i < obj->accessible_parent->children->len; i++) + if (g_ptr_array_index (obj->accessible_parent->children, i) == obj) + return i; + } dbus: _atspi_dbus_call (obj, atspi_interface_accessible, @@ -590,12 +581,12 @@ atspi_accessible_get_relation_set (AtspiAccessible *obj, GError **error) dbus_message_iter_init (reply, &iter); dbus_message_iter_recurse (&iter, &iter_array); while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID) - { - AtspiRelation *relation; - relation = _atspi_relation_new_from_iter (&iter_array); - ret = g_array_append_val (ret, relation); - dbus_message_iter_next (&iter_array); - } + { + AtspiRelation *relation; + relation = _atspi_relation_new_from_iter (&iter_array); + ret = g_array_append_val (ret, relation); + dbus_message_iter_next (&iter_array); + } dbus_message_unref (reply); return ret; } @@ -616,15 +607,15 @@ atspi_accessible_get_role (AtspiAccessible *obj, GError **error) g_return_val_if_fail (obj != NULL, ATSPI_ROLE_INVALID); if (!_atspi_accessible_test_cache (obj, ATSPI_CACHE_ROLE)) - { - dbus_uint32_t role; - /* TODO: Make this a property */ - if (_atspi_dbus_call (obj, atspi_interface_accessible, "GetRole", error, "=>u", &role)) { - obj->role = role; - _atspi_accessible_add_cache (obj, ATSPI_CACHE_ROLE); + dbus_uint32_t role; + /* TODO: Make this a property */ + if (_atspi_dbus_call (obj, atspi_interface_accessible, "GetRole", error, "=>u", &role)) + { + obj->role = role; + _atspi_accessible_add_cache (obj, ATSPI_CACHE_ROLE); + } } - } return obj->role; } @@ -664,12 +655,12 @@ atspi_accessible_get_role_name (AtspiAccessible *obj, GError **error) * atspi_accessible_get_localized_role_name: * @obj: a pointer to the #AtspiAccessible object on which to operate. * - * Gets a UTF-8 string corresponding to the name of the role played by an + * Gets a UTF-8 string corresponding to the name of the role played by an * object, translated to the current locale. * This method will return useful values for roles that fall outside the * enumeration used in atspi_accessible_getRole (). * - * Returns: a localized, UTF-8 string specifying the type of UI role played + * Returns: a localized, UTF-8 string specifying the type of UI role played * by an #AtspiAccessible object. * **/ @@ -713,17 +704,17 @@ atspi_accessible_get_state_set (AtspiAccessible *obj) return defunct_set (); if (!_atspi_accessible_test_cache (obj, ATSPI_CACHE_STATES)) - { - DBusMessage *reply; - DBusMessageIter iter; - reply = _atspi_dbus_call_partial (obj, atspi_interface_accessible, - "GetState", NULL, ""); - _ATSPI_DBUS_CHECK_SIG (reply, "au", NULL, defunct_set ()); - dbus_message_iter_init (reply, &iter); - _atspi_dbus_set_state (obj, &iter); - dbus_message_unref (reply); - _atspi_accessible_add_cache (obj, ATSPI_CACHE_STATES); - } + { + DBusMessage *reply; + DBusMessageIter iter; + reply = _atspi_dbus_call_partial (obj, atspi_interface_accessible, + "GetState", NULL, ""); + _ATSPI_DBUS_CHECK_SIG (reply, "au", NULL, defunct_set ()); + dbus_message_iter_init (reply, &iter); + _atspi_dbus_set_state (obj, &iter); + dbus_message_unref (reply); + _atspi_accessible_add_cache (obj, ATSPI_CACHE_STATES); + } return g_object_ref (obj->states); } @@ -732,7 +723,7 @@ atspi_accessible_get_state_set (AtspiAccessible *obj) * atspi_accessible_get_attributes: * @obj: The #AtspiAccessible being queried. * - * Gets the #AttributeSet representing any assigned + * Gets the #AttributeSet representing any assigned * name-value pair attributes or annotations for this object. * For typographic, textual, or textually-semantic attributes, see * atspi_text_get_attributes instead. @@ -745,24 +736,24 @@ atspi_accessible_get_attributes (AtspiAccessible *obj, GError **error) { DBusMessage *message; - g_return_val_if_fail (obj != NULL, NULL); + g_return_val_if_fail (obj != NULL, NULL); if (obj->priv->cache) - { - GValue *val = g_hash_table_lookup (obj->priv->cache, "Attributes"); - if (val) - return g_value_dup_boxed (val); - } + { + GValue *val = g_hash_table_lookup (obj->priv->cache, "Attributes"); + if (val) + return g_value_dup_boxed (val); + } if (!_atspi_accessible_test_cache (obj, ATSPI_CACHE_ATTRIBUTES)) - { - message = _atspi_dbus_call_partial (obj, atspi_interface_accessible, - "GetAttributes", error, ""); - g_clear_pointer (&(obj->attributes), g_hash_table_unref); + { + message = _atspi_dbus_call_partial (obj, atspi_interface_accessible, + "GetAttributes", error, ""); + g_clear_pointer (&(obj->attributes), g_hash_table_unref); - obj->attributes = _atspi_dbus_return_hash_from_message (message); - _atspi_accessible_add_cache (obj, ATSPI_CACHE_ATTRIBUTES); - } + obj->attributes = _atspi_dbus_return_hash_from_message (message); + _atspi_accessible_add_cache (obj, ATSPI_CACHE_ATTRIBUTES); + } if (!obj->attributes) return NULL; @@ -772,7 +763,7 @@ atspi_accessible_get_attributes (AtspiAccessible *obj, GError **error) static void add_to_attribute_array (gpointer key, gpointer value, gpointer data) { - GArray **array = (GArray **)data; + GArray **array = (GArray **) data; gchar *str = g_strconcat (key, ":", value, NULL); *array = g_array_append_val (*array, str); } @@ -781,7 +772,7 @@ add_to_attribute_array (gpointer key, gpointer value, gpointer data) * atspi_accessible_get_attributes_as_array: * @obj: The #AtspiAccessible being queried. * - * Gets a #GArray representing any assigned + * Gets a #GArray representing any assigned * name-value pair attributes or annotations for this object. * For typographic, textual, or textually-semantic attributes, see * atspi_text_get_attributes_as_array instead. @@ -794,19 +785,19 @@ atspi_accessible_get_attributes_as_array (AtspiAccessible *obj, GError **error) { DBusMessage *message; - g_return_val_if_fail (obj != NULL, NULL); + g_return_val_if_fail (obj != NULL, NULL); if (obj->priv->cache) - { - GValue *val = g_hash_table_lookup (obj->priv->cache, "Attributes"); - if (val) { - GArray *array = g_array_new (TRUE, TRUE, sizeof (gchar *)); - GHashTable *attributes = g_value_get_boxed (val); - g_hash_table_foreach (attributes, add_to_attribute_array, &array); - return array; + GValue *val = g_hash_table_lookup (obj->priv->cache, "Attributes"); + if (val) + { + GArray *array = g_array_new (TRUE, TRUE, sizeof (gchar *)); + GHashTable *attributes = g_value_get_boxed (val); + g_hash_table_foreach (attributes, add_to_attribute_array, &array); + return array; + } } - } message = _atspi_dbus_call_partial (obj, atspi_interface_accessible, "GetAttributes", error, ""); return _atspi_dbus_return_attribute_array_from_message (message); @@ -828,33 +819,33 @@ atspi_accessible_get_application (AtspiAccessible *obj, GError **error) g_object_ref (obj); for (;;) - { - parent = atspi_accessible_get_parent (obj, NULL); - if (!parent && obj->parent.app && - atspi_accessible_get_role (obj, NULL) != ATSPI_ROLE_APPLICATION) { - AtspiAccessible *root = g_object_ref (obj->parent.app->root); - if (root) - { - g_object_unref (obj); - if (atspi_accessible_get_role (root, NULL) == ATSPI_ROLE_DESKTOP_FRAME) + parent = atspi_accessible_get_parent (obj, NULL); + if (!parent && obj->parent.app && + atspi_accessible_get_role (obj, NULL) != ATSPI_ROLE_APPLICATION) { - g_object_unref (root); - return NULL; + AtspiAccessible *root = g_object_ref (obj->parent.app->root); + if (root) + { + g_object_unref (obj); + if (atspi_accessible_get_role (root, NULL) == ATSPI_ROLE_DESKTOP_FRAME) + { + g_object_unref (root); + return NULL; + } + return root; + } } - return root; - } + if (!parent || parent == obj || + atspi_accessible_get_role (parent, NULL) == ATSPI_ROLE_DESKTOP_FRAME) + { + if (parent) + g_object_unref (parent); + return obj; + } + g_object_unref (obj); + obj = parent; } - if (!parent || parent == obj || - atspi_accessible_get_role (parent, NULL) == ATSPI_ROLE_DESKTOP_FRAME) - { - if (parent) - g_object_unref (parent); - return obj; - } - g_object_unref (obj); - obj = parent; - } } /* Application-specific methods */ @@ -939,7 +930,7 @@ atspi_accessible_get_atspi_version (AtspiAccessible *obj, GError **error) * Gets the application id for a #AtspiAccessible object. * Only works on application root objects. * - * Returns: a positive #gint indicating the id for the #AtspiAccessible object + * Returns: a positive #gint indicating the id for the #AtspiAccessible object * or -1 on exception. **/ gint @@ -950,16 +941,15 @@ atspi_accessible_get_id (AtspiAccessible *obj, GError **error) g_return_val_if_fail (obj != NULL, -1); if (!_atspi_dbus_get_property (obj, atspi_interface_application, "Id", error, "i", &ret)) - return -1; + return -1; return ret; } - /* Interface query methods */ static gboolean _atspi_accessible_is_a (AtspiAccessible *accessible, - const char *interface_name) + const char *interface_name) { int n; @@ -969,27 +959,28 @@ _atspi_accessible_is_a (AtspiAccessible *accessible, } if (!_atspi_accessible_test_cache (accessible, ATSPI_CACHE_INTERFACES)) - { - DBusMessage *reply; - DBusMessageIter iter; - reply = _atspi_dbus_call_partial (accessible, atspi_interface_accessible, - "GetInterfaces", NULL, ""); - _ATSPI_DBUS_CHECK_SIG (reply, "as", NULL, FALSE); - dbus_message_iter_init (reply, &iter); - _atspi_dbus_set_interfaces (accessible, &iter); - dbus_message_unref (reply); - } + { + DBusMessage *reply; + DBusMessageIter iter; + reply = _atspi_dbus_call_partial (accessible, atspi_interface_accessible, + "GetInterfaces", NULL, ""); + _ATSPI_DBUS_CHECK_SIG (reply, "as", NULL, FALSE); + dbus_message_iter_init (reply, &iter); + _atspi_dbus_set_interfaces (accessible, &iter); + dbus_message_unref (reply); + } n = _atspi_get_iface_num (interface_name); - if (n == -1) return FALSE; - return (gboolean) ((accessible->interfaces & (1 << n))? TRUE: FALSE); + if (n == -1) + return FALSE; + return (gboolean) ((accessible->interfaces & (1 << n)) ? TRUE : FALSE); } /** * atspi_accessible_is_action: * @obj: a pointer to the #AtspiAccessible instance to query. * - * Query whether the specified #AtspiAccessible implements the + * Query whether the specified #AtspiAccessible implements the * #AtspiAction interface. * * Returns: #TRUE if @obj implements the #AtspiAction interface, @@ -999,7 +990,7 @@ gboolean atspi_accessible_is_action (AtspiAccessible *obj) { return _atspi_accessible_is_a (obj, - atspi_interface_action); + atspi_interface_action); } /** @@ -1016,10 +1007,10 @@ gboolean atspi_accessible_is_application (AtspiAccessible *obj) { return _atspi_accessible_is_a (obj, - atspi_interface_application); + atspi_interface_application); } -/** +/** * atspi_accessible_is_collection: * @obj: a pointer to the #AtspiAccessible instance to query. * @@ -1032,8 +1023,8 @@ atspi_accessible_is_application (AtspiAccessible *obj) gboolean atspi_accessible_is_collection (AtspiAccessible *obj) { - return _atspi_accessible_is_a (obj, - atspi_interface_collection); + return _atspi_accessible_is_a (obj, + atspi_interface_collection); } /** @@ -1049,7 +1040,7 @@ gboolean atspi_accessible_is_component (AtspiAccessible *obj) { return _atspi_accessible_is_a (obj, - atspi_interface_component); + atspi_interface_component); } /** @@ -1066,7 +1057,7 @@ gboolean atspi_accessible_is_document (AtspiAccessible *obj) { return _atspi_accessible_is_a (obj, - atspi_interface_document); + atspi_interface_document); } /** @@ -1083,9 +1074,9 @@ gboolean atspi_accessible_is_editable_text (AtspiAccessible *obj) { return _atspi_accessible_is_a (obj, - atspi_interface_editable_text); + atspi_interface_editable_text); } - + /** * atspi_accessible_is_hypertext: * @obj: a pointer to the #AtspiAccessible instance to query. @@ -1100,14 +1091,14 @@ gboolean atspi_accessible_is_hypertext (AtspiAccessible *obj) { return _atspi_accessible_is_a (obj, - atspi_interface_hypertext); + atspi_interface_hypertext); } /** * atspi_accessible_is_hyperlink: * @obj: a pointer to the #AtspiAccessible instance to query. * - * Query whether the specified #AtspiAccessible implements the + * Query whether the specified #AtspiAccessible implements the * #AtspiHyperlink interface. * * Returns: #TRUE if @obj implements the #AtspiHypertext interface, @@ -1117,7 +1108,7 @@ gboolean atspi_accessible_is_hyperlink (AtspiAccessible *obj) { return _atspi_accessible_is_a (obj, - atspi_interface_hyperlink); + atspi_interface_hyperlink); } /** @@ -1129,12 +1120,12 @@ atspi_accessible_is_hyperlink (AtspiAccessible *obj) * * Returns: #TRUE if @obj implements the #AtspiImage interface, * #FALSE otherwise. -**/ + **/ gboolean atspi_accessible_is_image (AtspiAccessible *obj) { return _atspi_accessible_is_a (obj, - atspi_interface_image); + atspi_interface_image); } /** @@ -1146,12 +1137,12 @@ atspi_accessible_is_image (AtspiAccessible *obj) * * Returns: #TRUE if @obj implements the #AtspiSelection interface, * #FALSE otherwise. -**/ + **/ gboolean atspi_accessible_is_selection (AtspiAccessible *obj) { return _atspi_accessible_is_a (obj, - atspi_interface_selection); + atspi_interface_selection); } /** @@ -1163,12 +1154,12 @@ atspi_accessible_is_selection (AtspiAccessible *obj) * * Returns: #TRUE if @obj implements the #AtspiTable interface, * #FALSE otherwise. -**/ + **/ gboolean atspi_accessible_is_table (AtspiAccessible *obj) { return _atspi_accessible_is_a (obj, - atspi_interface_table); + atspi_interface_table); } /** @@ -1180,12 +1171,12 @@ atspi_accessible_is_table (AtspiAccessible *obj) * * Returns: #TRUE if @obj implements the #AtspiTable interface, * #FALSE otherwise. -**/ + **/ gboolean atspi_accessible_is_table_cell (AtspiAccessible *obj) { return _atspi_accessible_is_a (obj, - atspi_interface_table_cell); + atspi_interface_table_cell); } /** @@ -1197,7 +1188,7 @@ atspi_accessible_is_table_cell (AtspiAccessible *obj) * * Returns: #TRUE if @obj implements the #AtspiStreamableContent interface, * #FALSE otherwise. -**/ + **/ gboolean atspi_accessible_is_streamable_content (AtspiAccessible *obj) { @@ -1214,17 +1205,17 @@ atspi_accessible_is_streamable_content (AtspiAccessible *obj) * atspi_accessible_is_text: * @obj: a pointer to the #AtspiAccessible instance to query. * - * Query whether the specified #AtspiAccessible implements the + * Query whether the specified #AtspiAccessible implements the * #AtspiText interface. * * Returns: #TRUE if @obj implements the #AtspiText interface, * #FALSE otherwise. -**/ + **/ gboolean atspi_accessible_is_text (AtspiAccessible *obj) { return _atspi_accessible_is_a (obj, - atspi_interface_text); + atspi_interface_text); } /** @@ -1236,12 +1227,12 @@ atspi_accessible_is_text (AtspiAccessible *obj) * * Returns: #TRUE if @obj implements the #AtspiValue interface, * #FALSE otherwise. -**/ + **/ gboolean atspi_accessible_is_value (AtspiAccessible *obj) { return _atspi_accessible_is_a (obj, - atspi_interface_value); + atspi_interface_value); } /** @@ -1258,8 +1249,7 @@ atspi_accessible_is_value (AtspiAccessible *obj) AtspiAction * atspi_accessible_get_action (AtspiAccessible *accessible) { - return (_atspi_accessible_is_a (accessible, atspi_interface_action) ? - g_object_ref (ATSPI_ACTION (accessible)) : NULL); + return (_atspi_accessible_is_a (accessible, atspi_interface_action) ? g_object_ref (ATSPI_ACTION (accessible)) : NULL); } /** @@ -1274,8 +1264,7 @@ atspi_accessible_get_action (AtspiAccessible *accessible) AtspiAction * atspi_accessible_get_action_iface (AtspiAccessible *accessible) { - return (_atspi_accessible_is_a (accessible, atspi_interface_action) ? - g_object_ref (ATSPI_ACTION (accessible)) : NULL); + return (_atspi_accessible_is_a (accessible, atspi_interface_action) ? g_object_ref (ATSPI_ACTION (accessible)) : NULL); } /** @@ -1292,8 +1281,7 @@ atspi_accessible_get_action_iface (AtspiAccessible *accessible) AtspiCollection * atspi_accessible_get_collection (AtspiAccessible *accessible) { - return (_atspi_accessible_is_a (accessible, atspi_interface_collection) ? - g_object_ref (ATSPI_COLLECTION (accessible)) : NULL); + return (_atspi_accessible_is_a (accessible, atspi_interface_collection) ? g_object_ref (ATSPI_COLLECTION (accessible)) : NULL); } /** @@ -1308,8 +1296,7 @@ atspi_accessible_get_collection (AtspiAccessible *accessible) AtspiCollection * atspi_accessible_get_collection_iface (AtspiAccessible *accessible) { - return (_atspi_accessible_is_a (accessible, atspi_interface_collection) ? - g_object_ref (ATSPI_COLLECTION (accessible)) : NULL); + return (_atspi_accessible_is_a (accessible, atspi_interface_collection) ? g_object_ref (ATSPI_COLLECTION (accessible)) : NULL); } /** @@ -1326,8 +1313,7 @@ atspi_accessible_get_collection_iface (AtspiAccessible *accessible) AtspiComponent * atspi_accessible_get_component (AtspiAccessible *obj) { - return (_atspi_accessible_is_a (obj, atspi_interface_component) ? - g_object_ref (ATSPI_COMPONENT (obj)) : NULL); + return (_atspi_accessible_is_a (obj, atspi_interface_component) ? g_object_ref (ATSPI_COMPONENT (obj)) : NULL); } /** @@ -1342,8 +1328,7 @@ atspi_accessible_get_component (AtspiAccessible *obj) AtspiComponent * atspi_accessible_get_component_iface (AtspiAccessible *obj) { - return (_atspi_accessible_is_a (obj, atspi_interface_component) ? - g_object_ref (ATSPI_COMPONENT (obj)) : NULL); + return (_atspi_accessible_is_a (obj, atspi_interface_component) ? g_object_ref (ATSPI_COMPONENT (obj)) : NULL); } /** @@ -1360,8 +1345,7 @@ atspi_accessible_get_component_iface (AtspiAccessible *obj) AtspiDocument * atspi_accessible_get_document (AtspiAccessible *accessible) { - return (_atspi_accessible_is_a (accessible, atspi_interface_document) ? - g_object_ref (ATSPI_DOCUMENT (accessible)) : NULL); + return (_atspi_accessible_is_a (accessible, atspi_interface_document) ? g_object_ref (ATSPI_DOCUMENT (accessible)) : NULL); } /** @@ -1376,8 +1360,7 @@ atspi_accessible_get_document (AtspiAccessible *accessible) AtspiDocument * atspi_accessible_get_document_iface (AtspiAccessible *accessible) { - return (_atspi_accessible_is_a (accessible, atspi_interface_document) ? - g_object_ref (ATSPI_DOCUMENT (accessible)) : NULL); + return (_atspi_accessible_is_a (accessible, atspi_interface_document) ? g_object_ref (ATSPI_DOCUMENT (accessible)) : NULL); } /** @@ -1394,8 +1377,7 @@ atspi_accessible_get_document_iface (AtspiAccessible *accessible) AtspiEditableText * atspi_accessible_get_editable_text (AtspiAccessible *accessible) { - return (_atspi_accessible_is_a (accessible, atspi_interface_editable_text) ? - g_object_ref (ATSPI_EDITABLE_TEXT (accessible)) : NULL); + return (_atspi_accessible_is_a (accessible, atspi_interface_editable_text) ? g_object_ref (ATSPI_EDITABLE_TEXT (accessible)) : NULL); } /** @@ -1410,8 +1392,7 @@ atspi_accessible_get_editable_text (AtspiAccessible *accessible) AtspiEditableText * atspi_accessible_get_editable_text_iface (AtspiAccessible *accessible) { - return (_atspi_accessible_is_a (accessible, atspi_interface_editable_text) ? - g_object_ref (ATSPI_EDITABLE_TEXT (accessible)) : NULL); + return (_atspi_accessible_is_a (accessible, atspi_interface_editable_text) ? g_object_ref (ATSPI_EDITABLE_TEXT (accessible)) : NULL); } /** @@ -1426,8 +1407,7 @@ atspi_accessible_get_editable_text_iface (AtspiAccessible *accessible) AtspiHyperlink * atspi_accessible_get_hyperlink (AtspiAccessible *accessible) { - return (_atspi_accessible_is_a (accessible, atspi_interface_hyperlink) ? - _atspi_hyperlink_new (accessible->parent.app, accessible->parent.path) : NULL); + return (_atspi_accessible_is_a (accessible, atspi_interface_hyperlink) ? _atspi_hyperlink_new (accessible->parent.app, accessible->parent.path) : NULL); } /** @@ -1444,8 +1424,7 @@ atspi_accessible_get_hyperlink (AtspiAccessible *accessible) AtspiHypertext * atspi_accessible_get_hypertext (AtspiAccessible *accessible) { - return (_atspi_accessible_is_a (accessible, atspi_interface_hypertext) ? - g_object_ref (ATSPI_HYPERTEXT (accessible)) : NULL); + return (_atspi_accessible_is_a (accessible, atspi_interface_hypertext) ? g_object_ref (ATSPI_HYPERTEXT (accessible)) : NULL); } /** @@ -1460,8 +1439,7 @@ atspi_accessible_get_hypertext (AtspiAccessible *accessible) AtspiHypertext * atspi_accessible_get_hypertext_iface (AtspiAccessible *accessible) { - return (_atspi_accessible_is_a (accessible, atspi_interface_hypertext) ? - g_object_ref (ATSPI_HYPERTEXT (accessible)) : NULL); + return (_atspi_accessible_is_a (accessible, atspi_interface_hypertext) ? g_object_ref (ATSPI_HYPERTEXT (accessible)) : NULL); } /** @@ -1478,8 +1456,7 @@ atspi_accessible_get_hypertext_iface (AtspiAccessible *accessible) AtspiImage * atspi_accessible_get_image (AtspiAccessible *accessible) { - return (_atspi_accessible_is_a (accessible, atspi_interface_image) ? - g_object_ref (ATSPI_IMAGE (accessible)) : NULL); + return (_atspi_accessible_is_a (accessible, atspi_interface_image) ? g_object_ref (ATSPI_IMAGE (accessible)) : NULL); } /** @@ -1494,8 +1471,7 @@ atspi_accessible_get_image (AtspiAccessible *accessible) AtspiImage * atspi_accessible_get_image_iface (AtspiAccessible *accessible) { - return (_atspi_accessible_is_a (accessible, atspi_interface_image) ? - g_object_ref (ATSPI_IMAGE (accessible)) : NULL); + return (_atspi_accessible_is_a (accessible, atspi_interface_image) ? g_object_ref (ATSPI_IMAGE (accessible)) : NULL); } /** @@ -1512,8 +1488,7 @@ atspi_accessible_get_image_iface (AtspiAccessible *accessible) AtspiSelection * atspi_accessible_get_selection (AtspiAccessible *accessible) { - return (_atspi_accessible_is_a (accessible, atspi_interface_selection) ? - g_object_ref (ATSPI_SELECTION (accessible)) : NULL); + return (_atspi_accessible_is_a (accessible, atspi_interface_selection) ? g_object_ref (ATSPI_SELECTION (accessible)) : NULL); } /** @@ -1528,8 +1503,7 @@ atspi_accessible_get_selection (AtspiAccessible *accessible) AtspiSelection * atspi_accessible_get_selection_iface (AtspiAccessible *accessible) { - return (_atspi_accessible_is_a (accessible, atspi_interface_selection) ? - g_object_ref (ATSPI_SELECTION (accessible)) : NULL); + return (_atspi_accessible_is_a (accessible, atspi_interface_selection) ? g_object_ref (ATSPI_SELECTION (accessible)) : NULL); } #if 0 @@ -1564,8 +1538,7 @@ atspi_accessible_get_streamable_content (AtspiAccessible *accessible) AtspiTable * atspi_accessible_get_table (AtspiAccessible *obj) { - return (_atspi_accessible_is_a (obj, atspi_interface_table) ? - g_object_ref (ATSPI_TABLE (obj)) : NULL); + return (_atspi_accessible_is_a (obj, atspi_interface_table) ? g_object_ref (ATSPI_TABLE (obj)) : NULL); } /** @@ -1580,8 +1553,7 @@ atspi_accessible_get_table (AtspiAccessible *obj) AtspiTable * atspi_accessible_get_table_iface (AtspiAccessible *obj) { - return (_atspi_accessible_is_a (obj, atspi_interface_table) ? - g_object_ref (ATSPI_TABLE (obj)) : NULL); + return (_atspi_accessible_is_a (obj, atspi_interface_table) ? g_object_ref (ATSPI_TABLE (obj)) : NULL); } /** @@ -1596,8 +1568,7 @@ atspi_accessible_get_table_iface (AtspiAccessible *obj) AtspiTableCell * atspi_accessible_get_table_cell (AtspiAccessible *obj) { - return (_atspi_accessible_is_a (obj, atspi_interface_table_cell) ? - g_object_ref (ATSPI_TABLE_CELL (obj)) : NULL); + return (_atspi_accessible_is_a (obj, atspi_interface_table_cell) ? g_object_ref (ATSPI_TABLE_CELL (obj)) : NULL); } /** @@ -1614,8 +1585,7 @@ atspi_accessible_get_table_cell (AtspiAccessible *obj) AtspiText * atspi_accessible_get_text (AtspiAccessible *obj) { - return (_atspi_accessible_is_a (obj, atspi_interface_text) ? - g_object_ref (ATSPI_TEXT (obj)) : NULL); + return (_atspi_accessible_is_a (obj, atspi_interface_text) ? g_object_ref (ATSPI_TEXT (obj)) : NULL); } /** @@ -1630,8 +1600,7 @@ atspi_accessible_get_text (AtspiAccessible *obj) AtspiText * atspi_accessible_get_text_iface (AtspiAccessible *obj) { - return (_atspi_accessible_is_a (obj, atspi_interface_text) ? - g_object_ref (ATSPI_TEXT (obj)) : NULL); + return (_atspi_accessible_is_a (obj, atspi_interface_text) ? g_object_ref (ATSPI_TEXT (obj)) : NULL); } /** @@ -1648,8 +1617,7 @@ atspi_accessible_get_text_iface (AtspiAccessible *obj) AtspiValue * atspi_accessible_get_value (AtspiAccessible *accessible) { - return (_atspi_accessible_is_a (accessible, atspi_interface_value) ? - g_object_ref (ATSPI_VALUE (accessible)) : NULL); + return (_atspi_accessible_is_a (accessible, atspi_interface_value) ? g_object_ref (ATSPI_VALUE (accessible)) : NULL); } /** @@ -1664,8 +1632,7 @@ atspi_accessible_get_value (AtspiAccessible *accessible) AtspiValue * atspi_accessible_get_value_iface (AtspiAccessible *accessible) { - return (_atspi_accessible_is_a (accessible, atspi_interface_value) ? - g_object_ref (ATSPI_VALUE (accessible)) : NULL); + return (_atspi_accessible_is_a (accessible, atspi_interface_value) ? g_object_ref (ATSPI_VALUE (accessible)) : NULL); } static void @@ -1725,11 +1692,11 @@ atspi_accessible_get_interfaces (AtspiAccessible *obj) return ret; } -AtspiAccessible * +AtspiAccessible * _atspi_accessible_new (AtspiApplication *app, const gchar *path) { AtspiAccessible *accessible; - + accessible = g_object_new (ATSPI_TYPE_ACCESSIBLE, NULL); g_return_val_if_fail (accessible != NULL, NULL); @@ -1776,12 +1743,12 @@ atspi_accessible_clear_cache (AtspiAccessible *obj) gint i; if (obj) - { - obj->cached_properties = ATSPI_CACHE_NONE; - if (obj->children) - for (i = 0; i < obj->children->len; i++) - atspi_accessible_clear_cache (g_ptr_array_index (obj->children, i)); - } + { + obj->cached_properties = ATSPI_CACHE_NONE; + if (obj->children) + for (i = 0; i < obj->children->len; i++) + atspi_accessible_clear_cache (g_ptr_array_index (obj->children, i)); + } } /** @@ -1805,7 +1772,7 @@ atspi_accessible_get_process_id (AtspiAccessible *accessible, GError **error) if (!accessible->parent.app || !accessible->parent.app->bus_name) { - g_set_error_literal(error, ATSPI_ERROR, ATSPI_ERROR_IPC, "Process is defunct"); + g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_IPC, "Process is defunct"); return -1; } @@ -1820,14 +1787,14 @@ atspi_accessible_get_process_id (AtspiAccessible *accessible, GError **error) reply = dbus_connection_send_with_reply_and_block (bus, message, -1, &d_error); dbus_message_unref (message); if (reply) - { - if (!strcmp (dbus_message_get_signature (reply), "u")) - dbus_message_get_args (reply, NULL, DBUS_TYPE_UINT32, &pid, DBUS_TYPE_INVALID); - dbus_message_unref (reply); - } + { + if (!strcmp (dbus_message_get_signature (reply), "u")) + dbus_message_get_args (reply, NULL, DBUS_TYPE_UINT32, &pid, DBUS_TYPE_INVALID); + dbus_message_unref (reply); + } if (dbus_error_is_set (&d_error)) { - g_set_error_literal(error, ATSPI_ERROR, ATSPI_ERROR_IPC, "Process is defunct"); + g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_IPC, "Process is defunct"); dbus_error_free (&d_error); } return pid; @@ -1841,15 +1808,15 @@ _atspi_accessible_get_cache_mask (AtspiAccessible *accessible) if (!accessible->parent.app) return ATSPI_CACHE_NONE; - mask = accessible->parent.app->cache; + mask = accessible->parent.app->cache; if (mask == ATSPI_CACHE_UNDEFINED && accessible->parent.app->root && accessible->parent.app->root->accessible_parent) - { - AtspiAccessible *desktop = atspi_get_desktop (0); - mask = desktop->parent.app->cache; - g_object_unref (desktop); - } + { + AtspiAccessible *desktop = atspi_get_desktop (0); + mask = desktop->parent.app->cache; + g_object_unref (desktop); + } if (mask == ATSPI_CACHE_UNDEFINED) mask = ATSPI_CACHE_DEFAULT; @@ -1864,8 +1831,7 @@ _atspi_accessible_test_cache (AtspiAccessible *accessible, AtspiCache flag) AtspiCache result = accessible->cached_properties & mask & flag; if (accessible->states && atspi_state_set_contains (accessible->states, ATSPI_STATE_TRANSIENT)) return FALSE; - return (result != 0 && (atspi_main_loop || enable_caching || - flag == ATSPI_CACHE_INTERFACES) && + return (result != 0 && (atspi_main_loop || enable_caching || flag == ATSPI_CACHE_INTERFACES) && !atspi_no_cache); } @@ -1889,7 +1855,7 @@ _atspi_accessible_add_cache (AtspiAccessible *accessible, AtspiCache flag) * Returns: a UTF-8 string indicating the POSIX-style LC_MESSAGES * locale of @accessible. **/ -const gchar* +const gchar * atspi_accessible_get_object_locale (AtspiAccessible *accessible, GError **error) { gchar *locale; @@ -1898,14 +1864,14 @@ atspi_accessible_get_object_locale (AtspiAccessible *accessible, GError **error) locale = g_object_get_qdata (G_OBJECT (accessible), quark_locale); if (!locale) - { - if (!_atspi_dbus_get_property (accessible, atspi_interface_accessible, - "Locale", error, "s", &locale)) - return NULL; - if (locale) - g_object_set_qdata_full (G_OBJECT (accessible), quark_locale, locale, - g_free); - } + { + if (!_atspi_dbus_get_property (accessible, atspi_interface_accessible, + "Locale", error, "s", &locale)) + return NULL; + if (locale) + g_object_set_qdata_full (G_OBJECT (accessible), quark_locale, locale, + g_free); + } return locale; } @@ -1922,7 +1888,7 @@ atspi_accessible_get_object_locale (AtspiAccessible *accessible, GError **error) * Returns: a character string representing the accessible id of the * #AtspiAccessible object or NULL on exception. **/ -gchar* +gchar * atspi_accessible_get_accessible_id (AtspiAccessible *obj, GError **error) { gchar *accessible_id; @@ -1930,7 +1896,7 @@ atspi_accessible_get_accessible_id (AtspiAccessible *obj, GError **error) g_return_val_if_fail (obj != NULL, NULL); if (!_atspi_dbus_get_property (obj, atspi_interface_accessible, - "AccessibleId", error, "s", &accessible_id)) + "AccessibleId", error, "s", &accessible_id)) return NULL; return accessible_id; @@ -1964,9 +1930,9 @@ _atspi_accessible_unref_cache (AtspiAccessible *accessible) AtspiAccessiblePrivate *priv = accessible->priv; if (priv->cache) - { - g_hash_table_unref (priv->cache); - if (--priv->cache_ref_count == 0) - priv->cache = NULL; - } + { + g_hash_table_unref (priv->cache); + if (--priv->cache_ref_count == 0) + priv->cache = NULL; + } } diff --git a/atspi/atspi-accessible.h b/atspi/atspi-accessible.h index 35c0d5b2..6d35ee84 100644 --- a/atspi/atspi-accessible.h +++ b/atspi/atspi-accessible.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -36,12 +36,12 @@ G_BEGIN_DECLS #include "atspi-stateset.h" #include "atspi-types.h" -#define ATSPI_TYPE_ACCESSIBLE (atspi_accessible_get_type ()) -#define ATSPI_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_ACCESSIBLE, AtspiAccessible)) -#define ATSPI_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_ACCESSIBLE, AtspiAccessibleClass)) -#define ATSPI_IS_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_ACCESSIBLE)) -#define ATSPI_IS_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_ACCESSIBLE)) -#define ATSPI_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_ACCESSIBLE, AtspiAccessibleClass)) +#define ATSPI_TYPE_ACCESSIBLE (atspi_accessible_get_type ()) +#define ATSPI_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_ACCESSIBLE, AtspiAccessible)) +#define ATSPI_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_ACCESSIBLE, AtspiAccessibleClass)) +#define ATSPI_IS_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_ACCESSIBLE)) +#define ATSPI_IS_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_ACCESSIBLE)) +#define ATSPI_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_ACCESSIBLE, AtspiAccessibleClass)) typedef struct _AtspiAccessiblePrivate AtspiAccessiblePrivate; @@ -69,100 +69,100 @@ struct _AtspiAccessibleClass void (*mode_changed) (AtspiAccessible *accessible, gboolean enabled); }; -GType atspi_accessible_get_type (void); +GType atspi_accessible_get_type (void); AtspiAccessible * _atspi_accessible_new (AtspiApplication *app, const gchar *path); -gchar * atspi_accessible_get_name (AtspiAccessible *obj, GError **error); +gchar *atspi_accessible_get_name (AtspiAccessible *obj, GError **error); -gchar * atspi_accessible_get_description (AtspiAccessible *obj, GError **error); +gchar *atspi_accessible_get_description (AtspiAccessible *obj, GError **error); -AtspiAccessible * atspi_accessible_get_parent (AtspiAccessible *obj, GError **error); +AtspiAccessible *atspi_accessible_get_parent (AtspiAccessible *obj, GError **error); gint atspi_accessible_get_child_count (AtspiAccessible *obj, GError **error); -AtspiAccessible * atspi_accessible_get_child_at_index (AtspiAccessible *obj, gint child_index, GError **error); +AtspiAccessible *atspi_accessible_get_child_at_index (AtspiAccessible *obj, gint child_index, GError **error); gint atspi_accessible_get_index_in_parent (AtspiAccessible *obj, GError **error); -GArray * atspi_accessible_get_relation_set (AtspiAccessible *obj, GError **error); +GArray *atspi_accessible_get_relation_set (AtspiAccessible *obj, GError **error); AtspiRole atspi_accessible_get_role (AtspiAccessible *obj, GError **error); -gchar * atspi_accessible_get_role_name (AtspiAccessible *obj, GError **error); +gchar *atspi_accessible_get_role_name (AtspiAccessible *obj, GError **error); -gchar * atspi_accessible_get_localized_role_name (AtspiAccessible *obj, GError **error); +gchar *atspi_accessible_get_localized_role_name (AtspiAccessible *obj, GError **error); -AtspiStateSet * atspi_accessible_get_state_set (AtspiAccessible *obj); +AtspiStateSet *atspi_accessible_get_state_set (AtspiAccessible *obj); -GHashTable * atspi_accessible_get_attributes (AtspiAccessible *obj, GError **error); +GHashTable *atspi_accessible_get_attributes (AtspiAccessible *obj, GError **error); -GArray * atspi_accessible_get_attributes_as_array (AtspiAccessible *obj, GError **error); +GArray *atspi_accessible_get_attributes_as_array (AtspiAccessible *obj, GError **error); -gchar * atspi_accessible_get_toolkit_name (AtspiAccessible *obj, GError **error); +gchar *atspi_accessible_get_toolkit_name (AtspiAccessible *obj, GError **error); -gchar * atspi_accessible_get_toolkit_version (AtspiAccessible *obj, GError **error); +gchar *atspi_accessible_get_toolkit_version (AtspiAccessible *obj, GError **error); -gchar * atspi_accessible_get_atspi_version (AtspiAccessible *obj, GError **error); +gchar *atspi_accessible_get_atspi_version (AtspiAccessible *obj, GError **error); gint atspi_accessible_get_id (AtspiAccessible *obj, GError **error); -AtspiAccessible * atspi_accessible_get_application (AtspiAccessible *obj, GError **error); +AtspiAccessible *atspi_accessible_get_application (AtspiAccessible *obj, GError **error); #ifndef ATSPI_DISABLE_DEPRECATED -AtspiAction * atspi_accessible_get_action (AtspiAccessible *obj); +AtspiAction *atspi_accessible_get_action (AtspiAccessible *obj); -AtspiCollection * atspi_accessible_get_collection (AtspiAccessible *obj); +AtspiCollection *atspi_accessible_get_collection (AtspiAccessible *obj); -AtspiComponent * atspi_accessible_get_component (AtspiAccessible *obj); +AtspiComponent *atspi_accessible_get_component (AtspiAccessible *obj); -AtspiDocument * atspi_accessible_get_document (AtspiAccessible *obj); +AtspiDocument *atspi_accessible_get_document (AtspiAccessible *obj); -AtspiEditableText * atspi_accessible_get_editable_text (AtspiAccessible *obj); +AtspiEditableText *atspi_accessible_get_editable_text (AtspiAccessible *obj); -AtspiHyperlink * atspi_accessible_get_hyperlink (AtspiAccessible *obj); +AtspiHyperlink *atspi_accessible_get_hyperlink (AtspiAccessible *obj); -AtspiHypertext * atspi_accessible_get_hypertext (AtspiAccessible *obj); +AtspiHypertext *atspi_accessible_get_hypertext (AtspiAccessible *obj); -AtspiImage * atspi_accessible_get_image (AtspiAccessible *obj); +AtspiImage *atspi_accessible_get_image (AtspiAccessible *obj); -AtspiSelection * atspi_accessible_get_selection (AtspiAccessible *obj); +AtspiSelection *atspi_accessible_get_selection (AtspiAccessible *obj); -AtspiTable * atspi_accessible_get_table (AtspiAccessible *obj); +AtspiTable *atspi_accessible_get_table (AtspiAccessible *obj); -AtspiTableCell * atspi_accessible_get_table_cell (AtspiAccessible *obj); +AtspiTableCell *atspi_accessible_get_table_cell (AtspiAccessible *obj); -AtspiText * atspi_accessible_get_text (AtspiAccessible *obj); +AtspiText *atspi_accessible_get_text (AtspiAccessible *obj); -AtspiValue * atspi_accessible_get_value (AtspiAccessible *obj); +AtspiValue *atspi_accessible_get_value (AtspiAccessible *obj); #endif -AtspiAction * atspi_accessible_get_action_iface (AtspiAccessible *obj); +AtspiAction *atspi_accessible_get_action_iface (AtspiAccessible *obj); -AtspiCollection * atspi_accessible_get_collection_iface (AtspiAccessible *obj); +AtspiCollection *atspi_accessible_get_collection_iface (AtspiAccessible *obj); -AtspiComponent * atspi_accessible_get_component_iface (AtspiAccessible *obj); +AtspiComponent *atspi_accessible_get_component_iface (AtspiAccessible *obj); -AtspiDocument * atspi_accessible_get_document_iface (AtspiAccessible *obj); +AtspiDocument *atspi_accessible_get_document_iface (AtspiAccessible *obj); -AtspiEditableText * atspi_accessible_get_editable_text_iface (AtspiAccessible *obj); +AtspiEditableText *atspi_accessible_get_editable_text_iface (AtspiAccessible *obj); -AtspiHypertext * atspi_accessible_get_hypertext_iface (AtspiAccessible *obj); +AtspiHypertext *atspi_accessible_get_hypertext_iface (AtspiAccessible *obj); -AtspiImage * atspi_accessible_get_image_iface (AtspiAccessible *obj); +AtspiImage *atspi_accessible_get_image_iface (AtspiAccessible *obj); -AtspiSelection * atspi_accessible_get_selection_iface (AtspiAccessible *obj); +AtspiSelection *atspi_accessible_get_selection_iface (AtspiAccessible *obj); -AtspiTable * atspi_accessible_get_table_iface (AtspiAccessible *obj); +AtspiTable *atspi_accessible_get_table_iface (AtspiAccessible *obj); -AtspiText * atspi_accessible_get_text_iface (AtspiAccessible *obj); +AtspiText *atspi_accessible_get_text_iface (AtspiAccessible *obj); -AtspiValue * atspi_accessible_get_value_iface (AtspiAccessible *obj); +AtspiValue *atspi_accessible_get_value_iface (AtspiAccessible *obj); -GArray * atspi_accessible_get_interfaces (AtspiAccessible *obj); +GArray *atspi_accessible_get_interfaces (AtspiAccessible *obj); -const gchar* atspi_accessible_get_object_locale (AtspiAccessible *accessible, GError **error); +const gchar *atspi_accessible_get_object_locale (AtspiAccessible *accessible, GError **error); void atspi_accessible_set_cache_mask (AtspiAccessible *accessible, AtspiCache mask); @@ -170,7 +170,7 @@ void atspi_accessible_clear_cache (AtspiAccessible *obj); guint atspi_accessible_get_process_id (AtspiAccessible *accessible, GError **error); -gchar * atspi_accessible_get_accessible_id (AtspiAccessible *obj, GError **error); +gchar *atspi_accessible_get_accessible_id (AtspiAccessible *obj, GError **error); /* private */ void _atspi_accessible_add_cache (AtspiAccessible *accessible, AtspiCache flag); @@ -179,4 +179,4 @@ gboolean _atspi_accessible_test_cache (AtspiAccessible *accessible, AtspiCache f G_END_DECLS -#endif /* _ATSPI_ACCESSIBLE_H_ */ +#endif /* _ATSPI_ACCESSIBLE_H_ */ diff --git a/atspi/atspi-action.c b/atspi/atspi-action.c index bc9cb7b7..fee13f03 100644 --- a/atspi/atspi-action.c +++ b/atspi/atspi-action.c @@ -95,7 +95,7 @@ atspi_action_get_action_description (AtspiAction *obj, int i, GError **error) * there are multiple parts to a keybinding string (typically 3). * They are delimited with ";". The first is the action's * keybinding which is usable if the object implementing the action - * is currently posted to the screen, e.g. if a menu is posted + * is currently posted to the screen, e.g. if a menu is posted * then these keybindings for the corresponding menu-items are * available. The second keybinding substring is the full key sequence * necessary to post the action's widget and activate it, e.g. for @@ -104,11 +104,11 @@ atspi_action_get_action_description (AtspiAction *obj, int i, GError **error) * during the lifetime of the containing toplevel window as a whole, * whereas the first keybinding string only works while the object * implementing AtkAction is posted. The third (and optional) - * keybinding string is the "keyboard shortcut" which invokes the - * action without posting any menus. + * keybinding string is the "keyboard shortcut" which invokes the + * action without posting any menus. * Meta-keys are indicated by the conventional strings * "<Control>", "<Alt>", "<Shift>", "<Mod2>", - * etc. (we use the same string as gtk_accelerator_name() in + * etc. (we use the same string as gtk_accelerator_name() in * gtk+-2.X. * * Returns: a UTF-8 string which can be parsed to determine the @i-th @@ -224,16 +224,15 @@ atspi_action_get_type (void) { static GType type = 0; - if (!type) { - static const GTypeInfo tinfo = + if (!type) { - sizeof (AtspiAction), - (GBaseInitFunc) atspi_action_base_init, - (GBaseFinalizeFunc) NULL, - }; - - type = g_type_register_static (G_TYPE_INTERFACE, "AtspiAction", &tinfo, 0); - - } + static const GTypeInfo tinfo = { + sizeof (AtspiAction), + (GBaseInitFunc) atspi_action_base_init, + (GBaseFinalizeFunc) NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiAction", &tinfo, 0); + } return type; } diff --git a/atspi/atspi-action.h b/atspi/atspi-action.h index e1056e7b..2f6501c4 100644 --- a/atspi/atspi-action.h +++ b/atspi/atspi-action.h @@ -4,7 +4,7 @@ * * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -33,10 +33,10 @@ G_BEGIN_DECLS -#define ATSPI_TYPE_ACTION (atspi_action_get_type ()) -#define ATSPI_IS_ACTION(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_ACTION) -#define ATSPI_ACTION(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_ACTION, AtspiAction) -#define ATSPI_ACTION_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_ACTION, AtspiAction)) +#define ATSPI_TYPE_ACTION (atspi_action_get_type ()) +#define ATSPI_IS_ACTION(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_ACTION) +#define ATSPI_ACTION(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_ACTION, AtspiAction) +#define ATSPI_ACTION_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_ACTION, AtspiAction)) GType atspi_action_get_type (); @@ -45,23 +45,22 @@ struct _AtspiAction GTypeInterface parent; }; -gchar * atspi_action_get_action_description (AtspiAction *obj, int i, GError **error); +gchar *atspi_action_get_action_description (AtspiAction *obj, int i, GError **error); -gchar * atspi_action_get_action_name (AtspiAction *obj, gint i, GError **error); +gchar *atspi_action_get_action_name (AtspiAction *obj, gint i, GError **error); gint atspi_action_get_n_actions (AtspiAction *obj, GError **error); -gchar * atspi_action_get_key_binding (AtspiAction *obj, gint i, GError **error); - +gchar *atspi_action_get_key_binding (AtspiAction *obj, gint i, GError **error); -gchar * atspi_action_get_localized_name (AtspiAction *obj, gint i, GError **error); +gchar *atspi_action_get_localized_name (AtspiAction *obj, gint i, GError **error); gboolean atspi_action_do_action (AtspiAction *obj, gint i, GError **error); #ifndef ATSPI_DISABLE_DEPRECATED -gchar * atspi_action_get_description (AtspiAction *obj, gint i, GError **error); -gchar * atspi_action_get_name (AtspiAction *obj, gint i, GError **error); +gchar *atspi_action_get_description (AtspiAction *obj, gint i, GError **error); +gchar *atspi_action_get_name (AtspiAction *obj, gint i, GError **error); #endif G_END_DECLS -#endif /* _ATSPI_ACTION_H_ */ +#endif /* _ATSPI_ACTION_H_ */ diff --git a/atspi/atspi-application.c b/atspi/atspi-application.c index 8045a819..d9abac12 100644 --- a/atspi/atspi-application.c +++ b/atspi/atspi-application.c @@ -52,26 +52,26 @@ atspi_application_dispose (GObject *object) AtspiApplication *application = ATSPI_APPLICATION (object); if (application->bus) - { - if (application->bus != _atspi_bus ()) - dbus_connection_close (application->bus); - dbus_connection_unref (application->bus); - application->bus = NULL; - } + { + if (application->bus != _atspi_bus ()) + dbus_connection_close (application->bus); + dbus_connection_unref (application->bus); + application->bus = NULL; + } if (application->hash) - { - g_hash_table_foreach (application->hash, dispose_accessible, NULL); - g_hash_table_unref (application->hash); - application->hash = NULL; - } + { + g_hash_table_foreach (application->hash, dispose_accessible, NULL); + g_hash_table_unref (application->hash); + application->hash = NULL; + } if (application->root) - { - g_clear_object (&application->root->parent.app); - g_object_unref (application->root); - application->root = NULL; - } + { + g_clear_object (&application->root->parent.app); + g_object_unref (application->root); + application->root = NULL; + } G_OBJECT_CLASS (atspi_application_parent_class)->dispose (object); } @@ -102,7 +102,7 @@ AtspiApplication * _atspi_application_new (const gchar *bus_name) { AtspiApplication *application; - + application = g_object_new (ATSPI_TYPE_APPLICATION, NULL); application->bus_name = g_strdup (bus_name); application->root = NULL; diff --git a/atspi/atspi-application.h b/atspi/atspi-application.h index 0662031f..691e1c40 100644 --- a/atspi/atspi-application.h +++ b/atspi/atspi-application.h @@ -4,7 +4,7 @@ * * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -27,18 +27,18 @@ #include <dbus/dbus.h> -#include "atspi-types.h" #include "atspi-accessible.h" +#include "atspi-types.h" #include <sys/time.h> G_BEGIN_DECLS -#define ATSPI_TYPE_APPLICATION (atspi_application_get_type ()) -#define ATSPI_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_APPLICATION, AtspiApplication)) -#define ATSPI_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_APPLICATION, AtspiAccessibleClass)) -#define ATSPI_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_APPLICATION)) -#define ATSPI_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_APPLICATION)) -#define ATSPI_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_APPLICATION, AtspiAccessibleClass)) +#define ATSPI_TYPE_APPLICATION (atspi_application_get_type ()) +#define ATSPI_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_APPLICATION, AtspiApplication)) +#define ATSPI_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_APPLICATION, AtspiAccessibleClass)) +#define ATSPI_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_APPLICATION)) +#define ATSPI_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_APPLICATION)) +#define ATSPI_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_APPLICATION, AtspiAccessibleClass)) typedef struct _AtspiApplication AtspiApplication; struct _AtspiApplication @@ -68,4 +68,4 @@ GType atspi_application_get_type (void); G_END_DECLS -#endif /* _ATSPI_APPLICATION_H_ */ +#endif /* _ATSPI_APPLICATION_H_ */ diff --git a/atspi/atspi-collection.c b/atspi/atspi-collection.c index caf335be..a21810b7 100644 --- a/atspi/atspi-collection.c +++ b/atspi/atspi-collection.c @@ -85,7 +85,7 @@ append_accessible (DBusMessage *message, AtspiAccessible *accessible) dbus_message_iter_init_append (message, &iter); dbus_message_iter_append_basic (&iter, DBUS_TYPE_OBJECT_PATH, &accessible->parent.path); - return TRUE; /* TODO: Check for out-of-memory */ + return TRUE; /* TODO: Check for out-of-memory */ } static GArray * @@ -100,12 +100,12 @@ return_accessibles (DBusMessage *message) dbus_message_iter_recurse (&iter, &iter_array); while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID) - { - AtspiAccessible *accessible; - accessible = _atspi_dbus_consume_accessible (&iter_array); - ret = g_array_append_val (ret, accessible); - /* Iter was moved already, so no need to call dbus_message_iter_next */ - } + { + AtspiAccessible *accessible; + accessible = _atspi_dbus_consume_accessible (&iter_array); + ret = g_array_append_val (ret, accessible); + /* Iter was moved already, so no need to call dbus_message_iter_next */ + } dbus_message_unref (message); return ret; } @@ -120,9 +120,9 @@ return_accessibles (DBusMessage *message) * @traverse: Not supported. * * Gets all #AtspiAccessible objects from the @collection matching a given - * @rule. + * @rule. * - * Returns: (element-type AtspiAccessible*) (transfer full): All + * Returns: (element-type AtspiAccessible*) (transfer full): All * #AtspiAccessible objects matching the given match rule. **/ GArray * @@ -170,8 +170,8 @@ atspi_collection_get_matches (AtspiCollection *collection, * @count: The maximum number of results to return, or 0 for no limit. * @traverse: Not supported. * - * Gets all #AtspiAccessible objects from the @collection, after - * @current_object, matching a given @rule. + * Gets all #AtspiAccessible objects from the @collection, after + * @current_object, matching a given @rule. * * Returns: (element-type AtspiAccessible*) (transfer full): All * #AtspiAccessible objects matching the given match rule after @@ -179,14 +179,14 @@ atspi_collection_get_matches (AtspiCollection *collection, **/ GArray * atspi_collection_get_matches_to (AtspiCollection *collection, - AtspiAccessible *current_object, - AtspiMatchRule *rule, - AtspiCollectionSortOrder sortby, - AtspiCollectionTreeTraversalType tree, - gboolean limit_scope, - gint count, - gboolean traverse, - GError **error) + AtspiAccessible *current_object, + AtspiMatchRule *rule, + AtspiCollectionSortOrder sortby, + AtspiCollectionTreeTraversalType tree, + gboolean limit_scope, + gint count, + gboolean traverse, + GError **error) { DBusMessage *message = new_message (collection, "GetMatchesTo"); DBusMessage *reply; @@ -204,7 +204,7 @@ atspi_collection_get_matches_to (AtspiCollection *collection, if (!append_match_rule (message, rule)) return NULL; dbus_message_append_args (message, DBUS_TYPE_UINT32, &d_sortby, - DBUS_TYPE_UINT32, &d_tree, + DBUS_TYPE_UINT32, &d_tree, DBUS_TYPE_BOOLEAN, &d_limit_scope, DBUS_TYPE_INT32, &d_count, DBUS_TYPE_BOOLEAN, &d_traverse, @@ -227,22 +227,22 @@ atspi_collection_get_matches_to (AtspiCollection *collection, * @count: The maximum number of results to return, or 0 for no limit. * @traverse: Not supported. * - * Gets all #AtspiAccessible objects from the @collection, before - * @current_object, matching a given @rule. + * Gets all #AtspiAccessible objects from the @collection, before + * @current_object, matching a given @rule. * - * Returns: (element-type AtspiAccessible*) (transfer full): All + * Returns: (element-type AtspiAccessible*) (transfer full): All * #AtspiAccessible objects matching the given match rule that preceed * @current_object. **/ GArray * atspi_collection_get_matches_from (AtspiCollection *collection, - AtspiAccessible *current_object, - AtspiMatchRule *rule, - AtspiCollectionSortOrder sortby, - AtspiCollectionTreeTraversalType tree, - gint count, - gboolean traverse, - GError **error) + AtspiAccessible *current_object, + AtspiMatchRule *rule, + AtspiCollectionSortOrder sortby, + AtspiCollectionTreeTraversalType tree, + gint count, + gboolean traverse, + GError **error) { DBusMessage *message = new_message (collection, "GetMatchesFrom"); DBusMessage *reply; @@ -272,7 +272,7 @@ atspi_collection_get_matches_from (AtspiCollection *collection, /** * atspi_collection_get_active_descendant: * -* Returns: (transfer full): The active descendant of the given object. + * Returns: (transfer full): The active descendant of the given object. * Not yet implemented. **/ AtspiAccessible * @@ -292,16 +292,15 @@ atspi_collection_get_type (void) { static GType type = 0; - if (!type) { - static const GTypeInfo tinfo = + if (!type) { - sizeof (AtspiCollection), - (GBaseInitFunc) atspi_collection_base_init, - (GBaseFinalizeFunc) NULL, - }; - - type = g_type_register_static (G_TYPE_INTERFACE, "AtspiCollection", &tinfo, 0); + static const GTypeInfo tinfo = { + sizeof (AtspiCollection), + (GBaseInitFunc) atspi_collection_base_init, + (GBaseFinalizeFunc) NULL, + }; - } + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiCollection", &tinfo, 0); + } return type; } diff --git a/atspi/atspi-collection.h b/atspi/atspi-collection.h index 9b564c51..a0d0cdc5 100644 --- a/atspi/atspi-collection.h +++ b/atspi/atspi-collection.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -30,15 +30,15 @@ #include "atspi-constants.h" -#include "atspi-types.h" #include "atspi-matchrule.h" +#include "atspi-types.h" G_BEGIN_DECLS -#define ATSPI_TYPE_COLLECTION (atspi_collection_get_type ()) -#define ATSPI_IS_COLLECTION(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_COLLECTION) -#define ATSPI_COLLECTION(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_COLLECTION, AtspiCollection) -#define ATSPI_COLLECTION_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_COLLECTION, AtspiCollection)) +#define ATSPI_TYPE_COLLECTION (atspi_collection_get_type ()) +#define ATSPI_IS_COLLECTION(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_COLLECTION) +#define ATSPI_COLLECTION(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_COLLECTION, AtspiCollection) +#define ATSPI_COLLECTION_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_COLLECTION, AtspiCollection)) GType atspi_collection_get_type (); @@ -49,14 +49,14 @@ struct _AtspiCollection gboolean atspi_collection_is_ancestor_of (AtspiCollection *collection, AtspiAccessible *test, GError **error); -GArray * atspi_collection_get_matches (AtspiCollection *collection, AtspiMatchRule *rule, AtspiCollectionSortOrder sortby, gint count, gboolean traverse, GError **error); +GArray *atspi_collection_get_matches (AtspiCollection *collection, AtspiMatchRule *rule, AtspiCollectionSortOrder sortby, gint count, gboolean traverse, GError **error); -GArray * atspi_collection_get_matches_to (AtspiCollection *collection, AtspiAccessible *current_object, AtspiMatchRule *rule, AtspiCollectionSortOrder sortby, AtspiCollectionTreeTraversalType tree, gboolean limit_scope, gint count, gboolean traverse, GError **error); +GArray *atspi_collection_get_matches_to (AtspiCollection *collection, AtspiAccessible *current_object, AtspiMatchRule *rule, AtspiCollectionSortOrder sortby, AtspiCollectionTreeTraversalType tree, gboolean limit_scope, gint count, gboolean traverse, GError **error); -GArray * atspi_collection_get_matches_from (AtspiCollection *collection, AtspiAccessible *current_object, AtspiMatchRule *rule, AtspiCollectionSortOrder sortby, AtspiCollectionTreeTraversalType tree, gint count, gboolean traverse, GError **error); +GArray *atspi_collection_get_matches_from (AtspiCollection *collection, AtspiAccessible *current_object, AtspiMatchRule *rule, AtspiCollectionSortOrder sortby, AtspiCollectionTreeTraversalType tree, gint count, gboolean traverse, GError **error); -AtspiAccessible * atspi_collection_get_active_descendant (AtspiCollection *collection, GError **error); +AtspiAccessible *atspi_collection_get_active_descendant (AtspiCollection *collection, GError **error); G_END_DECLS -#endif /* _ATSPI_COLLECTION_H_ */ +#endif /* _ATSPI_COLLECTION_H_ */ diff --git a/atspi/atspi-component.c b/atspi/atspi-component.c index 7c825691..5a5dac1b 100644 --- a/atspi/atspi-component.c +++ b/atspi/atspi-component.c @@ -27,8 +27,8 @@ * */ -#include "atspi-private.h" #include "atspi-accessible-private.h" +#include "atspi-private.h" /** * AtspiComponent @@ -91,9 +91,10 @@ G_DEFINE_BOXED_TYPE (AtspiPoint, atspi_point, atspi_point_copy, g_free) **/ gboolean atspi_component_contains (AtspiComponent *obj, - gint x, - gint y, - AtspiCoordType ctype, GError **error) + gint x, + gint y, + AtspiCoordType ctype, + GError **error) { dbus_bool_t retval = FALSE; dbus_int32_t d_x = x, d_y = y; @@ -123,9 +124,10 @@ atspi_component_contains (AtspiComponent *obj, **/ AtspiAccessible * atspi_component_get_accessible_at_point (AtspiComponent *obj, - gint x, - gint y, - AtspiCoordType ctype, GError **error) + gint x, + gint y, + AtspiCoordType ctype, + GError **error) { dbus_int32_t d_x = x, d_y = y; dbus_uint32_t d_ctype = ctype; @@ -152,7 +154,8 @@ atspi_component_get_accessible_at_point (AtspiComponent *obj, **/ AtspiRect * atspi_component_get_extents (AtspiComponent *obj, - AtspiCoordType ctype, GError **error) + AtspiCoordType ctype, + GError **error) { dbus_uint32_t d_ctype = ctype; AtspiRect bbox; @@ -163,13 +166,13 @@ atspi_component_get_extents (AtspiComponent *obj, accessible = ATSPI_ACCESSIBLE (obj); if (accessible->priv->cache && ctype == ATSPI_COORD_TYPE_SCREEN) - { - GValue *val = g_hash_table_lookup (accessible->priv->cache, "Component.ScreenExtents"); - if (val) { - return g_value_dup_boxed (val); + GValue *val = g_hash_table_lookup (accessible->priv->cache, "Component.ScreenExtents"); + if (val) + { + return g_value_dup_boxed (val); + } } - } _atspi_dbus_call (obj, atspi_interface_component, "GetExtents", error, "u=>(iiii)", d_ctype, &bbox); return atspi_rect_copy (&bbox); @@ -189,7 +192,8 @@ atspi_component_get_extents (AtspiComponent *obj, **/ AtspiPoint * atspi_component_get_position (AtspiComponent *obj, - AtspiCoordType ctype, GError **error) + AtspiCoordType ctype, + GError **error) { dbus_int32_t d_x, d_y; dbus_uint32_t d_ctype = ctype; @@ -237,7 +241,7 @@ atspi_component_get_size (AtspiComponent *obj, GError **error) * atspi_component_get_layer: * @obj: a pointer to the #AtspiComponent to query. * - * Queries which layer the component is painted into, to help determine its + * Queries which layer the component is painted into, to help determine its * visibility in terms of stacking order. * * Returns: the #AtspiComponentLayer into which this component is painted. @@ -259,7 +263,7 @@ atspi_component_get_layer (AtspiComponent *obj, GError **error) * Queries the z stacking order of a component which is in the MDI or window * layer. (Bigger z-order numbers mean nearer the top) * - * Returns: a #gshort indicating the stacking order of the component + * Returns: a #gshort indicating the stacking order of the component * in the MDI layer, or -1 if the component is not in the MDI layer. **/ gshort @@ -298,10 +302,10 @@ atspi_component_grab_focus (AtspiComponent *obj, GError **error) * * Gets the opacity/alpha value of a component, if alpha blending is in use. * - * Returns: the opacity value of a component, as a #gdouble between 0.0 and 1.0. + * Returns: the opacity value of a component, as a #gdouble between 0.0 and 1.0. **/ -gdouble -atspi_component_get_alpha (AtspiComponent *obj, GError **error) +gdouble +atspi_component_get_alpha (AtspiComponent *obj, GError **error) { double retval = 1; @@ -343,11 +347,11 @@ atspi_component_set_extents (AtspiComponent *obj, g_return_val_if_fail (obj != NULL, FALSE); if (!aobj->parent.app || !aobj->parent.app->bus_name) - { - g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_APPLICATION_GONE, - _("The application no longer exists")); - return FALSE; - } + { + g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_APPLICATION_GONE, + _ ("The application no longer exists")); + return FALSE; + } message = dbus_message_new_method_call (aobj->parent.app->bus_name, aobj->parent.path, @@ -358,10 +362,10 @@ atspi_component_set_extents (AtspiComponent *obj, dbus_message_iter_init_append (message, &iter); if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_STRUCT, NULL, &iter_struct)) - { - dbus_message_unref (message); - return FALSE; - } + { + dbus_message_unref (message); + return FALSE; + } dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, &d_x); dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, &d_y); dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, &d_width); @@ -371,7 +375,7 @@ atspi_component_set_extents (AtspiComponent *obj, reply = _atspi_dbus_send_with_reply_and_block (message, error); dbus_message_get_args (reply, NULL, DBUS_TYPE_BOOLEAN, &retval, - DBUS_TYPE_INVALID); + DBUS_TYPE_INVALID); dbus_message_unref (reply); return retval; } @@ -501,16 +505,15 @@ atspi_component_get_type (void) { static GType type = 0; - if (!type) { - static const GTypeInfo tinfo = + if (!type) { - sizeof (AtspiComponent), - (GBaseInitFunc) atspi_component_base_init, - (GBaseFinalizeFunc) NULL, - }; + static const GTypeInfo tinfo = { + sizeof (AtspiComponent), + (GBaseInitFunc) atspi_component_base_init, + (GBaseFinalizeFunc) NULL, + }; - type = g_type_register_static (G_TYPE_INTERFACE, "AtspiComponent", &tinfo, 0); - - } + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiComponent", &tinfo, 0); + } return type; } diff --git a/atspi/atspi-component.h b/atspi/atspi-component.h index 4e8f0add..b23d4362 100644 --- a/atspi/atspi-component.h +++ b/atspi/atspi-component.h @@ -4,7 +4,7 @@ * * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -44,10 +44,10 @@ struct _AtspiRect /** * ATSPI_TYPE_RECT: - * + * * The #GType for a boxed type holding a #AtspiRect. */ -#define ATSPI_TYPE_RECT (atspi_rect_get_type ()) +#define ATSPI_TYPE_RECT (atspi_rect_get_type ()) GType atspi_rect_get_type (); @@ -62,19 +62,19 @@ struct _AtspiPoint /** * ATSPI_TYPE_POINT: - * + * * The #GType for a boxed type holding a #AtspiPoint. */ -#define ATSPI_TYPE_POINT (atspi_point_get_type ()) +#define ATSPI_TYPE_POINT (atspi_point_get_type ()) GType atspi_point_get_type (); AtspiPoint *atspi_point_copy (AtspiPoint *src); -#define ATSPI_TYPE_COMPONENT (atspi_component_get_type ()) -#define ATSPI_IS_COMPONENT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_COMPONENT) -#define ATSPI_COMPONENT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_COMPONENT, AtspiComponent) -#define ATSPI_COMPONENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_COMPONENT, AtspiComponent)) +#define ATSPI_TYPE_COMPONENT (atspi_component_get_type ()) +#define ATSPI_IS_COMPONENT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_COMPONENT) +#define ATSPI_COMPONENT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_COMPONENT, AtspiComponent) +#define ATSPI_COMPONENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_COMPONENT, AtspiComponent)) GType atspi_component_get_type (); @@ -99,7 +99,7 @@ gshort atspi_component_get_mdi_z_order (AtspiComponent *obj, GError **error); gboolean atspi_component_grab_focus (AtspiComponent *obj, GError **error); -gdouble atspi_component_get_alpha (AtspiComponent *obj, GError **error); +gdouble atspi_component_get_alpha (AtspiComponent *obj, GError **error); gboolean atspi_component_set_extents (AtspiComponent *obj, gint x, gint y, gint width, gint height, AtspiCoordType ctype, GError **error); @@ -113,4 +113,4 @@ gboolean atspi_component_scroll_to_point (AtspiComponent *obj, AtspiCoordType co G_END_DECLS -#endif /* _ATSPI_COMPONENT_H_ */ +#endif /* _ATSPI_COMPONENT_H_ */ diff --git a/atspi/atspi-constants.h b/atspi/atspi-constants.h index 9c0eb34f..bb9ae543 100644 --- a/atspi/atspi-constants.h +++ b/atspi/atspi-constants.h @@ -93,85 +93,89 @@ #ifndef _ATSPI_CONSTANTS_H_ #define _ATSPI_CONSTANTS_H_ #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif -/** - * AtspiLocaleType: - * @ATSPI_LOCALE_TYPE_MESSAGES: For localizable natural-language messages. - * @ATSPI_LOCALE_TYPE_COLLATE: For regular expression matching and string - * collation. - * @ATSPI_LOCALE_TYPE_CTYPE: For regular expression matching, character - * classification, conversion, case-sensitive comparison, and wide character - * functions. - * @ATSPI_LOCALE_TYPE_MONETARY: For monetary formatting. - * @ATSPI_LOCALE_TYPE_NUMERIC: For number formatting (such as the decimal - * point and the thousands separator). - * @ATSPI_LOCALE_TYPE_TIME: For time and date formatting. - * - * Used by interfaces #AtspiText and #AtspiDocument, this - * enumeration corresponds to the POSIX 'setlocale' enum values. - * - **/ -typedef enum { + /** + * AtspiLocaleType: + * @ATSPI_LOCALE_TYPE_MESSAGES: For localizable natural-language messages. + * @ATSPI_LOCALE_TYPE_COLLATE: For regular expression matching and string + * collation. + * @ATSPI_LOCALE_TYPE_CTYPE: For regular expression matching, character + * classification, conversion, case-sensitive comparison, and wide character + * functions. + * @ATSPI_LOCALE_TYPE_MONETARY: For monetary formatting. + * @ATSPI_LOCALE_TYPE_NUMERIC: For number formatting (such as the decimal + * point and the thousands separator). + * @ATSPI_LOCALE_TYPE_TIME: For time and date formatting. + * + * Used by interfaces #AtspiText and #AtspiDocument, this + * enumeration corresponds to the POSIX 'setlocale' enum values. + * + **/ + typedef enum + { ATSPI_LOCALE_TYPE_MESSAGES, ATSPI_LOCALE_TYPE_COLLATE, ATSPI_LOCALE_TYPE_CTYPE, ATSPI_LOCALE_TYPE_MONETARY, ATSPI_LOCALE_TYPE_NUMERIC, ATSPI_LOCALE_TYPE_TIME, -} AtspiLocaleType; + } AtspiLocaleType; /** * ATSPI_LOCALE_TYPE_COUNT: * * One higher than the highest valid value of #AtspiLocaleType. **/ -#define ATSPI_LOCALE_TYPE_COUNT (5+1) +#define ATSPI_LOCALE_TYPE_COUNT (5 + 1) -/** - * AtspiCoordType: - * @ATSPI_COORD_TYPE_SCREEN: Specifies xy coordinates relative to the screen. - * @ATSPI_COORD_TYPE_WINDOW: Specifies xy coordinates relative to the widget's - * top-level window. - * @ATSPI_COORD_TYPE_PARENT: Specifies xy coordinates relative to the widget's - * immediate parent. - * - * Enumeration used by #AtspiComponent, #AtspiImage, and #AtspiText interfaces - * to specify whether coordinates are relative to the window or the screen. - * - **/ -typedef enum { + /** + * AtspiCoordType: + * @ATSPI_COORD_TYPE_SCREEN: Specifies xy coordinates relative to the screen. + * @ATSPI_COORD_TYPE_WINDOW: Specifies xy coordinates relative to the widget's + * top-level window. + * @ATSPI_COORD_TYPE_PARENT: Specifies xy coordinates relative to the widget's + * immediate parent. + * + * Enumeration used by #AtspiComponent, #AtspiImage, and #AtspiText interfaces + * to specify whether coordinates are relative to the window or the screen. + * + **/ + typedef enum + { ATSPI_COORD_TYPE_SCREEN, ATSPI_COORD_TYPE_WINDOW, ATSPI_COORD_TYPE_PARENT, -} AtspiCoordType; + } AtspiCoordType; /** * ATSPI_COORD_TYPE_COUNT: * * One higher than the highest valid value of #AtspiCoordType. **/ -#define ATSPI_COORD_TYPE_COUNT (2+1) +#define ATSPI_COORD_TYPE_COUNT (2 + 1) -/** - * AtspiCollectionSortOrder: - * @ATSPI_Collection_SORT_ORDER_INVALID: Invalid sort order - * @ATSPI_Collection_SORT_ORDER_CANONICAL: Canonical sort order - * @ATSPI_Collection_SORT_ORDER_FLOW: Flow sort order - * @ATSPI_Collection_SORT_ORDER_TAB: Tab sort order - * @ATSPI_Collection_SORT_ORDER_REVERSE_CANONICAL: Reverse canonical sort order - * @ATSPI_Collection_SORT_ORDER_REVERSE_FLOW: Reverse flow sort order - * @ATSPI_Collection_SORT_ORDER_REVERSE_TAB: Reverse tab sort order - * @ATSPI_Collection_SORT_ORDER_LAST_DEFINED: Used only to determine the end of the - * enumeration. + /** + * AtspiCollectionSortOrder: + * @ATSPI_Collection_SORT_ORDER_INVALID: Invalid sort order + * @ATSPI_Collection_SORT_ORDER_CANONICAL: Canonical sort order + * @ATSPI_Collection_SORT_ORDER_FLOW: Flow sort order + * @ATSPI_Collection_SORT_ORDER_TAB: Tab sort order + * @ATSPI_Collection_SORT_ORDER_REVERSE_CANONICAL: Reverse canonical sort order + * @ATSPI_Collection_SORT_ORDER_REVERSE_FLOW: Reverse flow sort order + * @ATSPI_Collection_SORT_ORDER_REVERSE_TAB: Reverse tab sort order + * @ATSPI_Collection_SORT_ORDER_LAST_DEFINED: Used only to determine the end of the + * enumeration. - * - * Enumeration used by interface #AtspiCollection to specify - * the way #AtspiAccesible objects should be sorted. - * - **/ -typedef enum { + * + * Enumeration used by interface #AtspiCollection to specify + * the way #AtspiAccesible objects should be sorted. + * + **/ + typedef enum + { ATSPI_Collection_SORT_ORDER_INVALID, ATSPI_Collection_SORT_ORDER_CANONICAL, ATSPI_Collection_SORT_ORDER_FLOW, @@ -180,66 +184,68 @@ typedef enum { ATSPI_Collection_SORT_ORDER_REVERSE_FLOW, ATSPI_Collection_SORT_ORDER_REVERSE_TAB, ATSPI_Collection_SORT_ORDER_LAST_DEFINED, -} AtspiCollectionSortOrder; + } AtspiCollectionSortOrder; /** * ATSPI_SORTORDER_COUNT: * * One higher than the highest valid value of #AtspiCollectionSortOrder. */ -#define ATSPI_SORTORDER_COUNT (7+1) +#define ATSPI_SORTORDER_COUNT (7 + 1) -/** - * AtspiCollectionMatchType: - * @ATSPI_Collection_MATCH_INVALID: Indicates an error condition or - * uninitialized value. - * @ATSPI_Collection_MATCH_ALL: #TRUE if all of the criteria are met. - * @ATSPI_Collection_MATCH_ANY: #TRUE if any of the criteria are met. - * @ATSPI_Collection_MATCH_NONE: #TRUE if none of the criteria are met. - * @ATSPI_Collection_MATCH_EMPTY: Same as @ATSPI_Collection_MATCH_ALL if - * the criteria is non-empty; for empty criteria this rule requires returned - * value to also have empty set. - * @ATSPI_Collection_MATCH_LAST_DEFINED: Used only to determine the end of the - * enumeration. - * - * Enumeration used by #AtspiMatchRule to specify - * how to interpret #AtspiAccessible objects. - * - **/ -typedef enum { + /** + * AtspiCollectionMatchType: + * @ATSPI_Collection_MATCH_INVALID: Indicates an error condition or + * uninitialized value. + * @ATSPI_Collection_MATCH_ALL: #TRUE if all of the criteria are met. + * @ATSPI_Collection_MATCH_ANY: #TRUE if any of the criteria are met. + * @ATSPI_Collection_MATCH_NONE: #TRUE if none of the criteria are met. + * @ATSPI_Collection_MATCH_EMPTY: Same as @ATSPI_Collection_MATCH_ALL if + * the criteria is non-empty; for empty criteria this rule requires returned + * value to also have empty set. + * @ATSPI_Collection_MATCH_LAST_DEFINED: Used only to determine the end of the + * enumeration. + * + * Enumeration used by #AtspiMatchRule to specify + * how to interpret #AtspiAccessible objects. + * + **/ + typedef enum + { ATSPI_Collection_MATCH_INVALID, ATSPI_Collection_MATCH_ALL, ATSPI_Collection_MATCH_ANY, ATSPI_Collection_MATCH_NONE, ATSPI_Collection_MATCH_EMPTY, ATSPI_Collection_MATCH_LAST_DEFINED, -} AtspiCollectionMatchType; + } AtspiCollectionMatchType; /** * ATSPI_MATCHTYPE_COUNT: * * One higher than the highest valid value of #AtspiCollectionMatchType. **/ -#define ATSPI_MATCHTYPES_COUNT (5+1) +#define ATSPI_MATCHTYPES_COUNT (5 + 1) -/** - * AtspiCollectionTreeTraversalType: - * @ATSPI_Collection_TREE_RESTRICT_CHILDREN: Restrict children tree traveral - * @ATSPI_Collection_TREE_RESTRICT_SIBLING: Restrict sibling tree traversal - * @ATSPI_Collection_TREE_INORDER: In-order tree traversal. - * @ATSPI_Collection_TREE_LAST_DEFINED: Used only to determine the end of the - * enumeration. - * - * Enumeration used by interface #AtspiCollection to specify - * restrictions on #AtspiAccesible objects to be traversed. - * - **/ -typedef enum { + /** + * AtspiCollectionTreeTraversalType: + * @ATSPI_Collection_TREE_RESTRICT_CHILDREN: Restrict children tree traveral + * @ATSPI_Collection_TREE_RESTRICT_SIBLING: Restrict sibling tree traversal + * @ATSPI_Collection_TREE_INORDER: In-order tree traversal. + * @ATSPI_Collection_TREE_LAST_DEFINED: Used only to determine the end of the + * enumeration. + * + * Enumeration used by interface #AtspiCollection to specify + * restrictions on #AtspiAccesible objects to be traversed. + * + **/ + typedef enum + { ATSPI_Collection_TREE_RESTRICT_CHILDREN, ATSPI_Collection_TREE_RESTRICT_SIBLING, ATSPI_Collection_TREE_INORDER, ATSPI_Collection_TREE_LAST_DEFINED, -} AtspiCollectionTreeTraversalType; + } AtspiCollectionTreeTraversalType; /** * ATSPI_TREETRAVERSALTYPE_COUNT: @@ -247,49 +253,50 @@ typedef enum { * One higher than the highest valid value of * #AtspiCollection_TreeTraversalType. */ -#define ATSPI_TREETRAVERSALTYPE_COUNT (3+1) +#define ATSPI_TREETRAVERSALTYPE_COUNT (3 + 1) -/** - * AtspiComponentLayer: - * @ATSPI_LAYER_INVALID: Indicates an error condition or uninitialized value. - * @ATSPI_LAYER_BACKGROUND: The bottom-most layer, over which everything else - * is painted. The 'desktop background' is generally in this layer. - * @ATSPI_LAYER_CANVAS: The 'background' layer for most content renderers and - * UI #AtspiComponent containers. - * @ATSPI_LAYER_WIDGET: The layer in which the majority of ordinary - * 'foreground' widgets reside. - * @ATSPI_LAYER_MDI: A special layer between @ATSPI_LAYER_CANVAS and - * @ATSPI_LAYER_WIDGET, in which the 'pseudo windows' (e.g. the MDI frames) - * reside. See #atspi_component_get_mdi_z_order. - * @ATSPI_LAYER_POPUP: A layer for popup window content, above - * @ATSPI_LAYER_WIDGET. - * @ATSPI_LAYER_OVERLAY: The topmost layer. - * @ATSPI_LAYER_WINDOW: The layer in which a toplevel window background usually - * resides. - * @ATSPI_LAYER_LAST_DEFINED: Used only to determine the end of the - * enumeration. - * - * The #AtspiComponentLayer of an #AtspiComponent instance indicates its - * relative stacking order with respect to the onscreen visual representation - * of the UI. #AtspiComponentLayer, in combination with #AtspiComponent bounds - * information, can be used to compute the visibility of all or part of a - * component. This is important in programmatic determination of - * region-of-interest for magnification, and in - * flat screen review models of the screen, as well as - * for other uses. Objects residing in two of the #AtspiComponentLayer - * categories support further z-ordering information, with respect to their - * peers in the same layer: namely, @ATSPI_LAYER_WINDOW and - * @ATSPI_LAYER_MDI. Relative stacking order for other objects within the - * same layer is not available; the recommended heuristic is - * first child paints first. In other words, assume that the - * first siblings in the child list are subject to being overpainted by later - * siblings if their bounds intersect. The order of layers, from bottom to top, - * is: @ATSPI_LAYER_BACKGROUND, @ATSPI_LAYER_WINDOW, @ATSPI_LAYER_MDI, - * @ATSPI_LAYER_CANVAS, @ATSPI_LAYER_WIDGET, @ATSPI_LAYER_POPUP, and - * @ATSPI_LAYER_OVERLAY. - * - */ -typedef enum { + /** + * AtspiComponentLayer: + * @ATSPI_LAYER_INVALID: Indicates an error condition or uninitialized value. + * @ATSPI_LAYER_BACKGROUND: The bottom-most layer, over which everything else + * is painted. The 'desktop background' is generally in this layer. + * @ATSPI_LAYER_CANVAS: The 'background' layer for most content renderers and + * UI #AtspiComponent containers. + * @ATSPI_LAYER_WIDGET: The layer in which the majority of ordinary + * 'foreground' widgets reside. + * @ATSPI_LAYER_MDI: A special layer between @ATSPI_LAYER_CANVAS and + * @ATSPI_LAYER_WIDGET, in which the 'pseudo windows' (e.g. the MDI frames) + * reside. See #atspi_component_get_mdi_z_order. + * @ATSPI_LAYER_POPUP: A layer for popup window content, above + * @ATSPI_LAYER_WIDGET. + * @ATSPI_LAYER_OVERLAY: The topmost layer. + * @ATSPI_LAYER_WINDOW: The layer in which a toplevel window background usually + * resides. + * @ATSPI_LAYER_LAST_DEFINED: Used only to determine the end of the + * enumeration. + * + * The #AtspiComponentLayer of an #AtspiComponent instance indicates its + * relative stacking order with respect to the onscreen visual representation + * of the UI. #AtspiComponentLayer, in combination with #AtspiComponent bounds + * information, can be used to compute the visibility of all or part of a + * component. This is important in programmatic determination of + * region-of-interest for magnification, and in + * flat screen review models of the screen, as well as + * for other uses. Objects residing in two of the #AtspiComponentLayer + * categories support further z-ordering information, with respect to their + * peers in the same layer: namely, @ATSPI_LAYER_WINDOW and + * @ATSPI_LAYER_MDI. Relative stacking order for other objects within the + * same layer is not available; the recommended heuristic is + * first child paints first. In other words, assume that the + * first siblings in the child list are subject to being overpainted by later + * siblings if their bounds intersect. The order of layers, from bottom to top, + * is: @ATSPI_LAYER_BACKGROUND, @ATSPI_LAYER_WINDOW, @ATSPI_LAYER_MDI, + * @ATSPI_LAYER_CANVAS, @ATSPI_LAYER_WIDGET, @ATSPI_LAYER_POPUP, and + * @ATSPI_LAYER_OVERLAY. + * + */ + typedef enum + { ATSPI_LAYER_INVALID, ATSPI_LAYER_BACKGROUND, ATSPI_LAYER_CANVAS, @@ -299,56 +306,57 @@ typedef enum { ATSPI_LAYER_OVERLAY, ATSPI_LAYER_WINDOW, ATSPI_LAYER_LAST_DEFINED, -} AtspiComponentLayer; + } AtspiComponentLayer; /** * ATSPI_COMPONENTLAYER_COUNT: * * One higher than the highest valid value of #AtspiComponentLayer. **/ -#define ATSPI_COMPONENTLAYER_COUNT (8+1) +#define ATSPI_COMPONENTLAYER_COUNT (8 + 1) -/** - * AtspiTextBoundaryType: - * @ATSPI_TEXT_BOUNDARY_CHAR: An #AtspiText instance is bounded by this - * character only. Start and end offsets differ by one, by definition, - * for this value. - * @ATSPI_TEXT_BOUNDARY_WORD_START: Boundary condition is start of a word; i.e. - * range is from start of one word to the start of another word. - * @ATSPI_TEXT_BOUNDARY_WORD_END: Boundary condition is the end of a word; i.e. - * range is from the end of one word to the end of another. Some locales - * may not distinguish between words and characters or glyphs. In particular, - * those locales which use wholly or partially ideographic character sets. - * In these cases, characters may be returned in lieu of multi-character - * substrings. - * @ATSPI_TEXT_BOUNDARY_SENTENCE_START: Boundary condition is start of a - * sentence, as determined by the application. Some locales or - * character sets may not include explicit sentence delimiters, so this - * boundary type can not always be honored. Some locales will return lines - * of text instead of grammatical sentences. - * @ATSPI_TEXT_BOUNDARY_SENTENCE_END: Boundary condition is end of a sentence, - * as determined by the application, including the sentence-delimiting - * character, for instance '.' Some locales or character sets may not - * include explicit sentence delimiters, so this boundary type can not - * always be honored. Some locales will return lines of text instead of - * grammatical sentences. - * @ATSPI_TEXT_BOUNDARY_LINE_START: Boundary condition is the start of a line; - * i.e. range is from start of one line to the start of another. This - * generally means that an end-of-line character will appear at the end of - * the range. - * @ATSPI_TEXT_BOUNDARY_LINE_END: Boundary condition is the end of a line; i.e. - * range is from start of one line to the start of another. This generally - * means that an end-of-line character will be the first character of the - * range. - * - * Specifies the boundary conditions determining a run of text as returned from - * #atspi_text_get_text_at_offset, #atspi_text_get_text_after_offset, and - * #atspi_text_get_text_before_offset. - * - * This enumerationis deprecated since 2.9.90 and should not be used. Use - * AtspiTextGranularity with #atspi_text_get_string_at_offset instead. - **/ -typedef enum { + /** + * AtspiTextBoundaryType: + * @ATSPI_TEXT_BOUNDARY_CHAR: An #AtspiText instance is bounded by this + * character only. Start and end offsets differ by one, by definition, + * for this value. + * @ATSPI_TEXT_BOUNDARY_WORD_START: Boundary condition is start of a word; i.e. + * range is from start of one word to the start of another word. + * @ATSPI_TEXT_BOUNDARY_WORD_END: Boundary condition is the end of a word; i.e. + * range is from the end of one word to the end of another. Some locales + * may not distinguish between words and characters or glyphs. In particular, + * those locales which use wholly or partially ideographic character sets. + * In these cases, characters may be returned in lieu of multi-character + * substrings. + * @ATSPI_TEXT_BOUNDARY_SENTENCE_START: Boundary condition is start of a + * sentence, as determined by the application. Some locales or + * character sets may not include explicit sentence delimiters, so this + * boundary type can not always be honored. Some locales will return lines + * of text instead of grammatical sentences. + * @ATSPI_TEXT_BOUNDARY_SENTENCE_END: Boundary condition is end of a sentence, + * as determined by the application, including the sentence-delimiting + * character, for instance '.' Some locales or character sets may not + * include explicit sentence delimiters, so this boundary type can not + * always be honored. Some locales will return lines of text instead of + * grammatical sentences. + * @ATSPI_TEXT_BOUNDARY_LINE_START: Boundary condition is the start of a line; + * i.e. range is from start of one line to the start of another. This + * generally means that an end-of-line character will appear at the end of + * the range. + * @ATSPI_TEXT_BOUNDARY_LINE_END: Boundary condition is the end of a line; i.e. + * range is from start of one line to the start of another. This generally + * means that an end-of-line character will be the first character of the + * range. + * + * Specifies the boundary conditions determining a run of text as returned from + * #atspi_text_get_text_at_offset, #atspi_text_get_text_after_offset, and + * #atspi_text_get_text_before_offset. + * + * This enumerationis deprecated since 2.9.90 and should not be used. Use + * AtspiTextGranularity with #atspi_text_get_string_at_offset instead. + **/ + typedef enum + { ATSPI_TEXT_BOUNDARY_CHAR, ATSPI_TEXT_BOUNDARY_WORD_START, ATSPI_TEXT_BOUNDARY_WORD_END, @@ -356,244 +364,247 @@ typedef enum { ATSPI_TEXT_BOUNDARY_SENTENCE_END, ATSPI_TEXT_BOUNDARY_LINE_START, ATSPI_TEXT_BOUNDARY_LINE_END, -} AtspiTextBoundaryType; + } AtspiTextBoundaryType; -/** - *AtspiTextGranularity: - *@ATSPI_TEXT_GRANULARITY_CHAR: Granularity is defined by the boundaries between characters - * (including non-printing characters) - *@ATSPI_TEXT_GRANULARITY_WORD: Granularity is defined by the boundaries of a word, - * starting at the beginning of the current word and finishing at the beginning of - * the following one, if present. - *@ATSPI_TEXT_GRANULARITY_SENTENCE: Granularity is defined by the boundaries of a sentence, - * starting at the beginning of the current sentence and finishing at the beginning of - * the following one, if present. - *@ATSPI_TEXT_GRANULARITY_LINE: Granularity is defined by the boundaries of a line, - * starting at the beginning of the current line and finishing at the beginning of - * the following one, if present. - *@ATSPI_TEXT_GRANULARITY_PARAGRAPH: Granularity is defined by the boundaries of a paragraph, - * starting at the beginning of the current paragraph and finishing at the beginning of - * the following one, if present. - * - * Text granularity types used for specifying the granularity of the region of - * text we are interested in. - **/ -typedef enum { - ATSPI_TEXT_GRANULARITY_CHAR, - ATSPI_TEXT_GRANULARITY_WORD, - ATSPI_TEXT_GRANULARITY_SENTENCE, - ATSPI_TEXT_GRANULARITY_LINE, - ATSPI_TEXT_GRANULARITY_PARAGRAPH -} AtspiTextGranularity; + /** + *AtspiTextGranularity: + *@ATSPI_TEXT_GRANULARITY_CHAR: Granularity is defined by the boundaries between characters + * (including non-printing characters) + *@ATSPI_TEXT_GRANULARITY_WORD: Granularity is defined by the boundaries of a word, + * starting at the beginning of the current word and finishing at the beginning of + * the following one, if present. + *@ATSPI_TEXT_GRANULARITY_SENTENCE: Granularity is defined by the boundaries of a sentence, + * starting at the beginning of the current sentence and finishing at the beginning of + * the following one, if present. + *@ATSPI_TEXT_GRANULARITY_LINE: Granularity is defined by the boundaries of a line, + * starting at the beginning of the current line and finishing at the beginning of + * the following one, if present. + *@ATSPI_TEXT_GRANULARITY_PARAGRAPH: Granularity is defined by the boundaries of a paragraph, + * starting at the beginning of the current paragraph and finishing at the beginning of + * the following one, if present. + * + * Text granularity types used for specifying the granularity of the region of + * text we are interested in. + **/ + typedef enum + { + ATSPI_TEXT_GRANULARITY_CHAR, + ATSPI_TEXT_GRANULARITY_WORD, + ATSPI_TEXT_GRANULARITY_SENTENCE, + ATSPI_TEXT_GRANULARITY_LINE, + ATSPI_TEXT_GRANULARITY_PARAGRAPH + } AtspiTextGranularity; /** * ATSPI_TEXT_BOUNDARY_TYPE_COUNT: * * One higher than the highest valid value of #AtspiTextBoundaryType. */ -#define ATSPI_TEXT_BOUNDARY_TYPE_COUNT (6+1) +#define ATSPI_TEXT_BOUNDARY_TYPE_COUNT (6 + 1) -/** - * AtspiTextClipType: - * @ATSPI_TEXT_CLIP_NONE: No characters/glyphs are omitted. - * @ATSPI_TEXT_CLIP_MIN: Characters/glyphs clipped by the minimum coordinate - * are omitted. - * @ATSPI_TEXT_CLIP_MAX: Characters/glyphs which intersect the maximum - * coordinate are omitted. - * @ATSPI_TEXT_CLIP_BOTH: Only glyphs falling entirely within the region - * bounded by min and max are retained. - * - * Enumeration used by interface #AtspiText to indicate - * how to treat characters intersecting bounding boxes. - * - **/ -typedef enum { + /** + * AtspiTextClipType: + * @ATSPI_TEXT_CLIP_NONE: No characters/glyphs are omitted. + * @ATSPI_TEXT_CLIP_MIN: Characters/glyphs clipped by the minimum coordinate + * are omitted. + * @ATSPI_TEXT_CLIP_MAX: Characters/glyphs which intersect the maximum + * coordinate are omitted. + * @ATSPI_TEXT_CLIP_BOTH: Only glyphs falling entirely within the region + * bounded by min and max are retained. + * + * Enumeration used by interface #AtspiText to indicate + * how to treat characters intersecting bounding boxes. + * + **/ + typedef enum + { ATSPI_TEXT_CLIP_NONE, ATSPI_TEXT_CLIP_MIN, ATSPI_TEXT_CLIP_MAX, ATSPI_TEXT_CLIP_BOTH, -} AtspiTextClipType; + } AtspiTextClipType; /** * ATSPI_TEXT_CLIP_TYPE_COUNT: * * One higher than the highest valid value of #AtspiTextClipType. */ -#define ATSPI_TEXT_CLIP_TYPE_COUNT (3+1) +#define ATSPI_TEXT_CLIP_TYPE_COUNT (3 + 1) -/** - * AtspiStateType: - * @ATSPI_STATE_INVALID: Indicates an invalid state - probably an error - * condition. - * @ATSPI_STATE_ACTIVE: Indicates a window is currently the active window, or - * an object is the active subelement within a container or table. - * @ATSPI_STATE_ACTIVE should not be used for objects which have - * #ATSPI_STATE_FOCUSABLE or #ATSPI_STATE_SELECTABLE: Those objects should use - * @ATSPI_STATE_FOCUSED and @ATSPI_STATE_SELECTED respectively. - * @ATSPI_STATE_ACTIVE is a means to indicate that an object which is not - * focusable and not selectable is the currently-active item within its - * parent container. - * @ATSPI_STATE_ARMED: Indicates that the object is armed. - * @ATSPI_STATE_BUSY: Indicates the current object is busy, i.e. onscreen - * representation is in the process of changing, or the object is - * temporarily unavailable for interaction due to activity already in progress. - * @ATSPI_STATE_CHECKED: Indicates this object is currently checked. - * @ATSPI_STATE_COLLAPSED: Indicates this object is collapsed. - * @ATSPI_STATE_DEFUNCT: Indicates that this object no longer has a valid - * backing widget (for instance, if its peer object has been destroyed). - * @ATSPI_STATE_EDITABLE: Indicates the user can change the contents of this - * object. - * @ATSPI_STATE_ENABLED: Indicates that this object is enabled, i.e. that it - * currently reflects some application state. Objects that are "greyed out" - * may lack this state, and may lack the @ATSPI_STATE_SENSITIVE if direct - * user interaction cannot cause them to acquire @ATSPI_STATE_ENABLED. - * See @ATSPI_STATE_SENSITIVE. - * @ATSPI_STATE_EXPANDABLE: Indicates this object allows progressive - * disclosure of its children. - * @ATSPI_STATE_EXPANDED: Indicates this object is expanded. - * @ATSPI_STATE_FOCUSABLE: Indicates this object can accept keyboard focus, - * which means all events resulting from typing on the keyboard will - * normally be passed to it when it has focus. - * @ATSPI_STATE_FOCUSED: Indicates this object currently has the keyboard - * focus. - * @ATSPI_STATE_HAS_TOOLTIP: Indicates that the object has an associated - * tooltip. - * @ATSPI_STATE_HORIZONTAL: Indicates the orientation of this object is - * horizontal. - * @ATSPI_STATE_ICONIFIED: Indicates this object is minimized and is - * represented only by an icon. - * @ATSPI_STATE_MODAL: Indicates something must be done with this object - * before the user can interact with an object in a different window. - * @ATSPI_STATE_MULTI_LINE: Indicates this (text) object can contain multiple - * lines of text. - * @ATSPI_STATE_MULTISELECTABLE: Indicates this object allows more than one of - * its children to be selected at the same time, or in the case of text - * objects, that the object supports non-contiguous text selections. - * @ATSPI_STATE_OPAQUE: Indicates this object paints every pixel within its - * rectangular region. It also indicates an alpha value of unity, if it - * supports alpha blending. - * @ATSPI_STATE_PRESSED: Indicates this object is currently pressed. - * @ATSPI_STATE_RESIZABLE: Indicates the size of this object's size is not - * fixed. - * @ATSPI_STATE_SELECTABLE: Indicates this object is the child of an object - * that allows its children to be selected and that this child is one of - * those children that can be selected. - * @ATSPI_STATE_SELECTED: Indicates this object is the child of an object that - * allows its children to be selected and that this child is one of those - * children that has been selected. - * @ATSPI_STATE_SENSITIVE: Indicates this object is sensitive, e.g. to user - * interaction. @ATSPI_STATE_SENSITIVE usually accompanies. - * @ATSPI_STATE_ENABLED for user-actionable controls, but may be found in the - * absence of @ATSPI_STATE_ENABLED if the current visible state of the control - * is "disconnected" from the application state. In such cases, direct user - * interaction can often result in the object gaining @ATSPI_STATE_SENSITIVE, - * for instance if a user makes an explicit selection using an object whose - * current state is ambiguous or undefined. See @ATSPI_STATE_ENABLED, - * @ATSPI_STATE_INDETERMINATE. - * @ATSPI_STATE_SHOWING: Indicates this object, the object's parent, the - * object's parent's parent, and so on, are all 'shown' to the end-user, - * i.e. subject to "exposure" if blocking or obscuring objects do not - * interpose between this object and the top of the window stack. - * @ATSPI_STATE_SINGLE_LINE: Indicates this (text) object can contain only a - * single line of text. - * @ATSPI_STATE_STALE: Indicates that the information returned for this object - * may no longer be synchronized with the application state. This can occur - * if the object has @ATSPI_STATE_TRANSIENT, and can also occur towards the - * end of the object peer's lifecycle. - * @ATSPI_STATE_TRANSIENT: Indicates this object is transient. - * @ATSPI_STATE_VERTICAL: Indicates the orientation of this object is vertical; - * for example this state may appear on such objects as scrollbars, text - * objects (with vertical text flow), separators, etc. - * @ATSPI_STATE_VISIBLE: Indicates this object is visible, e.g. has been - * explicitly marked for exposure to the user. @ATSPI_STATE_VISIBLE is no - * guarantee that the object is actually unobscured on the screen, only that - * it is 'potentially' visible, barring obstruction, being scrolled or clipped - * out of the field of view, or having an ancestor container that has not yet - * made visible. A widget is potentially onscreen if it has both - * @ATSPI_STATE_VISIBLE and @ATSPI_STATE_SHOWING. The absence of - * @ATSPI_STATE_VISIBLE and @ATSPI_STATE_SHOWING is - * semantically equivalent to saying that an object is 'hidden'. - * @ATSPI_STATE_MANAGES_DESCENDANTS: Indicates that "active-descendant-changed" - * event is sent when children become 'active' (i.e. are selected or - * navigated to onscreen). Used to prevent need to enumerate all children - * in very large containers, like tables. The presence of - * @ATSPI_STATE_MANAGES_DESCENDANTS is an indication to the client that the - * children should not, and need not, be enumerated by the client. - * Objects implementing this state are expected to provide relevant state - * notifications to listening clients, for instance notifications of - * visibility changes and activation of their contained child objects, without - * the client having previously requested references to those children. - * @ATSPI_STATE_INDETERMINATE: Indicates that a check box or other boolean - * indicator is in a state other than checked or not checked. This - * usually means that the boolean value reflected or controlled by the - * object does not apply consistently to the entire current context. - * For example, a checkbox for the "Bold" attribute of text may have - * @ATSPI_STATE_INDETERMINATE if the currently selected text contains a mixture - * of weight attributes. In many cases interacting with a - * @ATSPI_STATE_INDETERMINATE object will cause the context's corresponding - * boolean attribute to be homogenized, whereupon the object will lose - * @ATSPI_STATE_INDETERMINATE and a corresponding state-changed event will be - * fired. - * @ATSPI_STATE_REQUIRED: Indicates that user interaction with this object is - * 'required' from the user, for instance before completing the - * processing of a form. - * @ATSPI_STATE_TRUNCATED: Indicates that an object's onscreen content - * is truncated, e.g. a text value in a spreadsheet cell. - * @ATSPI_STATE_ANIMATED: Indicates this object's visual representation is - * dynamic, not static. This state may be applied to an object during an - * animated 'effect' and be removed from the object once its visual - * representation becomes static. Some applications, notably content viewers, - * may not be able to detect all kinds of animated content. Therefore the - * absence of this state should not be taken as - * definitive evidence that the object's visual representation is - * static; this state is advisory. - * @ATSPI_STATE_INVALID_ENTRY: This object has indicated an error condition - * due to failure of input validation. For instance, a form control may - * acquire this state in response to invalid or malformed user input. - * @ATSPI_STATE_SUPPORTS_AUTOCOMPLETION: This state indicates that the object - * in question implements some form of typeahead or - * pre-selection behavior whereby entering the first character of one or more - * sub-elements causes those elements to scroll into view or become - * selected. Subsequent character input may narrow the selection further as - * long as one or more sub-elements match the string. This state is normally - * only useful and encountered on objects that implement #AtspiSelection. - * In some cases the typeahead behavior may result in full or partial - * completion of the data in the input field, in which case - * these input events may trigger text-changed events from the source. - * @ATSPI_STATE_SELECTABLE_TEXT: This state indicates that the object in - * question supports text selection. It should only be exposed on objects - * which implement the #AtspiText interface, in order to distinguish this state - * from @ATSPI_STATE_SELECTABLE, which infers that the object in question is a - * selectable child of an object which implements #AtspiSelection. While - * similar, text selection and subelement selection are distinct operations. - * @ATSPI_STATE_IS_DEFAULT: This state indicates that the object in question is - * the 'default' interaction object in a dialog, i.e. the one that gets - * activated if the user presses "Enter" when the dialog is initially - * posted. - * @ATSPI_STATE_VISITED: This state indicates that the object (typically a - * hyperlink) has already been activated or invoked, with the result that - * some backing data has been downloaded or rendered. - *@ATSPI_STATE_CHECKABLE: Indicates this object has the potential to - * be checked, such as a checkbox or toggle-able table cell. @Since: - * 2.12 - *@ATSPI_STATE_HAS_POPUP: Indicates that the object has a popup - * context menu or sub-level menu which may or may not be - * showing. This means that activation renders conditional content. - * Note that ordinary tooltips are not considered popups in this - * context. @Since: 2.12 - * @ATSPI_STATE_READ_ONLY: Indicates that an object which is ENABLED and - * SENSITIVE has a value which can be read, but not modified, by the - * user. @Since: 2.16 - * @ATSPI_STATE_LAST_DEFINED: This value of the enumeration should not be used - * as a parameter, it indicates the number of items in the #AtspiStateType - * enumeration. - * - * - * Enumeration used by various interfaces indicating every possible state - * an #AtspiAccesible object can assume. - * - **/ -typedef enum { + /** + * AtspiStateType: + * @ATSPI_STATE_INVALID: Indicates an invalid state - probably an error + * condition. + * @ATSPI_STATE_ACTIVE: Indicates a window is currently the active window, or + * an object is the active subelement within a container or table. + * @ATSPI_STATE_ACTIVE should not be used for objects which have + * #ATSPI_STATE_FOCUSABLE or #ATSPI_STATE_SELECTABLE: Those objects should use + * @ATSPI_STATE_FOCUSED and @ATSPI_STATE_SELECTED respectively. + * @ATSPI_STATE_ACTIVE is a means to indicate that an object which is not + * focusable and not selectable is the currently-active item within its + * parent container. + * @ATSPI_STATE_ARMED: Indicates that the object is armed. + * @ATSPI_STATE_BUSY: Indicates the current object is busy, i.e. onscreen + * representation is in the process of changing, or the object is + * temporarily unavailable for interaction due to activity already in progress. + * @ATSPI_STATE_CHECKED: Indicates this object is currently checked. + * @ATSPI_STATE_COLLAPSED: Indicates this object is collapsed. + * @ATSPI_STATE_DEFUNCT: Indicates that this object no longer has a valid + * backing widget (for instance, if its peer object has been destroyed). + * @ATSPI_STATE_EDITABLE: Indicates the user can change the contents of this + * object. + * @ATSPI_STATE_ENABLED: Indicates that this object is enabled, i.e. that it + * currently reflects some application state. Objects that are "greyed out" + * may lack this state, and may lack the @ATSPI_STATE_SENSITIVE if direct + * user interaction cannot cause them to acquire @ATSPI_STATE_ENABLED. + * See @ATSPI_STATE_SENSITIVE. + * @ATSPI_STATE_EXPANDABLE: Indicates this object allows progressive + * disclosure of its children. + * @ATSPI_STATE_EXPANDED: Indicates this object is expanded. + * @ATSPI_STATE_FOCUSABLE: Indicates this object can accept keyboard focus, + * which means all events resulting from typing on the keyboard will + * normally be passed to it when it has focus. + * @ATSPI_STATE_FOCUSED: Indicates this object currently has the keyboard + * focus. + * @ATSPI_STATE_HAS_TOOLTIP: Indicates that the object has an associated + * tooltip. + * @ATSPI_STATE_HORIZONTAL: Indicates the orientation of this object is + * horizontal. + * @ATSPI_STATE_ICONIFIED: Indicates this object is minimized and is + * represented only by an icon. + * @ATSPI_STATE_MODAL: Indicates something must be done with this object + * before the user can interact with an object in a different window. + * @ATSPI_STATE_MULTI_LINE: Indicates this (text) object can contain multiple + * lines of text. + * @ATSPI_STATE_MULTISELECTABLE: Indicates this object allows more than one of + * its children to be selected at the same time, or in the case of text + * objects, that the object supports non-contiguous text selections. + * @ATSPI_STATE_OPAQUE: Indicates this object paints every pixel within its + * rectangular region. It also indicates an alpha value of unity, if it + * supports alpha blending. + * @ATSPI_STATE_PRESSED: Indicates this object is currently pressed. + * @ATSPI_STATE_RESIZABLE: Indicates the size of this object's size is not + * fixed. + * @ATSPI_STATE_SELECTABLE: Indicates this object is the child of an object + * that allows its children to be selected and that this child is one of + * those children that can be selected. + * @ATSPI_STATE_SELECTED: Indicates this object is the child of an object that + * allows its children to be selected and that this child is one of those + * children that has been selected. + * @ATSPI_STATE_SENSITIVE: Indicates this object is sensitive, e.g. to user + * interaction. @ATSPI_STATE_SENSITIVE usually accompanies. + * @ATSPI_STATE_ENABLED for user-actionable controls, but may be found in the + * absence of @ATSPI_STATE_ENABLED if the current visible state of the control + * is "disconnected" from the application state. In such cases, direct user + * interaction can often result in the object gaining @ATSPI_STATE_SENSITIVE, + * for instance if a user makes an explicit selection using an object whose + * current state is ambiguous or undefined. See @ATSPI_STATE_ENABLED, + * @ATSPI_STATE_INDETERMINATE. + * @ATSPI_STATE_SHOWING: Indicates this object, the object's parent, the + * object's parent's parent, and so on, are all 'shown' to the end-user, + * i.e. subject to "exposure" if blocking or obscuring objects do not + * interpose between this object and the top of the window stack. + * @ATSPI_STATE_SINGLE_LINE: Indicates this (text) object can contain only a + * single line of text. + * @ATSPI_STATE_STALE: Indicates that the information returned for this object + * may no longer be synchronized with the application state. This can occur + * if the object has @ATSPI_STATE_TRANSIENT, and can also occur towards the + * end of the object peer's lifecycle. + * @ATSPI_STATE_TRANSIENT: Indicates this object is transient. + * @ATSPI_STATE_VERTICAL: Indicates the orientation of this object is vertical; + * for example this state may appear on such objects as scrollbars, text + * objects (with vertical text flow), separators, etc. + * @ATSPI_STATE_VISIBLE: Indicates this object is visible, e.g. has been + * explicitly marked for exposure to the user. @ATSPI_STATE_VISIBLE is no + * guarantee that the object is actually unobscured on the screen, only that + * it is 'potentially' visible, barring obstruction, being scrolled or clipped + * out of the field of view, or having an ancestor container that has not yet + * made visible. A widget is potentially onscreen if it has both + * @ATSPI_STATE_VISIBLE and @ATSPI_STATE_SHOWING. The absence of + * @ATSPI_STATE_VISIBLE and @ATSPI_STATE_SHOWING is + * semantically equivalent to saying that an object is 'hidden'. + * @ATSPI_STATE_MANAGES_DESCENDANTS: Indicates that "active-descendant-changed" + * event is sent when children become 'active' (i.e. are selected or + * navigated to onscreen). Used to prevent need to enumerate all children + * in very large containers, like tables. The presence of + * @ATSPI_STATE_MANAGES_DESCENDANTS is an indication to the client that the + * children should not, and need not, be enumerated by the client. + * Objects implementing this state are expected to provide relevant state + * notifications to listening clients, for instance notifications of + * visibility changes and activation of their contained child objects, without + * the client having previously requested references to those children. + * @ATSPI_STATE_INDETERMINATE: Indicates that a check box or other boolean + * indicator is in a state other than checked or not checked. This + * usually means that the boolean value reflected or controlled by the + * object does not apply consistently to the entire current context. + * For example, a checkbox for the "Bold" attribute of text may have + * @ATSPI_STATE_INDETERMINATE if the currently selected text contains a mixture + * of weight attributes. In many cases interacting with a + * @ATSPI_STATE_INDETERMINATE object will cause the context's corresponding + * boolean attribute to be homogenized, whereupon the object will lose + * @ATSPI_STATE_INDETERMINATE and a corresponding state-changed event will be + * fired. + * @ATSPI_STATE_REQUIRED: Indicates that user interaction with this object is + * 'required' from the user, for instance before completing the + * processing of a form. + * @ATSPI_STATE_TRUNCATED: Indicates that an object's onscreen content + * is truncated, e.g. a text value in a spreadsheet cell. + * @ATSPI_STATE_ANIMATED: Indicates this object's visual representation is + * dynamic, not static. This state may be applied to an object during an + * animated 'effect' and be removed from the object once its visual + * representation becomes static. Some applications, notably content viewers, + * may not be able to detect all kinds of animated content. Therefore the + * absence of this state should not be taken as + * definitive evidence that the object's visual representation is + * static; this state is advisory. + * @ATSPI_STATE_INVALID_ENTRY: This object has indicated an error condition + * due to failure of input validation. For instance, a form control may + * acquire this state in response to invalid or malformed user input. + * @ATSPI_STATE_SUPPORTS_AUTOCOMPLETION: This state indicates that the object + * in question implements some form of typeahead or + * pre-selection behavior whereby entering the first character of one or more + * sub-elements causes those elements to scroll into view or become + * selected. Subsequent character input may narrow the selection further as + * long as one or more sub-elements match the string. This state is normally + * only useful and encountered on objects that implement #AtspiSelection. + * In some cases the typeahead behavior may result in full or partial + * completion of the data in the input field, in which case + * these input events may trigger text-changed events from the source. + * @ATSPI_STATE_SELECTABLE_TEXT: This state indicates that the object in + * question supports text selection. It should only be exposed on objects + * which implement the #AtspiText interface, in order to distinguish this state + * from @ATSPI_STATE_SELECTABLE, which infers that the object in question is a + * selectable child of an object which implements #AtspiSelection. While + * similar, text selection and subelement selection are distinct operations. + * @ATSPI_STATE_IS_DEFAULT: This state indicates that the object in question is + * the 'default' interaction object in a dialog, i.e. the one that gets + * activated if the user presses "Enter" when the dialog is initially + * posted. + * @ATSPI_STATE_VISITED: This state indicates that the object (typically a + * hyperlink) has already been activated or invoked, with the result that + * some backing data has been downloaded or rendered. + *@ATSPI_STATE_CHECKABLE: Indicates this object has the potential to + * be checked, such as a checkbox or toggle-able table cell. @Since: + * 2.12 + *@ATSPI_STATE_HAS_POPUP: Indicates that the object has a popup + * context menu or sub-level menu which may or may not be + * showing. This means that activation renders conditional content. + * Note that ordinary tooltips are not considered popups in this + * context. @Since: 2.12 + * @ATSPI_STATE_READ_ONLY: Indicates that an object which is ENABLED and + * SENSITIVE has a value which can be read, but not modified, by the + * user. @Since: 2.16 + * @ATSPI_STATE_LAST_DEFINED: This value of the enumeration should not be used + * as a parameter, it indicates the number of items in the #AtspiStateType + * enumeration. + * + * + * Enumeration used by various interfaces indicating every possible state + * an #AtspiAccesible object can assume. + * + **/ + typedef enum + { ATSPI_STATE_INVALID, ATSPI_STATE_ACTIVE, ATSPI_STATE_ARMED, @@ -639,96 +650,99 @@ typedef enum { ATSPI_STATE_HAS_POPUP, ATSPI_STATE_READ_ONLY, ATSPI_STATE_LAST_DEFINED, -} AtspiStateType; + } AtspiStateType; /** * ATSPI_STATETYPE_COUNT: * * One higher than the highest valid value of #AtspiStateType. **/ -#define ATSPI_STATETYPE_COUNT (41+1) +#define ATSPI_STATETYPE_COUNT (41 + 1) -/** - * AtspiKeyEventType: - * @ATSPI_KEY_PRESSED: Key press event - * @ATSPI_KEY_RELEASED: Key release event - * - * Deprecated. Should not be used. - * - **/ -typedef enum { + /** + * AtspiKeyEventType: + * @ATSPI_KEY_PRESSED: Key press event + * @ATSPI_KEY_RELEASED: Key release event + * + * Deprecated. Should not be used. + * + **/ + typedef enum + { ATSPI_KEY_PRESSED, ATSPI_KEY_RELEASED, -} AtspiKeyEventType; + } AtspiKeyEventType; /** * ATSPI_KEYEVENTTYPE_COUNT: * * One higher than the highest valid value of #AtspiKeyEventType. **/ -#define ATSPI_KEYEVENTTYPE_COUNT (1+1) +#define ATSPI_KEYEVENTTYPE_COUNT (1 + 1) -/** - * AtspiEventType: - * @ATSPI_KEY_PRESSED_EVENT: Indicates that a key on a keyboard device was - * pressed. - * @ATSPI_KEY_RELEASED_EVENT: Indicates that a key on a keyboard device was - * released. - * @ATSPI_BUTTON_PRESSED_EVENT: Indicates that a button on a non-keyboard - * human interface device (HID) was pressed. - * @ATSPI_BUTTON_RELEASED_EVENT: Indicates that a button on a non-keyboard - * human interface device (HID) was released. - * - * Enumeration used to specify the event types of interest to an - * #AtspiEventListener, or - * to identify the type of an event for which notification has been sent. - * - **/ -typedef enum { + /** + * AtspiEventType: + * @ATSPI_KEY_PRESSED_EVENT: Indicates that a key on a keyboard device was + * pressed. + * @ATSPI_KEY_RELEASED_EVENT: Indicates that a key on a keyboard device was + * released. + * @ATSPI_BUTTON_PRESSED_EVENT: Indicates that a button on a non-keyboard + * human interface device (HID) was pressed. + * @ATSPI_BUTTON_RELEASED_EVENT: Indicates that a button on a non-keyboard + * human interface device (HID) was released. + * + * Enumeration used to specify the event types of interest to an + * #AtspiEventListener, or + * to identify the type of an event for which notification has been sent. + * + **/ + typedef enum + { ATSPI_KEY_PRESSED_EVENT, ATSPI_KEY_RELEASED_EVENT, ATSPI_BUTTON_PRESSED_EVENT, ATSPI_BUTTON_RELEASED_EVENT, -} AtspiEventType; + } AtspiEventType; /** * ATSPI_EVENTTYPE_COUNT: * * One higher than the highest valid value of #AtspiEventType. */ -#define ATSPI_EVENTTYPE_COUNT (3+1) +#define ATSPI_EVENTTYPE_COUNT (3 + 1) -/** - * AtspiKeySynthType: - * @ATSPI_KEY_PRESS: Emulates the pressing of a hardware keyboard key. - * @ATSPI_KEY_RELEASE: Emulates the release of a hardware keyboard key. - * @ATSPI_KEY_PRESSRELEASE: Emulates the pressing and immediate releasing - * of a hardware keyboard key. - * @ATSPI_KEY_SYM: A symbolic key event is generated, without specifying a - * hardware key. Note: if the keysym is not present in the current keyboard - * map, the #AtspiDeviceEventController instance has a limited ability to - * generate such keysyms on-the-fly. Reliability of GenerateKeyboardEvent - * calls using out-of-keymap keysyms will vary from system to system, and on - * the number of different out-of-keymap keysyms being generated in quick - * succession. - * In practice this is rarely significant, since the keysyms of interest to - * AT clients and keyboard emulators are usually part of the current keymap, - * i.e., present on the system keyboard for the current locale (even if a - * physical hardware keyboard is not connected). - * @ATSPI_KEY_STRING: A string is converted to its equivalent keyboard events - * and emitted. If the string consists of complex characters or composed - * characters which are not in the current keymap, string emission is - * subject to the out-of-keymap limitations described for - * @ATSPI_KEY_SYM. In practice this limitation primarily effects - * Chinese and Japanese locales. - * @ATSPI_KEY_LOCKMODIFIERS: Emulates locking a set of modifiers. - * @ATSPI_KEY_UNLOCKMODIFIERS: Emulates unlocking a set of modifiers. - * - * Enumeration used when synthesizing keyboard input via - * #atspi_generate_keyboard_event. - * - **/ -typedef enum { + /** + * AtspiKeySynthType: + * @ATSPI_KEY_PRESS: Emulates the pressing of a hardware keyboard key. + * @ATSPI_KEY_RELEASE: Emulates the release of a hardware keyboard key. + * @ATSPI_KEY_PRESSRELEASE: Emulates the pressing and immediate releasing + * of a hardware keyboard key. + * @ATSPI_KEY_SYM: A symbolic key event is generated, without specifying a + * hardware key. Note: if the keysym is not present in the current keyboard + * map, the #AtspiDeviceEventController instance has a limited ability to + * generate such keysyms on-the-fly. Reliability of GenerateKeyboardEvent + * calls using out-of-keymap keysyms will vary from system to system, and on + * the number of different out-of-keymap keysyms being generated in quick + * succession. + * In practice this is rarely significant, since the keysyms of interest to + * AT clients and keyboard emulators are usually part of the current keymap, + * i.e., present on the system keyboard for the current locale (even if a + * physical hardware keyboard is not connected). + * @ATSPI_KEY_STRING: A string is converted to its equivalent keyboard events + * and emitted. If the string consists of complex characters or composed + * characters which are not in the current keymap, string emission is + * subject to the out-of-keymap limitations described for + * @ATSPI_KEY_SYM. In practice this limitation primarily effects + * Chinese and Japanese locales. + * @ATSPI_KEY_LOCKMODIFIERS: Emulates locking a set of modifiers. + * @ATSPI_KEY_UNLOCKMODIFIERS: Emulates unlocking a set of modifiers. + * + * Enumeration used when synthesizing keyboard input via + * #atspi_generate_keyboard_event. + * + **/ + typedef enum + { ATSPI_KEY_PRESS, ATSPI_KEY_RELEASE, ATSPI_KEY_PRESSRELEASE, @@ -736,36 +750,37 @@ typedef enum { ATSPI_KEY_STRING, ATSPI_KEY_LOCKMODIFIERS, ATSPI_KEY_UNLOCKMODIFIERS, -} AtspiKeySynthType; + } AtspiKeySynthType; /** * ATSPI_KEYSYNTHTYPE_COUNT: * * One higher than the highest valid value of #AtspiKeySynthType. **/ -#define ATSPI_KEYSYNTHTYPE_COUNT (4+1) +#define ATSPI_KEYSYNTHTYPE_COUNT (4 + 1) -/** - * AtspiModifierType: - * @ATSPI_MODIFIER_SHIFT: The left or right 'Shift' key. - * @ATSPI_MODIFIER_SHIFTLOCK: The ShiftLock or CapsLock key. - * @ATSPI_MODIFIER_CONTROL: 'Control'/'Ctrl'. - * @ATSPI_MODIFIER_ALT: The Alt key (as opposed to AltGr). - * @ATSPI_MODIFIER_META: Depending on the platform, this may map to 'Window', - * 'Function', 'Meta', 'Menu', or 'NumLock'. Such 'Meta keys' will - * map to one of META, META2, META3. On X Windows platforms these META - * values map to the modifier masks Mod1Mask, Mod2Mask, Mod3Mask, e.g. an - * event having @ATSPI_MODIFIER_META2 means that the 'Mod2Mask' bit - * is set in the corresponding XEvent. - * @ATSPI_MODIFIER_META2: See @ATSPI_MODIFIER_META. - * @ATSPI_MODIFIER_META3: See @ATSPI_MODIFIER_META. - * @ATSPI_MODIFIER_NUMLOCK: A symbolic meta key name that is mapped by AT-SPI - * to the appropriate META value, for the convenience of the client. - * - * - * - **/ -typedef enum { + /** + * AtspiModifierType: + * @ATSPI_MODIFIER_SHIFT: The left or right 'Shift' key. + * @ATSPI_MODIFIER_SHIFTLOCK: The ShiftLock or CapsLock key. + * @ATSPI_MODIFIER_CONTROL: 'Control'/'Ctrl'. + * @ATSPI_MODIFIER_ALT: The Alt key (as opposed to AltGr). + * @ATSPI_MODIFIER_META: Depending on the platform, this may map to 'Window', + * 'Function', 'Meta', 'Menu', or 'NumLock'. Such 'Meta keys' will + * map to one of META, META2, META3. On X Windows platforms these META + * values map to the modifier masks Mod1Mask, Mod2Mask, Mod3Mask, e.g. an + * event having @ATSPI_MODIFIER_META2 means that the 'Mod2Mask' bit + * is set in the corresponding XEvent. + * @ATSPI_MODIFIER_META2: See @ATSPI_MODIFIER_META. + * @ATSPI_MODIFIER_META3: See @ATSPI_MODIFIER_META. + * @ATSPI_MODIFIER_NUMLOCK: A symbolic meta key name that is mapped by AT-SPI + * to the appropriate META value, for the convenience of the client. + * + * + * + **/ + typedef enum + { ATSPI_MODIFIER_SHIFT, ATSPI_MODIFIER_SHIFTLOCK, ATSPI_MODIFIER_CONTROL, @@ -774,120 +789,121 @@ typedef enum { ATSPI_MODIFIER_META2, ATSPI_MODIFIER_META3, ATSPI_MODIFIER_NUMLOCK = 14, -} AtspiModifierType; + } AtspiModifierType; /** * ATSPI_MODIFIERTYPE_COUNT: * * One higher than the highest valid value of #AtspiModifierType. **/ -#define ATSPI_MODIFIERTYPE_COUNT (7+1) +#define ATSPI_MODIFIERTYPE_COUNT (7 + 1) -/** - * AtspiRelationType: - * @ATSPI_RELATION_NULL: Not a meaningful relationship; clients should not - * normally encounter this #AtspiRelationType value. - * @ATSPI_RELATION_LABEL_FOR: Object is a label for one or more other objects. - * @ATSPI_RELATION_LABELLED_BY: Object is labelled by one or more other - * objects. - * @ATSPI_RELATION_CONTROLLER_FOR: Object is an interactive object which - * modifies the state, onscreen location, or other attributes of one or more - * target objects. - * @ATSPI_RELATION_CONTROLLED_BY: Object state, position, etc. is - * modified/controlled by user interaction with one or more other objects. - * For instance a viewport or scroll pane may be @ATSPI_RELATION_CONTROLLED_BY - * scrollbars. - * @ATSPI_RELATION_MEMBER_OF: Object has a grouping relationship (e.g. 'same - * group as') to one or more other objects. - * @ATSPI_RELATION_TOOLTIP_FOR: Object is a tooltip associated with another - * object. - * @ATSPI_RELATION_NODE_CHILD_OF: Object is a child of the target. - * @ATSPI_RELATION_NODE_PARENT_OF: Object is a parent of the target. - * @ATSPI_RELATION_EXTENDED: Used to indicate that a relationship exists, but - * its type is not specified in the enumeration. - * @ATSPI_RELATION_FLOWS_TO: Object renders content which flows logically to - * another object. For instance, text in a paragraph may flow to another - * object which is not the 'next sibling' in the accessibility hierarchy. - * @ATSPI_RELATION_FLOWS_FROM: Reciprocal of @ATSPI_RELATION_FLOWS_TO. - * @ATSPI_RELATION_SUBWINDOW_OF: Object is visually and semantically considered - * a subwindow of another object, even though it is not the object's child. - * Useful when dealing with embedded applications and other cases where the - * widget hierarchy does not map cleanly to the onscreen presentation. - * @ATSPI_RELATION_EMBEDS: Similar to @ATSPI_RELATION_SUBWINDOW_OF, but - * specifically used for cross-process embedding. - * @ATSPI_RELATION_EMBEDDED_BY: Reciprocal of @ATSPI_RELATION_EMBEDS. Used to - * denote content rendered by embedded renderers that live in a separate process - * space from the embedding context. - * @ATSPI_RELATION_POPUP_FOR: Denotes that the object is a transient window or - * frame associated with another onscreen object. Similar to @ATSPI_TOOLTIP_FOR, - * but more general. Useful for windows which are technically toplevels - * but which, for one or more reasons, do not explicitly cause their - * associated window to lose 'window focus'. Creation of an @ATSPI_ROLE_WINDOW - * object with the @ATSPI_RELATION_POPUP_FOR relation usually requires - * some presentation action on the part - * of assistive technology clients, even though the previous toplevel - * @ATSPI_ROLE_FRAME object may still be the active window. - * @ATSPI_RELATION_PARENT_WINDOW_OF: This is the reciprocal relation to - * @ATSPI_RELATION_POPUP_FOR. - * @ATSPI_RELATION_DESCRIPTION_FOR: Reciprocal of %ATSPI_RELATION_DESCRIBED_BY. - * Indicates that this object provides descriptive information about the target - * object(s). See also %ATSPI_RELATION_DETAILS_FOR and %ATSPI_RELATION_ERROR_FOR. - * @ATSPI_RELATION_DESCRIBED_BY: Reciprocal of %ATSPI_RELATION_DESCRIPTION_FOR. - * Indicates that one or more target objects provide descriptive information - * about this object. This relation type is most appropriate for information - * that is not essential as its presentation may be user-configurable and/or - * limited to an on-demand mechanism such as an assistive technology command. - * For brief, essential information such as can be found in a widget's on-screen - * label, use %ATSPI_RELATION_LABELLED_BY. For an on-screen error message, use - * %ATSPI_RELATION_ERROR_MESSAGE. For lengthy extended descriptive information - * contained in an on-screen object, consider using %ATSPI_RELATION_DETAILS as - * assistive technologies may provide a means for the user to navigate to - * objects containing detailed descriptions so that their content can be more - * closely reviewed. - * @ATSPI_RELATION_DETAILS: Reciprocal of %ATSPI_RELATION_DETAILS_FOR. Indicates - * that this object has a detailed or extended description, the contents of - * which can be found in the target object(s). This relation type is most - * appropriate for information that is sufficiently lengthy as to make - * navigation to the container of that information desirable. For less verbose - * information suitable for announcement only, see %ATSPI_RELATION_DESCRIBED_BY. - * If the detailed information describes an error condition, - * %ATSPI_RELATION_ERROR_FOR should be used instead. @Since: 2.26. - * @ATSPI_RELATION_DETAILS_FOR: Reciprocal of %ATSPI_RELATION_DETAILS. Indicates - * that this object provides a detailed or extended description about the target - * object(s). See also %ATSPI_RELATION_DESCRIPTION_FOR and - * %ATSPI_RELATION_ERROR_FOR. @Since: 2.26. - * @ATSPI_RELATION_ERROR_MESSAGE: Reciprocal of %ATSPI_RELATION_ERROR_FOR. - * Indicates that this object has one or more errors, the nature of which is - * described in the contents of the target object(s). Objects that have this - * relation type should also contain %ATSPI_STATE_INVALID_ENTRY in their - * #AtspiStateSet. @Since: 2.26. - * @ATSPI_RELATION_ERROR_FOR: Reciprocal of %ATSPI_RELATION_ERROR_MESSAGE. - * Indicates that this object contains an error message describing an invalid - * condition in the target object(s). @Since: 2.26. - * @ATSPI_RELATION_LAST_DEFINED: Do not use as a parameter value, used to - * determine the size of the enumeration. - * - * #AtspiRelationType specifies a relationship between objects - * (possibly one-to-many - * or many-to-one) outside of the normal parent/child hierarchical - * relationship. It allows better semantic identification of how objects - * are associated with one another. For instance the - * @ATSPI_RELATION_LABELLED_BY - * relationship may be used to identify labelling information that should - * accompany the accessible name property when presenting an object's content or - * identity to the end user. Similarly, - * @ATSPI_RELATION_CONTROLLER_FOR can be used - * to further specify the context in which a valuator is useful, and/or the - * other UI components which are directly effected by user interactions with - * the valuator. Common examples include association of scrollbars with the - * viewport or panel which they control. - * - * - * Enumeration used to specify - * the type of relation encapsulated in an #AtspiRelation object. - * - **/ -typedef enum { + /** + * AtspiRelationType: + * @ATSPI_RELATION_NULL: Not a meaningful relationship; clients should not + * normally encounter this #AtspiRelationType value. + * @ATSPI_RELATION_LABEL_FOR: Object is a label for one or more other objects. + * @ATSPI_RELATION_LABELLED_BY: Object is labelled by one or more other + * objects. + * @ATSPI_RELATION_CONTROLLER_FOR: Object is an interactive object which + * modifies the state, onscreen location, or other attributes of one or more + * target objects. + * @ATSPI_RELATION_CONTROLLED_BY: Object state, position, etc. is + * modified/controlled by user interaction with one or more other objects. + * For instance a viewport or scroll pane may be @ATSPI_RELATION_CONTROLLED_BY + * scrollbars. + * @ATSPI_RELATION_MEMBER_OF: Object has a grouping relationship (e.g. 'same + * group as') to one or more other objects. + * @ATSPI_RELATION_TOOLTIP_FOR: Object is a tooltip associated with another + * object. + * @ATSPI_RELATION_NODE_CHILD_OF: Object is a child of the target. + * @ATSPI_RELATION_NODE_PARENT_OF: Object is a parent of the target. + * @ATSPI_RELATION_EXTENDED: Used to indicate that a relationship exists, but + * its type is not specified in the enumeration. + * @ATSPI_RELATION_FLOWS_TO: Object renders content which flows logically to + * another object. For instance, text in a paragraph may flow to another + * object which is not the 'next sibling' in the accessibility hierarchy. + * @ATSPI_RELATION_FLOWS_FROM: Reciprocal of @ATSPI_RELATION_FLOWS_TO. + * @ATSPI_RELATION_SUBWINDOW_OF: Object is visually and semantically considered + * a subwindow of another object, even though it is not the object's child. + * Useful when dealing with embedded applications and other cases where the + * widget hierarchy does not map cleanly to the onscreen presentation. + * @ATSPI_RELATION_EMBEDS: Similar to @ATSPI_RELATION_SUBWINDOW_OF, but + * specifically used for cross-process embedding. + * @ATSPI_RELATION_EMBEDDED_BY: Reciprocal of @ATSPI_RELATION_EMBEDS. Used to + * denote content rendered by embedded renderers that live in a separate process + * space from the embedding context. + * @ATSPI_RELATION_POPUP_FOR: Denotes that the object is a transient window or + * frame associated with another onscreen object. Similar to @ATSPI_TOOLTIP_FOR, + * but more general. Useful for windows which are technically toplevels + * but which, for one or more reasons, do not explicitly cause their + * associated window to lose 'window focus'. Creation of an @ATSPI_ROLE_WINDOW + * object with the @ATSPI_RELATION_POPUP_FOR relation usually requires + * some presentation action on the part + * of assistive technology clients, even though the previous toplevel + * @ATSPI_ROLE_FRAME object may still be the active window. + * @ATSPI_RELATION_PARENT_WINDOW_OF: This is the reciprocal relation to + * @ATSPI_RELATION_POPUP_FOR. + * @ATSPI_RELATION_DESCRIPTION_FOR: Reciprocal of %ATSPI_RELATION_DESCRIBED_BY. + * Indicates that this object provides descriptive information about the target + * object(s). See also %ATSPI_RELATION_DETAILS_FOR and %ATSPI_RELATION_ERROR_FOR. + * @ATSPI_RELATION_DESCRIBED_BY: Reciprocal of %ATSPI_RELATION_DESCRIPTION_FOR. + * Indicates that one or more target objects provide descriptive information + * about this object. This relation type is most appropriate for information + * that is not essential as its presentation may be user-configurable and/or + * limited to an on-demand mechanism such as an assistive technology command. + * For brief, essential information such as can be found in a widget's on-screen + * label, use %ATSPI_RELATION_LABELLED_BY. For an on-screen error message, use + * %ATSPI_RELATION_ERROR_MESSAGE. For lengthy extended descriptive information + * contained in an on-screen object, consider using %ATSPI_RELATION_DETAILS as + * assistive technologies may provide a means for the user to navigate to + * objects containing detailed descriptions so that their content can be more + * closely reviewed. + * @ATSPI_RELATION_DETAILS: Reciprocal of %ATSPI_RELATION_DETAILS_FOR. Indicates + * that this object has a detailed or extended description, the contents of + * which can be found in the target object(s). This relation type is most + * appropriate for information that is sufficiently lengthy as to make + * navigation to the container of that information desirable. For less verbose + * information suitable for announcement only, see %ATSPI_RELATION_DESCRIBED_BY. + * If the detailed information describes an error condition, + * %ATSPI_RELATION_ERROR_FOR should be used instead. @Since: 2.26. + * @ATSPI_RELATION_DETAILS_FOR: Reciprocal of %ATSPI_RELATION_DETAILS. Indicates + * that this object provides a detailed or extended description about the target + * object(s). See also %ATSPI_RELATION_DESCRIPTION_FOR and + * %ATSPI_RELATION_ERROR_FOR. @Since: 2.26. + * @ATSPI_RELATION_ERROR_MESSAGE: Reciprocal of %ATSPI_RELATION_ERROR_FOR. + * Indicates that this object has one or more errors, the nature of which is + * described in the contents of the target object(s). Objects that have this + * relation type should also contain %ATSPI_STATE_INVALID_ENTRY in their + * #AtspiStateSet. @Since: 2.26. + * @ATSPI_RELATION_ERROR_FOR: Reciprocal of %ATSPI_RELATION_ERROR_MESSAGE. + * Indicates that this object contains an error message describing an invalid + * condition in the target object(s). @Since: 2.26. + * @ATSPI_RELATION_LAST_DEFINED: Do not use as a parameter value, used to + * determine the size of the enumeration. + * + * #AtspiRelationType specifies a relationship between objects + * (possibly one-to-many + * or many-to-one) outside of the normal parent/child hierarchical + * relationship. It allows better semantic identification of how objects + * are associated with one another. For instance the + * @ATSPI_RELATION_LABELLED_BY + * relationship may be used to identify labelling information that should + * accompany the accessible name property when presenting an object's content or + * identity to the end user. Similarly, + * @ATSPI_RELATION_CONTROLLER_FOR can be used + * to further specify the context in which a valuator is useful, and/or the + * other UI components which are directly effected by user interactions with + * the valuator. Common examples include association of scrollbars with the + * viewport or panel which they control. + * + * + * Enumeration used to specify + * the type of relation encapsulated in an #AtspiRelation object. + * + **/ + typedef enum + { ATSPI_RELATION_NULL, ATSPI_RELATION_LABEL_FOR, ATSPI_RELATION_LABELLED_BY, @@ -912,360 +928,361 @@ typedef enum { ATSPI_RELATION_ERROR_MESSAGE, ATSPI_RELATION_ERROR_FOR, ATSPI_RELATION_LAST_DEFINED, -} AtspiRelationType; + } AtspiRelationType; /** * ATSPI_RELATIONTYPE_COUNT: * * One higher than the highest valid value of #AtspiRelationType. **/ -#define ATSPI_RELATIONTYPE_COUNT (23+1) +#define ATSPI_RELATIONTYPE_COUNT (23 + 1) -/** - * AtspiRole: - * @ATSPI_ROLE_INVALID: A role indicating an error condition, such as - * uninitialized Role data. - * @ATSPI_ROLE_ACCELERATOR_LABEL: Object is a label indicating the keyboard - * accelerators for the parent. - * @ATSPI_ROLE_ALERT: Object is used to alert the user about something. - * @ATSPI_ROLE_ANIMATION: Object contains a dynamic or moving image of some - * kind. - * @ATSPI_ROLE_ARROW: Object is a 2d directional indicator. - * @ATSPI_ROLE_CALENDAR: Object contains one or more dates, usually arranged - * into a 2d list. - * @ATSPI_ROLE_CANVAS: Object that can be drawn into and is used to trap - * events. - * @ATSPI_ROLE_CHECK_BOX: A choice that can be checked or unchecked and - * provides a separate indicator for the current state. - * @ATSPI_ROLE_CHECK_MENU_ITEM: A menu item that behaves like a check box. See - * @ATSPI_ROLE_CHECK_BOX. - * @ATSPI_ROLE_COLOR_CHOOSER: A specialized dialog that lets the user choose a - * color. - * @ATSPI_ROLE_COLUMN_HEADER: The header for a column of data. - * @ATSPI_ROLE_COMBO_BOX: A list of choices the user can select from. - * @ATSPI_ROLE_DATE_EDITOR: An object which allows entry of a date. - * @ATSPI_ROLE_DESKTOP_ICON: An inconifed internal frame within a DESKTOP_FRAME. - * @ATSPI_ROLE_DESKTOP_FRAME: A pane that supports internal frames and - * iconified versions of those internal frames. - * @ATSPI_ROLE_DIAL: An object that allows a value to be changed via rotating a - * visual element, or which displays a value via such a rotating element. - * @ATSPI_ROLE_DIALOG: A top level window with title bar and a border. - * @ATSPI_ROLE_DIRECTORY_PANE: A pane that allows the user to navigate through - * and select the contents of a directory. - * @ATSPI_ROLE_DRAWING_AREA: An object used for drawing custom user interface - * elements. - * @ATSPI_ROLE_FILE_CHOOSER: A specialized dialog that displays the files in - * the directory and lets the user select a file, browse a different - * directory, or specify a filename. - * @ATSPI_ROLE_FILLER: A object that fills up space in a user interface. - * @ATSPI_ROLE_FOCUS_TRAVERSABLE: Don't use, reserved for future use. - * @ATSPI_ROLE_FONT_CHOOSER: Allows selection of a display font. - * @ATSPI_ROLE_FRAME: A top level window with a title bar, border, menubar, - * etc. - * @ATSPI_ROLE_GLASS_PANE: A pane that is guaranteed to be painted on top of - * all panes beneath it. - * @ATSPI_ROLE_HTML_CONTAINER: A document container for HTML, whose children - * represent the document content. - * @ATSPI_ROLE_ICON: A small fixed size picture, typically used to decorate - * components. - * @ATSPI_ROLE_IMAGE: An image, typically static. - * @ATSPI_ROLE_INTERNAL_FRAME: A frame-like object that is clipped by a desktop - * pane. - * @ATSPI_ROLE_LABEL: An object used to present an icon or short string in an - * interface. - * @ATSPI_ROLE_LAYERED_PANE: A specialized pane that allows its children to be - * drawn in layers, providing a form of stacking order. - * @ATSPI_ROLE_LIST: An object that presents a list of objects to the user and - * allows the user to select one or more of them. - * @ATSPI_ROLE_LIST_ITEM: An object that represents an element of a list. - * @ATSPI_ROLE_MENU: An object usually found inside a menu bar that contains a - * list of actions the user can choose from. - * @ATSPI_ROLE_MENU_BAR: An object usually drawn at the top of the primary - * dialog box of an application that contains a list of menus the user can - * choose from. - * @ATSPI_ROLE_MENU_ITEM: An object usually contained in a menu that presents - * an action the user can choose. - * @ATSPI_ROLE_OPTION_PANE: A specialized pane whose primary use is inside a - * dialog. - * @ATSPI_ROLE_PAGE_TAB: An object that is a child of a page tab list. - * @ATSPI_ROLE_PAGE_TAB_LIST: An object that presents a series of panels (or - * page tabs), one at a time,through some mechanism provided by the - * object. - * @ATSPI_ROLE_PANEL: A generic container that is often used to group objects. - * @ATSPI_ROLE_PASSWORD_TEXT: A text object uses for passwords, or other places - * where the text content is not shown visibly to the user. - * @ATSPI_ROLE_POPUP_MENU: A temporary window that is usually used to offer the - * user a list of choices, and then hides when the user selects one of those - * choices. - * @ATSPI_ROLE_PROGRESS_BAR: An object used to indicate how much of a task has - * been completed. - * @ATSPI_ROLE_PUSH_BUTTON: An object the user can manipulate to tell the - * application to do something. - * @ATSPI_ROLE_RADIO_BUTTON: A specialized check box that will cause other - * radio buttons in the same group to become unchecked when this one is - * checked. - * @ATSPI_ROLE_RADIO_MENU_ITEM: Object is both a menu item and a "radio button" - * . See @ATSPI_ROLE_RADIO_BUTTON. - * @ATSPI_ROLE_ROOT_PANE: A specialized pane that has a glass pane and a - * layered pane as its children. - * @ATSPI_ROLE_ROW_HEADER: The header for a row of data. - * @ATSPI_ROLE_SCROLL_BAR: An object usually used to allow a user to - * incrementally view a large amount of data by moving the bounds of a - * viewport along a one-dimensional axis. - * @ATSPI_ROLE_SCROLL_PANE: An object that allows a user to incrementally view - * a large amount of information. @ATSPI_ROLE_SCROLL_PANE objects are usually - * accompanied by @ATSPI_ROLE_SCROLL_BAR controllers, on which the - * @ATSPI_RELATION_CONTROLLER_FOR and @ATSPI_RELATION_CONTROLLED_BY - * reciprocal relations are set. See #atspi_get_relation_set. - * @ATSPI_ROLE_SEPARATOR: An object usually contained in a menu to provide a - * visible and logical separation of the contents in a menu. - * @ATSPI_ROLE_SLIDER: An object that allows the user to select from a bounded - * range. Unlike @ATSPI_ROLE_SCROLL_BAR, @ATSPI_ROLE_SLIDER objects need not control - * 'viewport'-like objects. - * @ATSPI_ROLE_SPIN_BUTTON: An object which allows one of a set of choices to - * be selected, and which displays the current choice. - * @ATSPI_ROLE_SPLIT_PANE: A specialized panel that presents two other panels - * at the same time. - * @ATSPI_ROLE_STATUS_BAR: Object displays non-quantitative status information - * (c.f. @ATSPI_ROLE_PROGRESS_BAR) - * @ATSPI_ROLE_TABLE: An object used to repesent information in terms of rows - * and columns. - * @ATSPI_ROLE_TABLE_CELL: A 'cell' or discrete child within a Table. Note: - * Table cells need not have @ATSPI_ROLE_TABLE_CELL, other - * #AtspiRoleType values are valid as well. - * @ATSPI_ROLE_TABLE_COLUMN_HEADER: An object which labels a particular column - * in an #AtspiTable. - * @ATSPI_ROLE_TABLE_ROW_HEADER: An object which labels a particular row in a - * #AtspiTable. #AtspiTable rows and columns may also be labelled via the - * @ATSPI_RELATION_LABEL_FOR/@ATSPI_RELATION_LABELLED_BY relationships. - * See #atspi_get_relation_set. - * @ATSPI_ROLE_TEAROFF_MENU_ITEM: Object allows menu to be removed from menubar - * and shown in its own window. - * @ATSPI_ROLE_TERMINAL: An object that emulates a terminal. - * @ATSPI_ROLE_TEXT: An interactive widget that supports multiple lines of text - * and optionally accepts user input, but whose purpose is not to solicit user - * input. Thus @ATSPI_ROLE_TEXT is appropriate for the text view in a plain text - * editor but inappropriate for an input field in a dialog box or web form. For - * widgets whose purpose is to solicit input from the user, see @ATSPI_ROLE_ENTRY - * and @ATSPI_ROLE_PASSWORD_TEXT. For generic objects which display a brief amount - * of textual information, see @ATSPI_ROLE_STATIC. - * @ATSPI_ROLE_TOGGLE_BUTTON: A specialized push button that can be checked or - * unchecked, but does not procide a separate indicator for the current - * state. - * @ATSPI_ROLE_TOOL_BAR: A bar or palette usually composed of push buttons or - * toggle buttons. - * @ATSPI_ROLE_TOOL_TIP: An object that provides information about another - * object. - * @ATSPI_ROLE_TREE: An object used to repsent hierarchical information to the - * user. - * @ATSPI_ROLE_TREE_TABLE: An object that presents both tabular and - * hierarchical info to the user. - * @ATSPI_ROLE_UNKNOWN: The object contains some #AtspiAccessible information, - * but its role is not known. - * @ATSPI_ROLE_VIEWPORT: An object usually used in a scroll pane, or to - * otherwise clip a larger object or content renderer to a specific - * onscreen viewport. - * @ATSPI_ROLE_WINDOW: A top level window with no title or border. - * @ATSPI_ROLE_EXTENDED: means that the role for this item is known, but not - * included in the core enumeration. Deprecated since 2.24. - * @ATSPI_ROLE_HEADER: An object that serves as a document header. - * @ATSPI_ROLE_FOOTER: An object that serves as a document footer. - * @ATSPI_ROLE_PARAGRAPH: An object which is contains a single paragraph of - * text content. See also @ATSPI_ROLE_TEXT. - * @ATSPI_ROLE_RULER: An object which describes margins and tab stops, etc. - * for text objects which it controls (should have - * @ATSPI_RELATION_CONTROLLER_FOR relation to such). - * @ATSPI_ROLE_APPLICATION: An object corresponding to the toplevel accessible - * of an application, which may contain @ATSPI_ROLE_FRAME objects or other - * accessible objects. Children of objects with the #ATSPI_ROLE_DESKTOP_FRAME role are generally - * @ATSPI_ROLE_APPLICATION objects. - * @ATSPI_ROLE_AUTOCOMPLETE: The object is a dialog or list containing items - * for insertion into an entry widget, for instance a list of words for - * completion of a text entry. - * @ATSPI_ROLE_EDITBAR: The object is an editable text object in a toolbar. - * @ATSPI_ROLE_EMBEDDED: The object is an embedded component container. This - * role is a "grouping" hint that the contained objects share a context - * which is different from the container in which this accessible is - * embedded. In particular, it is used for some kinds of document embedding, - * and for embedding of out-of-process component, "panel applets", etc. - * @ATSPI_ROLE_ENTRY: The object is a component whose textual content may be - * entered or modified by the user, provided @ATSPI_STATE_EDITABLE is present. - * A readonly @ATSPI_ROLE_ENTRY object (i.e. where @ATSPI_STATE_EDITABLE is - * not present) implies a read-only 'text field' in a form, as opposed to a - * title, label, or caption. - * @ATSPI_ROLE_CHART: The object is a graphical depiction of quantitative data. - * It may contain multiple subelements whose attributes and/or description - * may be queried to obtain both the quantitative data and information about - * how the data is being presented. The @ATSPI_LABELLED_BY relation is - * particularly important in interpreting objects of this type, as is the - * accessible description property. See @ATSPI_ROLE_CAPTION. - * @ATSPI_ROLE_CAPTION: The object contains descriptive information, usually - * textual, about another user interface element such as a table, chart, or - * image. - * @ATSPI_ROLE_DOCUMENT_FRAME: The object is a visual frame or container which - * contains a view of document content. #AtspiDocument frames may occur within - * another #AtspiDocument instance, in which case the second document may be - * said to be embedded in the containing instance. HTML frames are often - * ATSPI_ROLE_DOCUMENT_FRAME: Either this object, or a singleton descendant, - * should implement the #AtspiDocument interface. - * @ATSPI_ROLE_HEADING: The object serves as a heading for content which - * follows it in a document. The 'heading level' of the heading, if - * availabe, may be obtained by querying the object's attributes. - * @ATSPI_ROLE_PAGE: The object is a containing instance which encapsulates a - * page of information. @ATSPI_ROLE_PAGE is used in documents and content which - * support a paginated navigation model. - * @ATSPI_ROLE_SECTION: The object is a containing instance of document content - * which constitutes a particular 'logical' section of the document. The - * type of content within a section, and the nature of the section division - * itself, may be obtained by querying the object's attributes. Sections - * may be nested. - * @ATSPI_ROLE_REDUNDANT_OBJECT: The object is redundant with another object in - * the hierarchy, and is exposed for purely technical reasons. Objects of - * this role should be ignored by clients, if they are encountered at all. - * @ATSPI_ROLE_FORM: The object is a containing instance of document content - * which has within it components with which the user can interact in order - * to input information; i.e. the object is a container for pushbuttons, - * comboboxes, text input fields, and other 'GUI' components. @ATSPI_ROLE_FORM - * should not, in general, be used for toplevel GUI containers or dialogs, - * but should be reserved for 'GUI' containers which occur within document - * content, for instance within Web documents, presentations, or text - * documents. Unlike other GUI containers and dialogs which occur inside - * application instances, @ATSPI_ROLE_FORM containers' components are - * associated with the current document, rather than the current foreground - * application or viewer instance. - * @ATSPI_ROLE_LINK: The object is a hypertext anchor, i.e. a "link" in a - * hypertext document. Such objects are distinct from 'inline' content - * which may also use the #AtspiHypertext/#AtspiHyperlink interfacesto indicate - * the range/location within a text object where an inline or embedded object - * lies. - * @ATSPI_ROLE_INPUT_METHOD_WINDOW: The object is a window or similar viewport - * which is used to allow composition or input of a 'complex character', - * in other words it is an "input method window". - * @ATSPI_ROLE_TABLE_ROW: A row in a table. - * @ATSPI_ROLE_TREE_ITEM: An object that represents an element of a tree. - * @ATSPI_ROLE_DOCUMENT_SPREADSHEET: A document frame which contains a - * spreadsheet. - * @ATSPI_ROLE_DOCUMENT_PRESENTATION: A document frame which contains a - * presentation or slide content. - * @ATSPI_ROLE_DOCUMENT_TEXT: A document frame which contains textual content, - * such as found in a word processing - * application. - * @ATSPI_ROLE_DOCUMENT_WEB: A document frame which contains HTML or other - * markup suitable for display in a web browser. - * @ATSPI_ROLE_DOCUMENT_EMAIL: A document frame which contains email content - * to be displayed or composed either in plain text or - * HTML. - * @ATSPI_ROLE_COMMENT: An object found within a document and designed to - * present a comment, note, or other annotation. In some cases, this object - * might not be visible until activated. - * @ATSPI_ROLE_LIST_BOX: A non-collapsible list of choices the user can - * select from. - * @ATSPI_ROLE_GROUPING: A group of related widgets. This group typically has - * a label. - * @ATSPI_ROLE_IMAGE_MAP: An image map object. Usually a graphic with multiple - * hotspots, where each hotspot can be activated resulting in the loading of - * another document or section of a document. - * @ATSPI_ROLE_NOTIFICATION: A transitory object designed to present a - * message to the user, typically at the desktop level rather than inside a - * particular application. - * @ATSPI_ROLE_INFO_BAR: An object designed to present a message to the user - * within an existing window. - * @ATSPI_ROLE_LEVEL_BAR: A bar that serves as a level indicator to, for - * instance, show the strength of a password or the state of a battery. @Since: 2.8 - * @ATSPI_ROLE_TITLE_BAR: A bar that serves as the title of a window or a - * dialog. @Since: 2.12 - * @ATSPI_ROLE_BLOCK_QUOTE: An object which contains a text section - * that is quoted from another source. @Since: 2.12 - * @ATSPI_ROLE_AUDIO: An object which represents an audio - * element. @Since: 2.12 - * @ATSPI_ROLE_VIDEO: An object which represents a video - * element. @Since: 2.12 - * @ATSPI_ROLE_DEFINITION: A definition of a term or concept. @Since: 2.12 - * @ATSPI_ROLE_ARTICLE: A section of a page that consists of a - * composition that forms an independent part of a document, page, or - * site. Examples: A blog entry, a news story, a forum post. @Since: - * 2.12 - * @ATSPI_ROLE_LANDMARK: A region of a web page intended as a - * navigational landmark. This is designed to allow Assistive - * Technologies to provide quick navigation among key regions within a - * document. @Since: 2.12 - * @ATSPI_ROLE_LOG: A text widget or container holding log content, such - * as chat history and error logs. In this role there is a - * relationship between the arrival of new items in the log and the - * reading order. The log contains a meaningful sequence and new - * information is added only to the end of the log, not at arbitrary - * points. @Since: 2.12 - * @ATSPI_ROLE_MARQUEE: A container where non-essential information - * changes frequently. Common usages of marquee include stock tickers - * and ad banners. The primary difference between a marquee and a log - * is that logs usually have a meaningful order or sequence of - * important content changes. @Since: 2.12 - * @ATSPI_ROLE_MATH: A text widget or container that holds a mathematical - * expression. @Since: 2.12 - * @ATSPI_ROLE_RATING: A widget whose purpose is to display a rating, - * such as the number of stars associated with a song in a media - * player. Objects of this role should also implement - * AtspiValue. @Since: 2.12 - * @ATSPI_ROLE_TIMER: An object containing a numerical counter which - * indicates an amount of elapsed time from a start point, or the time - * remaining until an end point. @Since: 2.12 - * @ATSPI_ROLE_STATIC: A generic non-container object whose purpose is to display - * a brief amount of information to the user and whose role is known by the - * implementor but lacks semantic value for the user. Examples in which - * @ATSPI_ROLE_STATIC is appropriate include the message displayed in a message - * box and an image used as an alternative means to display text. - * @ATSPI_ROLE_STATIC should not be applied to widgets which are traditionally - * interactive, objects which display a significant amount of content, or any - * object which has an accessible relation pointing to another object. The - * displayed information, as a general rule, should be exposed through the - * accessible name of the object. For labels which describe another widget, see - * @ATSPI_ROLE_LABEL. For text views, see @ATSPI_ROLE_TEXT. For generic - * containers, see @ATSPI_ROLE_PANEL. For objects whose role is not known by the - * implementor, see @ATSPI_ROLE_UNKNOWN. @Since: 2.16. - * @ATSPI_ROLE_MATH_FRACTION: An object that represents a mathematical fraction. @Since: 2.16. - * @ATSPI_ROLE_MATH_ROOT: An object that represents a mathematical expression - * displayed with a radical. @Since: 2.16. - * @ATSPI_ROLE_SUBSCRIPT: An object that contains text that is displayed as a - * subscript. @Since: 2.16. - * @ATSPI_ROLE_SUPERSCRIPT: An object that contains text that is displayed as a - * superscript. @Since: 2.16. - * @ATSPI_ROLE_DESCRIPTION_LIST: An object that represents a list of term-value - * groups. A term-value group represents an individual description and consist - * of one or more names (@ATSPI_ROLE_DESCRIPTION_TERM) followed by one or more - * values (@ATSPI_ROLE_DESCRIPTION_VALUE). For each list, there should not be - * more than one group with the same term name. @Since: 2.26. - * @ATSPI_ROLE_DESCRIPTION_TERM: An object that represents a term or phrase - * with a corresponding definition. @Since: 2.26. - * @ATSPI_ROLE_DESCRIPTION_VALUE: An object that represents the description, - * definition, or value of a term. @Since: 2.26. - * @ATSPI_ROLE_FOOTNOTE: An object that contains the text of a footnote. @Since: 2.26. - * @ATSPI_ROLE_CONTENT_DELETION: Content previously deleted or proposed to be - * deleted, e.g. in revision history or a content view providing suggestions - * from reviewers. @Since: 2.34. - * @ATSPI_ROLE_CONTENT_INSERTION: Content previously inserted or proposed to be - * inserted, e.g. in revision history or a content view providing suggestions - * from reviewers. @Since: 2.34. - * @ATSPI_ROLE_MARK: A run of content that is marked or highlighted, such as for - * reference purposes, or to call it out as having a special purpose. If the - * marked content has an associated section in the document elaborating on the - * reason for the mark, then %ATSPI_RELATION_DETAILS should be used on the mark - * to point to that associated section. In addition, the reciprocal relation - * %ATSPI_RELATION_DETAILS_FOR should be used on the associated content section - * to point back to the mark. @Since: 2.36. - * @ATSPI_ROLE_SUGGESTION: A container for content that is called out as a proposed - * change from the current version of the document, such as by a reviewer of the - * content. An object with this role should include children with %ATSPI_ROLE_CONTENT_DELETION and/or - * %ATSPI_ROLE_CONTENT_INSERTION, in any order, to indicate what the - * actual change is. @Since: 2.36 - * @ATSPI_ROLE_PUSH_BUTTON_MENU: A specialized push button to open a menu. @Since 2.46 - * @ATSPI_ROLE_LAST_DEFINED: Not a valid role, used for finding end of - * enumeration. - * - * Enumeration used by interface #AtspiAccessible to specify the role - * of an #AtspiAccessible object. - * - */ -typedef enum { + /** + * AtspiRole: + * @ATSPI_ROLE_INVALID: A role indicating an error condition, such as + * uninitialized Role data. + * @ATSPI_ROLE_ACCELERATOR_LABEL: Object is a label indicating the keyboard + * accelerators for the parent. + * @ATSPI_ROLE_ALERT: Object is used to alert the user about something. + * @ATSPI_ROLE_ANIMATION: Object contains a dynamic or moving image of some + * kind. + * @ATSPI_ROLE_ARROW: Object is a 2d directional indicator. + * @ATSPI_ROLE_CALENDAR: Object contains one or more dates, usually arranged + * into a 2d list. + * @ATSPI_ROLE_CANVAS: Object that can be drawn into and is used to trap + * events. + * @ATSPI_ROLE_CHECK_BOX: A choice that can be checked or unchecked and + * provides a separate indicator for the current state. + * @ATSPI_ROLE_CHECK_MENU_ITEM: A menu item that behaves like a check box. See + * @ATSPI_ROLE_CHECK_BOX. + * @ATSPI_ROLE_COLOR_CHOOSER: A specialized dialog that lets the user choose a + * color. + * @ATSPI_ROLE_COLUMN_HEADER: The header for a column of data. + * @ATSPI_ROLE_COMBO_BOX: A list of choices the user can select from. + * @ATSPI_ROLE_DATE_EDITOR: An object which allows entry of a date. + * @ATSPI_ROLE_DESKTOP_ICON: An inconifed internal frame within a DESKTOP_FRAME. + * @ATSPI_ROLE_DESKTOP_FRAME: A pane that supports internal frames and + * iconified versions of those internal frames. + * @ATSPI_ROLE_DIAL: An object that allows a value to be changed via rotating a + * visual element, or which displays a value via such a rotating element. + * @ATSPI_ROLE_DIALOG: A top level window with title bar and a border. + * @ATSPI_ROLE_DIRECTORY_PANE: A pane that allows the user to navigate through + * and select the contents of a directory. + * @ATSPI_ROLE_DRAWING_AREA: An object used for drawing custom user interface + * elements. + * @ATSPI_ROLE_FILE_CHOOSER: A specialized dialog that displays the files in + * the directory and lets the user select a file, browse a different + * directory, or specify a filename. + * @ATSPI_ROLE_FILLER: A object that fills up space in a user interface. + * @ATSPI_ROLE_FOCUS_TRAVERSABLE: Don't use, reserved for future use. + * @ATSPI_ROLE_FONT_CHOOSER: Allows selection of a display font. + * @ATSPI_ROLE_FRAME: A top level window with a title bar, border, menubar, + * etc. + * @ATSPI_ROLE_GLASS_PANE: A pane that is guaranteed to be painted on top of + * all panes beneath it. + * @ATSPI_ROLE_HTML_CONTAINER: A document container for HTML, whose children + * represent the document content. + * @ATSPI_ROLE_ICON: A small fixed size picture, typically used to decorate + * components. + * @ATSPI_ROLE_IMAGE: An image, typically static. + * @ATSPI_ROLE_INTERNAL_FRAME: A frame-like object that is clipped by a desktop + * pane. + * @ATSPI_ROLE_LABEL: An object used to present an icon or short string in an + * interface. + * @ATSPI_ROLE_LAYERED_PANE: A specialized pane that allows its children to be + * drawn in layers, providing a form of stacking order. + * @ATSPI_ROLE_LIST: An object that presents a list of objects to the user and + * allows the user to select one or more of them. + * @ATSPI_ROLE_LIST_ITEM: An object that represents an element of a list. + * @ATSPI_ROLE_MENU: An object usually found inside a menu bar that contains a + * list of actions the user can choose from. + * @ATSPI_ROLE_MENU_BAR: An object usually drawn at the top of the primary + * dialog box of an application that contains a list of menus the user can + * choose from. + * @ATSPI_ROLE_MENU_ITEM: An object usually contained in a menu that presents + * an action the user can choose. + * @ATSPI_ROLE_OPTION_PANE: A specialized pane whose primary use is inside a + * dialog. + * @ATSPI_ROLE_PAGE_TAB: An object that is a child of a page tab list. + * @ATSPI_ROLE_PAGE_TAB_LIST: An object that presents a series of panels (or + * page tabs), one at a time,through some mechanism provided by the + * object. + * @ATSPI_ROLE_PANEL: A generic container that is often used to group objects. + * @ATSPI_ROLE_PASSWORD_TEXT: A text object uses for passwords, or other places + * where the text content is not shown visibly to the user. + * @ATSPI_ROLE_POPUP_MENU: A temporary window that is usually used to offer the + * user a list of choices, and then hides when the user selects one of those + * choices. + * @ATSPI_ROLE_PROGRESS_BAR: An object used to indicate how much of a task has + * been completed. + * @ATSPI_ROLE_PUSH_BUTTON: An object the user can manipulate to tell the + * application to do something. + * @ATSPI_ROLE_RADIO_BUTTON: A specialized check box that will cause other + * radio buttons in the same group to become unchecked when this one is + * checked. + * @ATSPI_ROLE_RADIO_MENU_ITEM: Object is both a menu item and a "radio button" + * . See @ATSPI_ROLE_RADIO_BUTTON. + * @ATSPI_ROLE_ROOT_PANE: A specialized pane that has a glass pane and a + * layered pane as its children. + * @ATSPI_ROLE_ROW_HEADER: The header for a row of data. + * @ATSPI_ROLE_SCROLL_BAR: An object usually used to allow a user to + * incrementally view a large amount of data by moving the bounds of a + * viewport along a one-dimensional axis. + * @ATSPI_ROLE_SCROLL_PANE: An object that allows a user to incrementally view + * a large amount of information. @ATSPI_ROLE_SCROLL_PANE objects are usually + * accompanied by @ATSPI_ROLE_SCROLL_BAR controllers, on which the + * @ATSPI_RELATION_CONTROLLER_FOR and @ATSPI_RELATION_CONTROLLED_BY + * reciprocal relations are set. See #atspi_get_relation_set. + * @ATSPI_ROLE_SEPARATOR: An object usually contained in a menu to provide a + * visible and logical separation of the contents in a menu. + * @ATSPI_ROLE_SLIDER: An object that allows the user to select from a bounded + * range. Unlike @ATSPI_ROLE_SCROLL_BAR, @ATSPI_ROLE_SLIDER objects need not control + * 'viewport'-like objects. + * @ATSPI_ROLE_SPIN_BUTTON: An object which allows one of a set of choices to + * be selected, and which displays the current choice. + * @ATSPI_ROLE_SPLIT_PANE: A specialized panel that presents two other panels + * at the same time. + * @ATSPI_ROLE_STATUS_BAR: Object displays non-quantitative status information + * (c.f. @ATSPI_ROLE_PROGRESS_BAR) + * @ATSPI_ROLE_TABLE: An object used to repesent information in terms of rows + * and columns. + * @ATSPI_ROLE_TABLE_CELL: A 'cell' or discrete child within a Table. Note: + * Table cells need not have @ATSPI_ROLE_TABLE_CELL, other + * #AtspiRoleType values are valid as well. + * @ATSPI_ROLE_TABLE_COLUMN_HEADER: An object which labels a particular column + * in an #AtspiTable. + * @ATSPI_ROLE_TABLE_ROW_HEADER: An object which labels a particular row in a + * #AtspiTable. #AtspiTable rows and columns may also be labelled via the + * @ATSPI_RELATION_LABEL_FOR/@ATSPI_RELATION_LABELLED_BY relationships. + * See #atspi_get_relation_set. + * @ATSPI_ROLE_TEAROFF_MENU_ITEM: Object allows menu to be removed from menubar + * and shown in its own window. + * @ATSPI_ROLE_TERMINAL: An object that emulates a terminal. + * @ATSPI_ROLE_TEXT: An interactive widget that supports multiple lines of text + * and optionally accepts user input, but whose purpose is not to solicit user + * input. Thus @ATSPI_ROLE_TEXT is appropriate for the text view in a plain text + * editor but inappropriate for an input field in a dialog box or web form. For + * widgets whose purpose is to solicit input from the user, see @ATSPI_ROLE_ENTRY + * and @ATSPI_ROLE_PASSWORD_TEXT. For generic objects which display a brief amount + * of textual information, see @ATSPI_ROLE_STATIC. + * @ATSPI_ROLE_TOGGLE_BUTTON: A specialized push button that can be checked or + * unchecked, but does not procide a separate indicator for the current + * state. + * @ATSPI_ROLE_TOOL_BAR: A bar or palette usually composed of push buttons or + * toggle buttons. + * @ATSPI_ROLE_TOOL_TIP: An object that provides information about another + * object. + * @ATSPI_ROLE_TREE: An object used to repsent hierarchical information to the + * user. + * @ATSPI_ROLE_TREE_TABLE: An object that presents both tabular and + * hierarchical info to the user. + * @ATSPI_ROLE_UNKNOWN: The object contains some #AtspiAccessible information, + * but its role is not known. + * @ATSPI_ROLE_VIEWPORT: An object usually used in a scroll pane, or to + * otherwise clip a larger object or content renderer to a specific + * onscreen viewport. + * @ATSPI_ROLE_WINDOW: A top level window with no title or border. + * @ATSPI_ROLE_EXTENDED: means that the role for this item is known, but not + * included in the core enumeration. Deprecated since 2.24. + * @ATSPI_ROLE_HEADER: An object that serves as a document header. + * @ATSPI_ROLE_FOOTER: An object that serves as a document footer. + * @ATSPI_ROLE_PARAGRAPH: An object which is contains a single paragraph of + * text content. See also @ATSPI_ROLE_TEXT. + * @ATSPI_ROLE_RULER: An object which describes margins and tab stops, etc. + * for text objects which it controls (should have + * @ATSPI_RELATION_CONTROLLER_FOR relation to such). + * @ATSPI_ROLE_APPLICATION: An object corresponding to the toplevel accessible + * of an application, which may contain @ATSPI_ROLE_FRAME objects or other + * accessible objects. Children of objects with the #ATSPI_ROLE_DESKTOP_FRAME role are generally + * @ATSPI_ROLE_APPLICATION objects. + * @ATSPI_ROLE_AUTOCOMPLETE: The object is a dialog or list containing items + * for insertion into an entry widget, for instance a list of words for + * completion of a text entry. + * @ATSPI_ROLE_EDITBAR: The object is an editable text object in a toolbar. + * @ATSPI_ROLE_EMBEDDED: The object is an embedded component container. This + * role is a "grouping" hint that the contained objects share a context + * which is different from the container in which this accessible is + * embedded. In particular, it is used for some kinds of document embedding, + * and for embedding of out-of-process component, "panel applets", etc. + * @ATSPI_ROLE_ENTRY: The object is a component whose textual content may be + * entered or modified by the user, provided @ATSPI_STATE_EDITABLE is present. + * A readonly @ATSPI_ROLE_ENTRY object (i.e. where @ATSPI_STATE_EDITABLE is + * not present) implies a read-only 'text field' in a form, as opposed to a + * title, label, or caption. + * @ATSPI_ROLE_CHART: The object is a graphical depiction of quantitative data. + * It may contain multiple subelements whose attributes and/or description + * may be queried to obtain both the quantitative data and information about + * how the data is being presented. The @ATSPI_LABELLED_BY relation is + * particularly important in interpreting objects of this type, as is the + * accessible description property. See @ATSPI_ROLE_CAPTION. + * @ATSPI_ROLE_CAPTION: The object contains descriptive information, usually + * textual, about another user interface element such as a table, chart, or + * image. + * @ATSPI_ROLE_DOCUMENT_FRAME: The object is a visual frame or container which + * contains a view of document content. #AtspiDocument frames may occur within + * another #AtspiDocument instance, in which case the second document may be + * said to be embedded in the containing instance. HTML frames are often + * ATSPI_ROLE_DOCUMENT_FRAME: Either this object, or a singleton descendant, + * should implement the #AtspiDocument interface. + * @ATSPI_ROLE_HEADING: The object serves as a heading for content which + * follows it in a document. The 'heading level' of the heading, if + * availabe, may be obtained by querying the object's attributes. + * @ATSPI_ROLE_PAGE: The object is a containing instance which encapsulates a + * page of information. @ATSPI_ROLE_PAGE is used in documents and content which + * support a paginated navigation model. + * @ATSPI_ROLE_SECTION: The object is a containing instance of document content + * which constitutes a particular 'logical' section of the document. The + * type of content within a section, and the nature of the section division + * itself, may be obtained by querying the object's attributes. Sections + * may be nested. + * @ATSPI_ROLE_REDUNDANT_OBJECT: The object is redundant with another object in + * the hierarchy, and is exposed for purely technical reasons. Objects of + * this role should be ignored by clients, if they are encountered at all. + * @ATSPI_ROLE_FORM: The object is a containing instance of document content + * which has within it components with which the user can interact in order + * to input information; i.e. the object is a container for pushbuttons, + * comboboxes, text input fields, and other 'GUI' components. @ATSPI_ROLE_FORM + * should not, in general, be used for toplevel GUI containers or dialogs, + * but should be reserved for 'GUI' containers which occur within document + * content, for instance within Web documents, presentations, or text + * documents. Unlike other GUI containers and dialogs which occur inside + * application instances, @ATSPI_ROLE_FORM containers' components are + * associated with the current document, rather than the current foreground + * application or viewer instance. + * @ATSPI_ROLE_LINK: The object is a hypertext anchor, i.e. a "link" in a + * hypertext document. Such objects are distinct from 'inline' content + * which may also use the #AtspiHypertext/#AtspiHyperlink interfacesto indicate + * the range/location within a text object where an inline or embedded object + * lies. + * @ATSPI_ROLE_INPUT_METHOD_WINDOW: The object is a window or similar viewport + * which is used to allow composition or input of a 'complex character', + * in other words it is an "input method window". + * @ATSPI_ROLE_TABLE_ROW: A row in a table. + * @ATSPI_ROLE_TREE_ITEM: An object that represents an element of a tree. + * @ATSPI_ROLE_DOCUMENT_SPREADSHEET: A document frame which contains a + * spreadsheet. + * @ATSPI_ROLE_DOCUMENT_PRESENTATION: A document frame which contains a + * presentation or slide content. + * @ATSPI_ROLE_DOCUMENT_TEXT: A document frame which contains textual content, + * such as found in a word processing + * application. + * @ATSPI_ROLE_DOCUMENT_WEB: A document frame which contains HTML or other + * markup suitable for display in a web browser. + * @ATSPI_ROLE_DOCUMENT_EMAIL: A document frame which contains email content + * to be displayed or composed either in plain text or + * HTML. + * @ATSPI_ROLE_COMMENT: An object found within a document and designed to + * present a comment, note, or other annotation. In some cases, this object + * might not be visible until activated. + * @ATSPI_ROLE_LIST_BOX: A non-collapsible list of choices the user can + * select from. + * @ATSPI_ROLE_GROUPING: A group of related widgets. This group typically has + * a label. + * @ATSPI_ROLE_IMAGE_MAP: An image map object. Usually a graphic with multiple + * hotspots, where each hotspot can be activated resulting in the loading of + * another document or section of a document. + * @ATSPI_ROLE_NOTIFICATION: A transitory object designed to present a + * message to the user, typically at the desktop level rather than inside a + * particular application. + * @ATSPI_ROLE_INFO_BAR: An object designed to present a message to the user + * within an existing window. + * @ATSPI_ROLE_LEVEL_BAR: A bar that serves as a level indicator to, for + * instance, show the strength of a password or the state of a battery. @Since: 2.8 + * @ATSPI_ROLE_TITLE_BAR: A bar that serves as the title of a window or a + * dialog. @Since: 2.12 + * @ATSPI_ROLE_BLOCK_QUOTE: An object which contains a text section + * that is quoted from another source. @Since: 2.12 + * @ATSPI_ROLE_AUDIO: An object which represents an audio + * element. @Since: 2.12 + * @ATSPI_ROLE_VIDEO: An object which represents a video + * element. @Since: 2.12 + * @ATSPI_ROLE_DEFINITION: A definition of a term or concept. @Since: 2.12 + * @ATSPI_ROLE_ARTICLE: A section of a page that consists of a + * composition that forms an independent part of a document, page, or + * site. Examples: A blog entry, a news story, a forum post. @Since: + * 2.12 + * @ATSPI_ROLE_LANDMARK: A region of a web page intended as a + * navigational landmark. This is designed to allow Assistive + * Technologies to provide quick navigation among key regions within a + * document. @Since: 2.12 + * @ATSPI_ROLE_LOG: A text widget or container holding log content, such + * as chat history and error logs. In this role there is a + * relationship between the arrival of new items in the log and the + * reading order. The log contains a meaningful sequence and new + * information is added only to the end of the log, not at arbitrary + * points. @Since: 2.12 + * @ATSPI_ROLE_MARQUEE: A container where non-essential information + * changes frequently. Common usages of marquee include stock tickers + * and ad banners. The primary difference between a marquee and a log + * is that logs usually have a meaningful order or sequence of + * important content changes. @Since: 2.12 + * @ATSPI_ROLE_MATH: A text widget or container that holds a mathematical + * expression. @Since: 2.12 + * @ATSPI_ROLE_RATING: A widget whose purpose is to display a rating, + * such as the number of stars associated with a song in a media + * player. Objects of this role should also implement + * AtspiValue. @Since: 2.12 + * @ATSPI_ROLE_TIMER: An object containing a numerical counter which + * indicates an amount of elapsed time from a start point, or the time + * remaining until an end point. @Since: 2.12 + * @ATSPI_ROLE_STATIC: A generic non-container object whose purpose is to display + * a brief amount of information to the user and whose role is known by the + * implementor but lacks semantic value for the user. Examples in which + * @ATSPI_ROLE_STATIC is appropriate include the message displayed in a message + * box and an image used as an alternative means to display text. + * @ATSPI_ROLE_STATIC should not be applied to widgets which are traditionally + * interactive, objects which display a significant amount of content, or any + * object which has an accessible relation pointing to another object. The + * displayed information, as a general rule, should be exposed through the + * accessible name of the object. For labels which describe another widget, see + * @ATSPI_ROLE_LABEL. For text views, see @ATSPI_ROLE_TEXT. For generic + * containers, see @ATSPI_ROLE_PANEL. For objects whose role is not known by the + * implementor, see @ATSPI_ROLE_UNKNOWN. @Since: 2.16. + * @ATSPI_ROLE_MATH_FRACTION: An object that represents a mathematical fraction. @Since: 2.16. + * @ATSPI_ROLE_MATH_ROOT: An object that represents a mathematical expression + * displayed with a radical. @Since: 2.16. + * @ATSPI_ROLE_SUBSCRIPT: An object that contains text that is displayed as a + * subscript. @Since: 2.16. + * @ATSPI_ROLE_SUPERSCRIPT: An object that contains text that is displayed as a + * superscript. @Since: 2.16. + * @ATSPI_ROLE_DESCRIPTION_LIST: An object that represents a list of term-value + * groups. A term-value group represents an individual description and consist + * of one or more names (@ATSPI_ROLE_DESCRIPTION_TERM) followed by one or more + * values (@ATSPI_ROLE_DESCRIPTION_VALUE). For each list, there should not be + * more than one group with the same term name. @Since: 2.26. + * @ATSPI_ROLE_DESCRIPTION_TERM: An object that represents a term or phrase + * with a corresponding definition. @Since: 2.26. + * @ATSPI_ROLE_DESCRIPTION_VALUE: An object that represents the description, + * definition, or value of a term. @Since: 2.26. + * @ATSPI_ROLE_FOOTNOTE: An object that contains the text of a footnote. @Since: 2.26. + * @ATSPI_ROLE_CONTENT_DELETION: Content previously deleted or proposed to be + * deleted, e.g. in revision history or a content view providing suggestions + * from reviewers. @Since: 2.34. + * @ATSPI_ROLE_CONTENT_INSERTION: Content previously inserted or proposed to be + * inserted, e.g. in revision history or a content view providing suggestions + * from reviewers. @Since: 2.34. + * @ATSPI_ROLE_MARK: A run of content that is marked or highlighted, such as for + * reference purposes, or to call it out as having a special purpose. If the + * marked content has an associated section in the document elaborating on the + * reason for the mark, then %ATSPI_RELATION_DETAILS should be used on the mark + * to point to that associated section. In addition, the reciprocal relation + * %ATSPI_RELATION_DETAILS_FOR should be used on the associated content section + * to point back to the mark. @Since: 2.36. + * @ATSPI_ROLE_SUGGESTION: A container for content that is called out as a proposed + * change from the current version of the document, such as by a reviewer of the + * content. An object with this role should include children with %ATSPI_ROLE_CONTENT_DELETION and/or + * %ATSPI_ROLE_CONTENT_INSERTION, in any order, to indicate what the + * actual change is. @Since: 2.36 + * @ATSPI_ROLE_PUSH_BUTTON_MENU: A specialized push button to open a menu. @Since 2.46 + * @ATSPI_ROLE_LAST_DEFINED: Not a valid role, used for finding end of + * enumeration. + * + * Enumeration used by interface #AtspiAccessible to specify the role + * of an #AtspiAccessible object. + * + */ + typedef enum + { ATSPI_ROLE_INVALID, ATSPI_ROLE_ACCELERATOR_LABEL, ATSPI_ROLE_ALERT, @@ -1397,67 +1414,68 @@ typedef enum { ATSPI_ROLE_SUGGESTION, ATSPI_ROLE_PUSH_BUTTON_MENU, ATSPI_ROLE_LAST_DEFINED, -} AtspiRole; + } AtspiRole; /** * ATSPI_ROLE_COUNT: * * One higher than the highest valid value of #AtspiRole. */ -#define ATSPI_ROLE_COUNT (129+1) +#define ATSPI_ROLE_COUNT (129 + 1) -typedef enum -{ - ATSPI_CACHE_NONE = 0, - ATSPI_CACHE_PARENT = 1 << 0, - ATSPI_CACHE_CHILDREN = 1 << 1, - ATSPI_CACHE_NAME = 1 << 2, - ATSPI_CACHE_DESCRIPTION = 1 << 3, - ATSPI_CACHE_STATES = 1 << 4, - ATSPI_CACHE_ROLE = 1 << 5, - ATSPI_CACHE_INTERFACES = 1 << 6, - ATSPI_CACHE_ATTRIBUTES = 1 << 7, - ATSPI_CACHE_ALL = 0x3fffffff, - ATSPI_CACHE_DEFAULT = ATSPI_CACHE_PARENT | ATSPI_CACHE_CHILDREN | ATSPI_CACHE_NAME | ATSPI_CACHE_DESCRIPTION | ATSPI_CACHE_STATES | ATSPI_CACHE_ROLE | ATSPI_CACHE_INTERFACES, - ATSPI_CACHE_UNDEFINED = 0x40000000, -} AtspiCache; + typedef enum + { + ATSPI_CACHE_NONE = 0, + ATSPI_CACHE_PARENT = 1 << 0, + ATSPI_CACHE_CHILDREN = 1 << 1, + ATSPI_CACHE_NAME = 1 << 2, + ATSPI_CACHE_DESCRIPTION = 1 << 3, + ATSPI_CACHE_STATES = 1 << 4, + ATSPI_CACHE_ROLE = 1 << 5, + ATSPI_CACHE_INTERFACES = 1 << 6, + ATSPI_CACHE_ATTRIBUTES = 1 << 7, + ATSPI_CACHE_ALL = 0x3fffffff, + ATSPI_CACHE_DEFAULT = ATSPI_CACHE_PARENT | ATSPI_CACHE_CHILDREN | ATSPI_CACHE_NAME | ATSPI_CACHE_DESCRIPTION | ATSPI_CACHE_STATES | ATSPI_CACHE_ROLE | ATSPI_CACHE_INTERFACES, + ATSPI_CACHE_UNDEFINED = 0x40000000, + } AtspiCache; -/** - * AtspiScrollType: - * @ATSPI_SCROLL_TOP_LEFT: Scroll the object to the top left corner of the - * window. - * @ATSPI_SCROLL_BOTTOM_RIGHT: Scroll the object to the bottom right corner of - * the window. - * @ATSPI_SCROLL_TOP_EDGE: Scroll the object to the top edge of the window. - * @ATSPI_SCROLL_BOTTOM_EDGE: Scroll the object to the bottom edge of the - * window. - * @ATSPI_SCROLL_LEFT_EDGE: Scroll the object to the left edge of the - * window. - * @ATSPI_SCROLL_RIGHT_EDGE: Scroll the object to the right edge of the - * window. - * @ATSPI_SCROLL_ANYWHERE: Scroll the object to application-dependent position - * on the window. - * - * Enumeration used by interface #AtspiAccessible to specify where an - * #AtspiAccessible object should be placed on the screen when using scroll_to. - * - */ -typedef enum { - ATSPI_SCROLL_TOP_LEFT, - ATSPI_SCROLL_BOTTOM_RIGHT, - ATSPI_SCROLL_TOP_EDGE, - ATSPI_SCROLL_BOTTOM_EDGE, - ATSPI_SCROLL_LEFT_EDGE, - ATSPI_SCROLL_RIGHT_EDGE, - ATSPI_SCROLL_ANYWHERE -} AtspiScrollType; + /** + * AtspiScrollType: + * @ATSPI_SCROLL_TOP_LEFT: Scroll the object to the top left corner of the + * window. + * @ATSPI_SCROLL_BOTTOM_RIGHT: Scroll the object to the bottom right corner of + * the window. + * @ATSPI_SCROLL_TOP_EDGE: Scroll the object to the top edge of the window. + * @ATSPI_SCROLL_BOTTOM_EDGE: Scroll the object to the bottom edge of the + * window. + * @ATSPI_SCROLL_LEFT_EDGE: Scroll the object to the left edge of the + * window. + * @ATSPI_SCROLL_RIGHT_EDGE: Scroll the object to the right edge of the + * window. + * @ATSPI_SCROLL_ANYWHERE: Scroll the object to application-dependent position + * on the window. + * + * Enumeration used by interface #AtspiAccessible to specify where an + * #AtspiAccessible object should be placed on the screen when using scroll_to. + * + */ + typedef enum + { + ATSPI_SCROLL_TOP_LEFT, + ATSPI_SCROLL_BOTTOM_RIGHT, + ATSPI_SCROLL_TOP_EDGE, + ATSPI_SCROLL_BOTTOM_EDGE, + ATSPI_SCROLL_LEFT_EDGE, + ATSPI_SCROLL_RIGHT_EDGE, + ATSPI_SCROLL_ANYWHERE + } AtspiScrollType; /** * ATSPI_SCROLLTYPE_COUNT: * * One higher than the highest valid value of #AtspiScrollType. */ -#define ATSPI_SCROLLTYPE_COUNT (6+1) +#define ATSPI_SCROLLTYPE_COUNT (6 + 1) #define ATSPI_DBUS_NAME_REGISTRY "org.a11y.atspi.Registry" #define ATSPI_DBUS_PATH_REGISTRY "/org/a11y/atspi/registry" @@ -1497,4 +1515,4 @@ typedef enum { #ifdef __cplusplus } #endif -#endif /* _ATSPI_CONSTANTS_H_ */ +#endif /* _ATSPI_CONSTANTS_H_ */ diff --git a/atspi/atspi-device-legacy.c b/atspi/atspi-device-legacy.c index eec11378..d440483a 100644 --- a/atspi/atspi-device-legacy.c +++ b/atspi/atspi-device-legacy.c @@ -20,14 +20,14 @@ * Boston, MA 02110-1301, USA. */ -#include "atspi-private.h" #include "atspi-device-legacy.h" +#include "atspi-private.h" #ifdef HAVE_X11 +#include <X11/XKBlib.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/extensions/XInput2.h> -#include <X11/XKBlib.h> #endif typedef struct @@ -52,10 +52,7 @@ struct _AtspiDeviceLegacyPrivate GObjectClass *device_legacy_parent_class; -G_DEFINE_TYPE_WITH_CODE (AtspiDeviceLegacy, atspi_device_legacy, - ATSPI_TYPE_DEVICE, - G_ADD_PRIVATE (AtspiDeviceLegacy)) - +G_DEFINE_TYPE_WITH_CODE (AtspiDeviceLegacy, atspi_device_legacy, ATSPI_TYPE_DEVICE, G_ADD_PRIVATE (AtspiDeviceLegacy)) static guint find_virtual_mapping (AtspiDeviceLegacy *legacy_device, gint keycode) @@ -64,11 +61,11 @@ find_virtual_mapping (AtspiDeviceLegacy *legacy_device, gint keycode) GSList *l; for (l = priv->modifiers; l; l = l->next) - { - AtspiLegacyKeyModifier *entry = l->data; - if (entry->keycode == keycode) - return entry->modifier; - } + { + AtspiLegacyKeyModifier *entry = l->data; + if (entry->keycode == keycode) + return entry->modifier; + } return 0; } @@ -85,7 +82,6 @@ set_virtual_modifier (AtspiDeviceLegacy *legacy_device, gint keycode, gboolean e priv->virtual_mods_enabled &= ~modifier; } - static gboolean key_cb (AtspiDeviceEvent *event, void *user_data) { @@ -93,16 +89,16 @@ key_cb (AtspiDeviceEvent *event, void *user_data) AtspiDeviceLegacyPrivate *priv = atspi_device_legacy_get_instance_private (legacy_device); gboolean ret = priv->keyboard_grabbed; guint modifiers; - + set_virtual_modifier (legacy_device, event->hw_code, - event->type == (AtspiEventType)ATSPI_KEY_PRESS); + event->type == (AtspiEventType) ATSPI_KEY_PRESS); modifiers = event->modifiers | priv->virtual_mods_enabled; if (modifiers & (1 << ATSPI_MODIFIER_NUMLOCK)) modifiers &= ~priv->numlock_physical_mask; ret |= atspi_device_notify_key (ATSPI_DEVICE (legacy_device), - event->type == (AtspiEventType)ATSPI_KEY_PRESS, + event->type == (AtspiEventType) ATSPI_KEY_PRESS, event->hw_code, event->id, modifiers, event->event_string); @@ -137,11 +133,11 @@ check_virtual_modifier (AtspiDeviceLegacy *legacy_device, guint modifier) return TRUE; for (l = priv->modifiers; l; l = l->next) - { - AtspiLegacyKeyModifier *entry = l->data; - if (entry->modifier == modifier) - return TRUE; - } + { + AtspiLegacyKeyModifier *entry = l->data; + if (entry->modifier == modifier) + return TRUE; + } return FALSE; } @@ -152,11 +148,11 @@ get_unused_virtual_modifier (AtspiDeviceLegacy *legacy_device) guint ret = 0x1000; while (ret < 0x10000) - { - if (!check_virtual_modifier (legacy_device, ret)) - return ret; - ret <<= 1; - } + { + if (!check_virtual_modifier (legacy_device, ret)) + return ret; + ret <<= 1; + } return 0; } @@ -174,11 +170,11 @@ atspi_device_legacy_map_modifier (AtspiDevice *device, gint keycode) desc = XkbGetMap (priv->display, XkbModifierMapMask, XkbUseCoreKbd); if (keycode < desc->min_key_code || keycode >= desc->max_key_code) - { - XkbFreeKeyboard (desc, XkbModifierMapMask, TRUE); - g_warning ("Passed invalid keycode %d", keycode); - return 0; - } + { + XkbFreeKeyboard (desc, XkbModifierMapMask, TRUE); + g_warning ("Passed invalid keycode %d", keycode); + return 0; + } ret = desc->map->modmap[keycode]; XkbFreeKeyboard (desc, XkbModifierMapMask, TRUE); @@ -208,15 +204,15 @@ atspi_device_legacy_unmap_modifier (AtspiDevice *device, gint keycode) GSList *l; for (l = priv->modifiers; l; l = l->next) - { - AtspiLegacyKeyModifier *entry = l->data; - if (entry->keycode == keycode) { - priv->modifiers = g_slist_remove (priv->modifiers, entry); - g_free (entry); - return; + AtspiLegacyKeyModifier *entry = l->data; + if (entry->keycode == keycode) + { + priv->modifiers = g_slist_remove (priv->modifiers, entry); + g_free (entry); + return; + } } - } } static guint @@ -231,11 +227,11 @@ atspi_device_legacy_get_modifier (AtspiDevice *device, gint keycode) desc = XkbGetMap (priv->display, XkbModifierMapMask, XkbUseCoreKbd); if (keycode < desc->min_key_code || keycode >= desc->max_key_code) - { - XkbFreeKeyboard (desc, XkbModifierMapMask, TRUE); - g_warning ("Passed invalid keycode %d", keycode); - return 0; - } + { + XkbFreeKeyboard (desc, XkbModifierMapMask, TRUE); + g_warning ("Passed invalid keycode %d", keycode); + return 0; + } ret = desc->map->modmap[keycode]; XkbFreeKeyboard (desc, XkbModifierMapMask, TRUE); @@ -276,13 +272,12 @@ atspi_device_legacy_init (AtspiDeviceLegacy *device) atspi_register_keystroke_listener (priv->listener, NULL, i, 3, ATSPI_KEYLISTENER_SYNCHRONOUS | ATSPI_KEYLISTENER_CANCONSUME, NULL); #ifdef HAVE_X11 - priv->display=XOpenDisplay(""); + priv->display = XOpenDisplay (""); if (priv->display) - priv->window = DefaultRootWindow(priv->display); + priv->window = DefaultRootWindow (priv->display); priv->numlock_physical_mask = XkbKeysymToModifiers (priv->display, - XK_Num_Lock); + XK_Num_Lock); #endif - } static void @@ -295,7 +290,6 @@ atspi_device_legacy_finalize (GObject *object) device_legacy_parent_class->finalize (object); } - static void atspi_device_legacy_class_init (AtspiDeviceLegacyClass *klass) { diff --git a/atspi/atspi-device-legacy.h b/atspi/atspi-device-legacy.h index 50f777e2..4dadaf93 100644 --- a/atspi/atspi-device-legacy.h +++ b/atspi/atspi-device-legacy.h @@ -3,7 +3,7 @@ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * * Copyright 2020 SUSE LLC. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,17 +26,17 @@ #include "glib-object.h" -#include "atspi-types.h" #include "atspi-device.h" +#include "atspi-types.h" G_BEGIN_DECLS -#define ATSPI_TYPE_DEVICE_LEGACY (atspi_device_legacy_get_type ()) -#define ATSPI_DEVICE_LEGACY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_DEVICE_LEGACY, AtspiDeviceLegacy)) -#define ATSPI_DEVICE_LEGACY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_DEVICE_LEGACY, AtspiDeviceLegacyClass)) -#define ATSPI_IS_DEVICE_LEGACY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_DEVICE_LEGACY)) -#define ATSPI_IS_DEVICE_LEGACY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_DEVICE_LEGACY)) -#define ATSPI_DEVICE_LEGACY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_DEVICE_LEGACY, AtspiDeviceLegacyClass)) +#define ATSPI_TYPE_DEVICE_LEGACY (atspi_device_legacy_get_type ()) +#define ATSPI_DEVICE_LEGACY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_DEVICE_LEGACY, AtspiDeviceLegacy)) +#define ATSPI_DEVICE_LEGACY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_DEVICE_LEGACY, AtspiDeviceLegacyClass)) +#define ATSPI_IS_DEVICE_LEGACY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_DEVICE_LEGACY)) +#define ATSPI_IS_DEVICE_LEGACY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_DEVICE_LEGACY)) +#define ATSPI_DEVICE_LEGACY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_DEVICE_LEGACY, AtspiDeviceLegacyClass)) typedef struct _AtspiDeviceLegacy AtspiDeviceLegacy; struct _AtspiDeviceLegacy @@ -56,4 +56,4 @@ AtspiDeviceLegacy *atspi_device_legacy_new (); G_END_DECLS -#endif /* _ATSPI_DEVICE_LEGACY_H_ */ +#endif /* _ATSPI_DEVICE_LEGACY_H_ */ diff --git a/atspi/atspi-device-listener-private.h b/atspi/atspi-device-listener-private.h index bd54232d..32694cef 100644 --- a/atspi/atspi-device-listener-private.h +++ b/atspi/atspi-device-listener-private.h @@ -4,7 +4,7 @@ * * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -37,4 +37,4 @@ gchar *_atspi_device_listener_get_path (AtspiDeviceListener *listener); G_END_DECLS -#endif /* _ATSPI_DEVICE_LISTENER_H_ */ +#endif /* _ATSPI_DEVICE_LISTENER_H_ */ diff --git a/atspi/atspi-device-listener.c b/atspi/atspi-device-listener.c index 964d9160..d575b078 100644 --- a/atspi/atspi-device-listener.c +++ b/atspi/atspi-device-listener.c @@ -37,7 +37,7 @@ typedef struct { - AtspiDeviceListenerCB callback; + AtspiDeviceListenerCB callback; gpointer user_data; GDestroyNotify callback_destroyed; } DeviceEventHandler; @@ -68,7 +68,7 @@ device_remove_datum (AtspiDeviceEvent *event, void *user_data) AtspiDeviceListenerSimpleCB cb = user_data; return cb (event); } - + static void device_event_handler_free (DeviceEventHandler *eh) { @@ -88,17 +88,17 @@ static GList * event_list_remove_by_cb (GList *list, AtspiDeviceListenerCB callback) { GList *l, *next; - + for (l = list; l; l = next) { DeviceEventHandler *eh = l->data; next = l->next; if (eh->callback == callback) - { - list = g_list_delete_link (list, l); - device_event_handler_free (eh); - } + { + list = g_list_delete_link (list, l); + device_event_handler_free (eh); + } } return list; @@ -117,10 +117,11 @@ id_is_free (guint id) GList *l; for (l = device_listeners; l; l = g_list_next (l)) - { - AtspiDeviceListener *listener = l->data; - if (listener->id == id) return FALSE; - } + { + AtspiDeviceListener *listener = l->data; + if (listener->id == id) + return FALSE; + } return TRUE; } @@ -147,12 +148,12 @@ atspi_device_event_free (AtspiDeviceEvent *event) g_free (event); } -/* +/* * Device event handler */ static gboolean -atspi_device_event_dispatch (AtspiDeviceListener *listener, - const AtspiDeviceEvent *event) +atspi_device_event_dispatch (AtspiDeviceListener *listener, + const AtspiDeviceEvent *event) { GList *l; gboolean handled = FALSE; @@ -164,8 +165,8 @@ atspi_device_event_dispatch (AtspiDeviceListener *listener, if ((handled = eh->callback (atspi_device_event_copy (event), eh->user_data))) { - break; - } + break; + } } return handled; @@ -176,9 +177,10 @@ atspi_device_listener_init (AtspiDeviceListener *listener) { do - { - listener->id = listener_id++; - } while (!id_is_free (listener->id)); + { + listener->id = listener_id++; + } + while (!id_is_free (listener->id)); device_listeners = g_list_append (device_listeners, listener); } @@ -194,7 +196,7 @@ atspi_device_listener_finalize (GObject *object) { device_event_handler_free (l->data); } - + g_list_free (listener->callbacks); device_listener_parent_class->finalize (object); @@ -211,8 +213,7 @@ atspi_device_listener_class_init (AtspiDeviceListenerClass *klass) klass->device_event = atspi_device_event_dispatch; } -G_DEFINE_TYPE (AtspiDeviceListener, atspi_device_listener, - G_TYPE_OBJECT) +G_DEFINE_TYPE (AtspiDeviceListener, atspi_device_listener, G_TYPE_OBJECT) /** * atspi_device_listener_new: @@ -237,7 +238,7 @@ atspi_device_listener_new (AtspiDeviceListenerCB callback, if (callback) atspi_device_listener_add_callback (listener, callback, callback_destroyed, - user_data); + user_data); return listener; } @@ -257,7 +258,7 @@ atspi_device_listener_new (AtspiDeviceListenerCB callback, **/ AtspiDeviceListener * atspi_device_listener_new_simple (AtspiDeviceListenerSimpleCB callback, - GDestroyNotify callback_destroyed) + GDestroyNotify callback_destroyed) { return atspi_device_listener_new (device_remove_datum, callback, callback_destroyed); } @@ -269,16 +270,16 @@ atspi_device_listener_new_simple (AtspiDeviceListenerSimpleCB callback, * @callback_destroyed: A #GDestroyNotify called when the listener is freed * and data associated with the callback should be freed. It can be NULL. * @user_data: (closure): a pointer to data which will be passed to the - * callback when invoked. + * callback when invoked. * * Adds an in-process callback function to an existing #AtspiDeviceListener. * **/ void -atspi_device_listener_add_callback (AtspiDeviceListener *listener, - AtspiDeviceListenerCB callback, - GDestroyNotify callback_destroyed, - void *user_data) +atspi_device_listener_add_callback (AtspiDeviceListener *listener, + AtspiDeviceListenerCB callback, + GDestroyNotify callback_destroyed, + void *user_data) { g_return_if_fail (ATSPI_IS_DEVICE_LISTENER (listener)); DeviceEventHandler *new_handler; @@ -294,13 +295,13 @@ atspi_device_listener_add_callback (AtspiDeviceListener *listener, * @listener: the #AtspiDeviceListener instance to modify. * @callback: (scope call): an #AtspiDeviceListenerCB function pointer. * - * Removes an in-process callback function from an existing + * Removes an in-process callback function from an existing * #AtspiDeviceListener. * **/ void -atspi_device_listener_remove_callback (AtspiDeviceListener *listener, - AtspiDeviceListenerCB callback) +atspi_device_listener_remove_callback (AtspiDeviceListener *listener, + AtspiDeviceListenerCB callback) { g_return_if_fail (ATSPI_IS_DEVICE_LISTENER (listener)); @@ -354,7 +355,7 @@ _atspi_dbus_handle_DeviceEvent (DBusConnection *bus, DBusMessage *message) const char *path = dbus_message_get_path (message); int id; AtspiDeviceEvent event; - AtspiDeviceListener *listener; + AtspiDeviceListener *listener; DBusMessageIter iter; AtspiDeviceListenerClass *klass; dbus_bool_t retval = FALSE; @@ -362,47 +363,48 @@ _atspi_dbus_handle_DeviceEvent (DBusConnection *bus, DBusMessage *message) DBusMessage *reply; if (strcmp (dbus_message_get_signature (message), "(uiuuisb)") != 0) - { - g_warning ("AT-SPI: Unknown signature for an event"); - goto done; - } + { + g_warning ("AT-SPI: Unknown signature for an event"); + goto done; + } if (sscanf (path, "/org/a11y/atspi/listeners/%d", &id) != 1) - { - g_warning ("AT-SPI: Bad listener path: %s\n", path); - goto done; - } + { + g_warning ("AT-SPI: Bad listener path: %s\n", path); + goto done; + } for (l = device_listeners; l; l = g_list_next (l)) - { - listener = l->data; - if (listener->id == id) break; - } + { + listener = l->data; + if (listener->id == id) + break; + } if (!l) - { - goto done; - } + { + goto done; + } dbus_message_iter_init (message, &iter); read_device_event_from_iter (&iter, &event); klass = ATSPI_DEVICE_LISTENER_GET_CLASS (listener); if (klass->device_event) - { - retval = (*klass->device_event) (listener, &event); - if (retval != 0 && retval != 1) { - g_warning ("AT-SPI: device event handler returned %d; should be 0 or 1", retval); - retval = 0; + retval = (*klass->device_event) (listener, &event); + if (retval != 0 && retval != 1) + { + g_warning ("AT-SPI: device event handler returned %d; should be 0 or 1", retval); + retval = 0; + } } - } done: reply = dbus_message_new_method_return (message); if (reply) - { - dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &retval, DBUS_TYPE_INVALID); - dbus_connection_send (_atspi_bus(), reply, NULL); - dbus_message_unref (reply); - } + { + dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &retval, DBUS_TYPE_INVALID); + dbus_connection_send (_atspi_bus (), reply, NULL); + dbus_message_unref (reply); + } return DBUS_HANDLER_RESULT_HANDLED; } diff --git a/atspi/atspi-device-listener.h b/atspi/atspi-device-listener.h index 718a4153..f8d12c16 100644 --- a/atspi/atspi-device-listener.h +++ b/atspi/atspi-device-listener.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -45,8 +45,8 @@ GType atspi_device_event_get_type (void); * Returns: #TRUE if the client wishes to consume/preempt the event, preventing it from being * relayed to the currently focussed application, #FALSE if the event delivery should proceed as normal. **/ -typedef gboolean (*AtspiDeviceListenerCB) (AtspiDeviceEvent *stroke, - void *user_data); +typedef gboolean (*AtspiDeviceListenerCB) (AtspiDeviceEvent *stroke, + void *user_data); /** * AtspiDeviceListenerSimpleCB: @@ -58,14 +58,14 @@ typedef gboolean (*AtspiDeviceListenerCB) (AtspiDeviceEvent *stroke, * Returns: #TRUE if the client wishes to consume/preempt the event, preventing it from being * relayed to the currently focussed application, #FALSE if the event delivery should proceed as normal. **/ -typedef gboolean (*AtspiDeviceListenerSimpleCB) (const AtspiDeviceEvent *stroke); +typedef gboolean (*AtspiDeviceListenerSimpleCB) (const AtspiDeviceEvent *stroke); -#define ATSPI_TYPE_DEVICE_LISTENER (atspi_device_listener_get_type ()) -#define ATSPI_DEVICE_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_DEVICE_LISTENER, AtspiDeviceListener)) -#define ATSPI_DEVICE_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_DEVICE_LISTENER, AtspiDeviceListenerClass)) -#define ATSPI_IS_DEVICE_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_DEVICE_LISTENER)) -#define ATSPI_IS_DEVICE_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_DEVICE_LISTENER)) -#define ATSPI_DEVICE_LISTENER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_DEVICE_LISTENER, AtspiDeviceListenerClass)) +#define ATSPI_TYPE_DEVICE_LISTENER (atspi_device_listener_get_type ()) +#define ATSPI_DEVICE_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_DEVICE_LISTENER, AtspiDeviceListener)) +#define ATSPI_DEVICE_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_DEVICE_LISTENER, AtspiDeviceListenerClass)) +#define ATSPI_IS_DEVICE_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_DEVICE_LISTENER)) +#define ATSPI_IS_DEVICE_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_DEVICE_LISTENER)) +#define ATSPI_DEVICE_LISTENER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_DEVICE_LISTENER, AtspiDeviceListenerClass)) typedef struct _AtspiDeviceListener AtspiDeviceListener; struct _AtspiDeviceListener @@ -90,8 +90,8 @@ AtspiDeviceListener *atspi_device_listener_new_simple (AtspiDeviceListenerSimple void atspi_device_listener_add_callback (AtspiDeviceListener *listener, AtspiDeviceListenerCB callback, GDestroyNotify callback_destroyed, void *user_data); -void atspi_device_listener_remove_callback (AtspiDeviceListener *listener, AtspiDeviceListenerCB callback); +void atspi_device_listener_remove_callback (AtspiDeviceListener *listener, AtspiDeviceListenerCB callback); G_END_DECLS -#endif /* _ATSPI_DEVICE_LISTENER_H_ */ +#endif /* _ATSPI_DEVICE_LISTENER_H_ */ diff --git a/atspi/atspi-device-x11.c b/atspi/atspi-device-x11.c index eafdba62..fccaba8c 100644 --- a/atspi/atspi-device-x11.c +++ b/atspi/atspi-device-x11.c @@ -20,14 +20,13 @@ * Boston, MA 02110-1301, USA. */ -#include "atspi-private.h" #include "atspi-device-x11.h" +#include "atspi-private.h" +#include <X11/XKBlib.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/extensions/XInput2.h> -#include <X11/XKBlib.h> - #define ATSPI_VIRTUAL_MODIFIER_MASK 0x0000f000 @@ -52,9 +51,9 @@ GObjectClass *device_x11_parent_class; typedef struct _DisplaySource { GSource source; - + Display *display; - GPollFD event_poll_fd; + GPollFD event_poll_fd; } DisplaySource; typedef struct @@ -69,22 +68,22 @@ typedef struct gboolean enabled; } AtspiX11KeyGrab; -static gboolean +static gboolean event_prepare (GSource *source, gint *timeout) { - Display *display = ((DisplaySource *)source)->display; + Display *display = ((DisplaySource *) source)->display; gboolean retval; - + *timeout = -1; retval = XPending (display); - + return retval; } -static gboolean -event_check (GSource *source) +static gboolean +event_check (GSource *source) { - DisplaySource *display_source = (DisplaySource*)source; + DisplaySource *display_source = (DisplaySource *) source; gboolean retval; if (display_source->event_poll_fd.revents & G_IO_IN) @@ -101,16 +100,16 @@ xi2keyevent (XIDeviceEvent *xievent, XEvent *xkeyevent) memset (xkeyevent, 0, sizeof (*xkeyevent)); switch (xievent->evtype) - { - case XI_KeyPress: - xkeyevent->type = KeyPress; - break; - case XI_KeyRelease: - xkeyevent->type = KeyRelease; - break; - default: - break; - } + { + case XI_KeyPress: + xkeyevent->type = KeyPress; + break; + case XI_KeyRelease: + xkeyevent->type = KeyRelease; + break; + default: + break; + } xkeyevent->xkey.serial = xievent->serial; xkeyevent->xkey.send_event = xievent->send_event; xkeyevent->xkey.display = xievent->display; @@ -127,10 +126,7 @@ xi2keyevent (XIDeviceEvent *xievent, XEvent *xkeyevent) xkeyevent->xkey.same_screen = 1; } -G_DEFINE_TYPE_WITH_CODE (AtspiDeviceX11, atspi_device_x11, - ATSPI_TYPE_DEVICE, - G_ADD_PRIVATE (AtspiDeviceX11)) - +G_DEFINE_TYPE_WITH_CODE (AtspiDeviceX11, atspi_device_x11, ATSPI_TYPE_DEVICE, G_ADD_PRIVATE (AtspiDeviceX11)) static guint find_virtual_mapping (AtspiDeviceX11 *x11_device, gint keycode) @@ -139,11 +135,11 @@ find_virtual_mapping (AtspiDeviceX11 *x11_device, gint keycode) GSList *l; for (l = priv->modifiers; l; l = l->next) - { - AtspiX11KeyModifier *entry = l->data; - if (entry->keycode == keycode) - return entry->modifier; - } + { + AtspiX11KeyModifier *entry = l->data; + if (entry->keycode == keycode) + return entry->modifier; + } return 0; } @@ -168,11 +164,11 @@ grab_has_active_duplicate (AtspiDeviceX11 *x11_device, AtspiX11KeyGrab *grab) GSList *l; for (l = priv->key_grabs; l; l = l->next) - { - AtspiX11KeyGrab *other = l->data; - if (other != grab && other->enabled && other->kd->keycode == grab->kd->keycode && (other->kd->modifiers & ~ATSPI_VIRTUAL_MODIFIER_MASK) == (grab->kd->modifiers & ~ATSPI_VIRTUAL_MODIFIER_MASK)) - return TRUE; - } + { + AtspiX11KeyGrab *other = l->data; + if (other != grab && other->enabled && other->kd->keycode == grab->kd->keycode && (other->kd->modifiers & ~ATSPI_VIRTUAL_MODIFIER_MASK) == (grab->kd->modifiers & ~ATSPI_VIRTUAL_MODIFIER_MASK)) + return TRUE; + } return FALSE; } @@ -182,17 +178,17 @@ grab_key_aux (AtspiDeviceX11 *x11_device, int keycode, int modmask) AtspiDeviceX11Private *priv = atspi_device_x11_get_instance_private (x11_device); XIGrabModifiers xi_modifiers; XIEventMask eventmask; - unsigned char mask[XIMaskLen (XI_LASTEVENT)] = { 0 }; + unsigned char mask[XIMaskLen (XI_LASTEVENT)] = { 0 }; xi_modifiers.modifiers = modmask; xi_modifiers.status = 0; - eventmask.deviceid = XIAllDevices; - eventmask.mask_len = sizeof(mask); - eventmask.mask = mask; + eventmask.deviceid = XIAllDevices; + eventmask.mask_len = sizeof (mask); + eventmask.mask = mask; - XISetMask (mask, XI_KeyPress); - XISetMask (mask, XI_KeyRelease); + XISetMask (mask, XI_KeyPress); + XISetMask (mask, XI_KeyRelease); XIGrabKeycode (priv->display, XIAllMasterDevices, keycode, priv->window, XIGrabModeSync, XIGrabModeAsync, False, &eventmask, 1, &xi_modifiers); } @@ -206,11 +202,11 @@ grab_key (AtspiDeviceX11 *x11_device, int keycode, int modmask) if (!(modmask & LockMask)) grab_key_aux (x11_device, keycode, modmask | LockMask); if (!(modmask & priv->numlock_physical_mask)) - { - grab_key_aux (x11_device, keycode, modmask | priv->numlock_physical_mask); - if (!(modmask & LockMask)) - grab_key_aux (x11_device, keycode, modmask | LockMask | priv->numlock_physical_mask); - } + { + grab_key_aux (x11_device, keycode, modmask | priv->numlock_physical_mask); + if (!(modmask & LockMask)) + grab_key_aux (x11_device, keycode, modmask | LockMask | priv->numlock_physical_mask); + } } static void @@ -234,7 +230,7 @@ ungrab_key_aux (AtspiDeviceX11 *x11_device, int keycode, int modmask) xi_modifiers.modifiers = modmask; xi_modifiers.status = 0; - XIUngrabKeycode (priv->display, XIAllMasterDevices, keycode, priv->window, sizeof(xi_modifiers), &xi_modifiers); + XIUngrabKeycode (priv->display, XIAllMasterDevices, keycode, priv->window, sizeof (xi_modifiers), &xi_modifiers); } static void @@ -246,11 +242,11 @@ ungrab_key (AtspiDeviceX11 *x11_device, int keycode, int modmask) if (!(modmask & LockMask)) ungrab_key_aux (x11_device, keycode, modmask | LockMask); if (!(modmask & priv->numlock_physical_mask)) - { - ungrab_key_aux (x11_device, keycode, modmask | priv->numlock_physical_mask); - if (!(modmask & LockMask)) - ungrab_key_aux (x11_device, keycode, modmask | LockMask | priv->numlock_physical_mask); - } + { + ungrab_key_aux (x11_device, keycode, modmask | priv->numlock_physical_mask); + if (!(modmask & LockMask)) + ungrab_key_aux (x11_device, keycode, modmask | LockMask | priv->numlock_physical_mask); + } } static void @@ -278,14 +274,14 @@ refresh_key_grabs (AtspiDeviceX11 *x11_device) GSList *l; for (l = priv->key_grabs; l; l = l->next) - { - AtspiX11KeyGrab *grab = l->data; - gboolean new_enabled = grab_should_be_enabled (x11_device, grab); - if (new_enabled && !grab->enabled) - enable_key_grab (x11_device, grab); - else if (grab->enabled && !new_enabled) - disable_key_grab (x11_device, grab); - } + { + AtspiX11KeyGrab *grab = l->data; + gboolean new_enabled = grab_should_be_enabled (x11_device, grab); + if (new_enabled && !grab->enabled) + enable_key_grab (x11_device, grab); + else if (grab->enabled && !new_enabled) + disable_key_grab (x11_device, grab); + } } static void @@ -298,17 +294,17 @@ set_virtual_modifier (AtspiDeviceX11 *x11_device, gint keycode, gboolean enabled return; if (enabled) - { - if (priv->virtual_mods_enabled & modifier) - return; - priv->virtual_mods_enabled |= modifier; - } + { + if (priv->virtual_mods_enabled & modifier) + return; + priv->virtual_mods_enabled |= modifier; + } else - { - if (!(priv->virtual_mods_enabled & modifier)) - return; - priv->virtual_mods_enabled &= ~modifier; - } + { + if (!(priv->virtual_mods_enabled & modifier)) + return; + priv->virtual_mods_enabled &= ~modifier; + } refresh_key_grabs (x11_device); } @@ -324,68 +320,68 @@ do_event_dispatch (gpointer user_data) KeySym keysym; XComposeStatus status; guint modifiers; - - while (XPending (display)) - { - XNextEvent (display, &xevent); - XEvent keyevent; - switch (xevent.type) + while (XPending (display)) { - case KeyPress: - case KeyRelease: - XLookupString(&xevent.xkey, text, sizeof (text), &keysym, &status); - modifiers = xevent.xkey.state | priv->virtual_mods_enabled; - if (modifiers & priv->numlock_physical_mask) - { - modifiers |= (1 << ATSPI_MODIFIER_NUMLOCK); - modifiers &= ~priv->numlock_physical_mask; - } - atspi_device_notify_key (ATSPI_DEVICE (device), (xevent.type == KeyPress), xevent.xkey.keycode, keysym, modifiers, text); - break; - case GenericEvent: - if (xevent.xcookie.extension == priv->xi_opcode) - { - XGetEventData(priv->display, &xevent.xcookie); - XIRawEvent *xiRawEv = (XIRawEvent *) xevent.xcookie.data; - XIDeviceEvent *xiDevEv = (XIDeviceEvent *) xevent.xcookie.data; - switch (xevent.xcookie.evtype) + XNextEvent (display, &xevent); + XEvent keyevent; + + switch (xevent.type) { - case XI_KeyPress: - case XI_KeyRelease: - xi2keyevent (xiDevEv, &keyevent); - XLookupString((XKeyEvent *)&keyevent, text, sizeof (text), &keysym, &status); - if (text[0] < ' ') - text[0] = '\0'; - /* The deviceid can change. Would be nice to find a better way of - handling this */ - if (priv->device_id && priv->device_id_alt && xiDevEv->deviceid != priv->device_id && xiDevEv->deviceid != priv->device_id_alt) - priv->device_id = priv->device_id_alt = 0; - else if (priv->device_id && !priv->device_id_alt && xiDevEv->deviceid != priv->device_id) - priv->device_id_alt = xiDevEv->deviceid; - if (!priv->device_id) - priv->device_id = xiDevEv->deviceid; - set_virtual_modifier (device, xiRawEv->detail, xevent.xcookie.evtype == XI_KeyPress); - modifiers = keyevent.xkey.state | priv->virtual_mods_enabled; + case KeyPress: + case KeyRelease: + XLookupString (&xevent.xkey, text, sizeof (text), &keysym, &status); + modifiers = xevent.xkey.state | priv->virtual_mods_enabled; if (modifiers & priv->numlock_physical_mask) - modifiers |= (1 << ATSPI_MODIFIER_NUMLOCK); - if (xiDevEv->deviceid == priv->device_id) - atspi_device_notify_key (ATSPI_DEVICE (device), (xevent.xcookie.evtype == XI_KeyPress), xiRawEv->detail, keysym, modifiers, text); - /* otherwise it's probably a duplicate event from a key grab */ - XFreeEventData (priv->display, &xevent.xcookie); + { + modifiers |= (1 << ATSPI_MODIFIER_NUMLOCK); + modifiers &= ~priv->numlock_physical_mask; + } + atspi_device_notify_key (ATSPI_DEVICE (device), (xevent.type == KeyPress), xevent.xkey.keycode, keysym, modifiers, text); break; + case GenericEvent: + if (xevent.xcookie.extension == priv->xi_opcode) + { + XGetEventData (priv->display, &xevent.xcookie); + XIRawEvent *xiRawEv = (XIRawEvent *) xevent.xcookie.data; + XIDeviceEvent *xiDevEv = (XIDeviceEvent *) xevent.xcookie.data; + switch (xevent.xcookie.evtype) + { + case XI_KeyPress: + case XI_KeyRelease: + xi2keyevent (xiDevEv, &keyevent); + XLookupString ((XKeyEvent *) &keyevent, text, sizeof (text), &keysym, &status); + if (text[0] < ' ') + text[0] = '\0'; + /* The deviceid can change. Would be nice to find a better way of + handling this */ + if (priv->device_id && priv->device_id_alt && xiDevEv->deviceid != priv->device_id && xiDevEv->deviceid != priv->device_id_alt) + priv->device_id = priv->device_id_alt = 0; + else if (priv->device_id && !priv->device_id_alt && xiDevEv->deviceid != priv->device_id) + priv->device_id_alt = xiDevEv->deviceid; + if (!priv->device_id) + priv->device_id = xiDevEv->deviceid; + set_virtual_modifier (device, xiRawEv->detail, xevent.xcookie.evtype == XI_KeyPress); + modifiers = keyevent.xkey.state | priv->virtual_mods_enabled; + if (modifiers & priv->numlock_physical_mask) + modifiers |= (1 << ATSPI_MODIFIER_NUMLOCK); + if (xiDevEv->deviceid == priv->device_id) + atspi_device_notify_key (ATSPI_DEVICE (device), (xevent.xcookie.evtype == XI_KeyPress), xiRawEv->detail, keysym, modifiers, text); + /* otherwise it's probably a duplicate event from a key grab */ + XFreeEventData (priv->display, &xevent.xcookie); + break; + } + } + default: + if (XFilterEvent (&xevent, None)) + continue; } - } - default: - if (XFilterEvent (&xevent, None)) - continue; } - } return TRUE; } -static gboolean -event_dispatch (GSource *source, GSourceFunc callback, gpointer user_data) +static gboolean +event_dispatch (GSource *source, GSourceFunc callback, gpointer user_data) { if (callback) callback (user_data); @@ -405,13 +401,13 @@ display_source_new (Display *display) GSource *source = g_source_new (&event_funcs, sizeof (DisplaySource)); DisplaySource *display_source = (DisplaySource *) source; g_source_set_name (source, "[at-spi2-core] display_source_funcs"); - + display_source->display = display; - + return source; } -static void +static void create_event_source (AtspiDeviceX11 *device) { AtspiDeviceX11Private *priv = atspi_device_x11_get_instance_private (device); @@ -420,13 +416,13 @@ create_event_source (AtspiDeviceX11 *device) int connection_number = ConnectionNumber (priv->display); priv->source = display_source_new (priv->display); - display_source = (DisplaySource *)priv->source; + display_source = (DisplaySource *) priv->source; g_source_set_priority (priv->source, G_PRIORITY_DEFAULT); - + display_source->event_poll_fd.fd = connection_number; display_source->event_poll_fd.events = G_IO_IN; - + g_source_add_poll (priv->source, &display_source->event_poll_fd); g_source_set_can_recurse (priv->source, TRUE); g_source_set_callback (priv->source, do_event_dispatch, device, NULL); @@ -443,11 +439,11 @@ check_virtual_modifier (AtspiDeviceX11 *x11_device, guint modifier) return TRUE; for (l = priv->modifiers; l; l = l->next) - { - AtspiX11KeyModifier *entry = l->data; - if (entry->modifier == modifier) - return TRUE; - } + { + AtspiX11KeyModifier *entry = l->data; + if (entry->modifier == modifier) + return TRUE; + } return FALSE; } @@ -458,11 +454,11 @@ get_unused_virtual_modifier (AtspiDeviceX11 *x11_device) guint ret = 0x1000; while (ret < 0x10000) - { - if (!check_virtual_modifier (x11_device, ret)) - return ret; - ret <<= 1; - } + { + if (!check_virtual_modifier (x11_device, ret)) + return ret; + ret <<= 1; + } return 0; } @@ -479,11 +475,11 @@ atspi_device_x11_map_modifier (AtspiDevice *device, gint keycode) desc = XkbGetMap (priv->display, XkbModifierMapMask, XkbUseCoreKbd); if (keycode < desc->min_key_code || keycode >= desc->max_key_code) - { - XkbFreeKeyboard (desc, XkbModifierMapMask, TRUE); - g_warning ("Passed invalid keycode %d", keycode); - return 0; - } + { + XkbFreeKeyboard (desc, XkbModifierMapMask, TRUE); + g_warning ("Passed invalid keycode %d", keycode); + return 0; + } ret = desc->map->modmap[keycode]; XkbFreeKeyboard (desc, XkbModifierMapMask, TRUE); @@ -512,15 +508,15 @@ atspi_device_x11_unmap_modifier (AtspiDevice *device, gint keycode) GSList *l; for (l = priv->modifiers; l; l = l->next) - { - AtspiX11KeyModifier *entry = l->data; - if (entry->keycode == keycode) { - priv->modifiers = g_slist_remove (priv->modifiers, entry); - g_free (entry); - return; + AtspiX11KeyModifier *entry = l->data; + if (entry->keycode == keycode) + { + priv->modifiers = g_slist_remove (priv->modifiers, entry); + g_free (entry); + return; + } } - } } static guint @@ -534,11 +530,11 @@ atspi_device_x11_get_modifier (AtspiDevice *device, gint keycode) desc = XkbGetMap (priv->display, XkbModifierMapMask, XkbUseCoreKbd); if (keycode < desc->min_key_code || keycode >= desc->max_key_code) - { - XkbFreeKeyboard (desc, XkbModifierMapMask, TRUE); - g_warning ("Passed invalid keycode %d", keycode); - return 0; - } + { + XkbFreeKeyboard (desc, XkbModifierMapMask, TRUE); + g_warning ("Passed invalid keycode %d", keycode); + return 0; + } ret = desc->map->modmap[keycode]; XkbFreeKeyboard (desc, XkbModifierMapMask, TRUE); @@ -554,35 +550,35 @@ atspi_device_x11_init (AtspiDeviceX11 *device) AtspiDeviceX11Private *priv = atspi_device_x11_get_instance_private (device); int first_event, first_error; - priv->display=XOpenDisplay(""); + priv->display = XOpenDisplay (""); g_return_if_fail (priv->display != NULL); - priv->window = DefaultRootWindow(priv->display); + priv->window = DefaultRootWindow (priv->display); - if (XQueryExtension(priv->display, "XInputExtension", &priv->xi_opcode, &first_event, &first_error)) - { - int major = 2; - int minor = 1; - if (XIQueryVersion(priv->display, &major, &minor) != BadRequest) + if (XQueryExtension (priv->display, "XInputExtension", &priv->xi_opcode, &first_event, &first_error)) { - XIEventMask eventmask; - unsigned char mask[XIMaskLen (XI_LASTEVENT)] = { 0 }; - - eventmask.deviceid = XIAllDevices; - eventmask.mask_len = sizeof(mask); - eventmask.mask = mask; - - XISetMask (mask, XI_KeyPress); - XISetMask (mask, XI_KeyRelease); - XISetMask (mask, XI_ButtonPress); - XISetMask (mask, XI_ButtonRelease); - XISetMask (mask, XI_Motion); - XISelectEvents (priv->display, priv->window, &eventmask, 1); - create_event_source (device); + int major = 2; + int minor = 1; + if (XIQueryVersion (priv->display, &major, &minor) != BadRequest) + { + XIEventMask eventmask; + unsigned char mask[XIMaskLen (XI_LASTEVENT)] = { 0 }; + + eventmask.deviceid = XIAllDevices; + eventmask.mask_len = sizeof (mask); + eventmask.mask = mask; + + XISetMask (mask, XI_KeyPress); + XISetMask (mask, XI_KeyRelease); + XISetMask (mask, XI_ButtonPress); + XISetMask (mask, XI_ButtonRelease); + XISetMask (mask, XI_Motion); + XISelectEvents (priv->display, priv->window, &eventmask, 1); + create_event_source (device); + } } - } priv->numlock_physical_mask = XkbKeysymToModifiers (priv->display, - XK_Num_Lock); + XK_Num_Lock); } static void @@ -593,12 +589,12 @@ atspi_device_x11_finalize (GObject *object) GSList *l; for (l = priv->key_grabs; l; l = l->next) - { - AtspiX11KeyGrab *grab = l->data; - disable_key_grab (device, grab); - g_boxed_free (ATSPI_TYPE_KEY_DEFINITION, grab->kd); - g_free (grab); - } + { + AtspiX11KeyGrab *grab = l->data; + disable_key_grab (device, grab); + g_boxed_free (ATSPI_TYPE_KEY_DEFINITION, grab->kd); + g_free (grab); + } g_slist_free (priv->key_grabs); priv->key_grabs = NULL; @@ -606,16 +602,15 @@ atspi_device_x11_finalize (GObject *object) priv->modifiers = NULL; if (priv->source) - { - g_source_destroy ((GSource *) priv->source); - g_source_unref ((GSource *) priv->source); - priv->source = NULL; + { + g_source_destroy ((GSource *) priv->source); + g_source_unref ((GSource *) priv->source); + priv->source = NULL; } device_x11_parent_class->finalize (object); } - static void atspi_device_x11_add_key_grab (AtspiDevice *device, AtspiKeyDefinition *kd) { @@ -642,15 +637,15 @@ atspi_device_x11_remove_key_grab (AtspiDevice *device, guint id) kd = atspi_device_get_grab_by_id (device, id); for (l = priv->key_grabs; l; l = g_slist_next (l)) - { - AtspiX11KeyGrab *other = l->data; - if (other->kd->keycode == kd->keycode && other->kd->modifiers == kd->modifiers) { - disable_key_grab (x11_device, other); - priv->key_grabs = g_slist_remove (priv->key_grabs, other); - return; + AtspiX11KeyGrab *other = l->data; + if (other->kd->keycode == kd->keycode && other->kd->modifiers == kd->modifiers) + { + disable_key_grab (x11_device, other); + priv->key_grabs = g_slist_remove (priv->key_grabs, other); + return; + } } - } } static guint diff --git a/atspi/atspi-device-x11.h b/atspi/atspi-device-x11.h index 3a91edca..4affc5ab 100644 --- a/atspi/atspi-device-x11.h +++ b/atspi/atspi-device-x11.h @@ -3,7 +3,7 @@ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * * Copyright 2020 SUSE LLC. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,17 +26,17 @@ #include "glib-object.h" -#include "atspi-types.h" #include "atspi-device.h" +#include "atspi-types.h" G_BEGIN_DECLS -#define ATSPI_TYPE_DEVICE_X11 (atspi_device_x11_get_type ()) -#define ATSPI_DEVICE_X11(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_DEVICE_X11, AtspiDeviceX11)) -#define ATSPI_DEVICE_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_DEVICE_X11, AtspiDeviceX11Class)) -#define ATSPI_IS_DEVICE_X11(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_DEVICE_X11)) -#define ATSPI_IS_DEVICE_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_DEVICE_X11)) -#define ATSPI_DEVICE_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_DEVICE_X11, AtspiDeviceX11Class)) +#define ATSPI_TYPE_DEVICE_X11 (atspi_device_x11_get_type ()) +#define ATSPI_DEVICE_X11(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_DEVICE_X11, AtspiDeviceX11)) +#define ATSPI_DEVICE_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_DEVICE_X11, AtspiDeviceX11Class)) +#define ATSPI_IS_DEVICE_X11(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_DEVICE_X11)) +#define ATSPI_IS_DEVICE_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_DEVICE_X11)) +#define ATSPI_DEVICE_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_DEVICE_X11, AtspiDeviceX11Class)) typedef struct _AtspiDeviceX11 AtspiDeviceX11; struct _AtspiDeviceX11 @@ -56,4 +56,4 @@ AtspiDeviceX11 *atspi_device_x11_new (); G_END_DECLS -#endif /* _ATSPI_DEVICE_X11_H_ */ +#endif /* _ATSPI_DEVICE_X11_H_ */ diff --git a/atspi/atspi-device.c b/atspi/atspi-device.c index e4a564c7..555c01ee 100644 --- a/atspi/atspi-device.c +++ b/atspi/atspi-device.c @@ -20,10 +20,10 @@ * Boston, MA 02110-1301, USA. */ -#include "atspi-private.h" #include "atspi-device.h" #include "atspi-device-legacy.h" #include "atspi-device-x11.h" +#include "atspi-private.h" typedef struct { @@ -51,9 +51,7 @@ atspi_device_init (AtspiDevice *device) { } -G_DEFINE_TYPE_WITH_CODE (AtspiDevice, atspi_device, - G_TYPE_OBJECT, - G_ADD_PRIVATE (AtspiDevice)) +G_DEFINE_TYPE_WITH_CODE (AtspiDevice, atspi_device, G_TYPE_OBJECT, G_ADD_PRIVATE (AtspiDevice)) static void atspi_device_finalize (GObject *object) @@ -128,21 +126,21 @@ atspi_device_notify_key (AtspiDevice *device, gboolean pressed, int keycode, int gboolean ret = FALSE; for (l = priv->key_watchers; l; l = l->next) - { - AtspiKeyGrab *grab = l->data; - grab->callback (device, pressed, keycode, keysym, state, text, grab->callback_data); - } + { + AtspiKeyGrab *grab = l->data; + grab->callback (device, pressed, keycode, keysym, state, text, grab->callback_data); + } for (l = priv->keygrabs; l; l = l->next) - { - AtspiKeyGrab *grab = l->data; - if (keycode == grab->keycode && key_matches_modifiers (state, grab->modifiers)) { - if (grab->callback) - grab->callback (device, pressed, keycode, keysym, state, text, grab->callback_data); - ret = TRUE; + AtspiKeyGrab *grab = l->data; + if (keycode == grab->keycode && key_matches_modifiers (state, grab->modifiers)) + { + if (grab->callback) + grab->callback (device, pressed, keycode, keysym, state, text, grab->callback_data); + ret = TRUE; + } } - } return ret; } @@ -154,18 +152,18 @@ is_id_used (AtspiDevice *device, guint id) GSList *l; for (l = priv->key_watchers; l; l = l->next) - { - AtspiKeyGrab *grab = l->data; - if (grab->id == id) - return TRUE; - } + { + AtspiKeyGrab *grab = l->data; + if (grab->id == id) + return TRUE; + } for (l = priv->keygrabs; l; l = l->next) - { - AtspiKeyGrab *grab = l->data; - if (grab->id == id) - return TRUE; - } + { + AtspiKeyGrab *grab = l->data; + if (grab->id == id) + return TRUE; + } return FALSE; } @@ -175,7 +173,8 @@ get_grab_id (AtspiDevice *device) { AtspiDevicePrivate *priv = atspi_device_get_instance_private (device); - while (is_id_used (device, priv->last_grab_id)) priv->last_grab_id++; + while (is_id_used (device, priv->last_grab_id)) + priv->last_grab_id++; return priv->last_grab_id++; } @@ -186,18 +185,18 @@ grab_has_duplicate (AtspiDevice *device, AtspiKeyGrab *grab) GSList *l; for (l = priv->keygrabs; l; l = l->next) - { - AtspiKeyGrab *other_grab = l->data; - if (other_grab->id != grab->id && other_grab->keycode == grab->keycode && other_grab->modifiers == grab->modifiers) - return TRUE; - } + { + AtspiKeyGrab *other_grab = l->data; + if (other_grab->id != grab->id && other_grab->keycode == grab->keycode && other_grab->modifiers == grab->modifiers) + return TRUE; + } return FALSE; } /** *atspi_device_add_key_grab: -* @device: the device. + * @device: the device. * @kd: a #AtspiKeyDefinition specifying the key code to grab. * @callback: (scope notified) (allow-none): the function to call when the * given key is pressed. @@ -241,24 +240,24 @@ atspi_device_remove_key_grab (AtspiDevice *device, guint id) GSList *l; for (l = priv->keygrabs; l; l = l->next) - { - AtspiKeyGrab *grab = l->data; - if (grab->id == id) { - if (!grab_has_duplicate (device, grab)) - ATSPI_DEVICE_GET_CLASS (device)->remove_key_grab (device, id); - priv->keygrabs = g_slist_remove (priv->keygrabs, grab); - if (grab->callback_destroyed) - (*grab->callback_destroyed) (grab->callback); - g_free (grab); - return; + AtspiKeyGrab *grab = l->data; + if (grab->id == id) + { + if (!grab_has_duplicate (device, grab)) + ATSPI_DEVICE_GET_CLASS (device)->remove_key_grab (device, id); + priv->keygrabs = g_slist_remove (priv->keygrabs, grab); + if (grab->callback_destroyed) + (*grab->callback_destroyed) (grab->callback); + g_free (grab); + return; + } } - } } /** *atspi_device_add_key_watcher: -* @device: the device. + * @device: the device. * @callback: (scope notified): the function to call when the given key is * pressed. * @user_data: (closure callback): Data to be passed to @callback. @@ -287,16 +286,16 @@ atspi_device_get_grab_by_id (AtspiDevice *device, guint id) GSList *l; for (l = priv->keygrabs; l; l = l->next) - { - AtspiKeyGrab *grab = l->data; - if (grab->id == id) { - AtspiKeyDefinition *kd = g_new0 (AtspiKeyDefinition, 1); - kd->keycode = grab->keycode;\ - kd->modifiers = grab->modifiers; - return kd; + AtspiKeyGrab *grab = l->data; + if (grab->id == id) + { + AtspiKeyDefinition *kd = g_new0 (AtspiKeyDefinition, 1); + kd->keycode = grab->keycode; + kd->modifiers = grab->modifiers; + return kd; + } } - } return NULL; } @@ -408,4 +407,3 @@ atspi_device_ungrab_keyboard (AtspiDevice *device) if (ATSPI_DEVICE_GET_CLASS (device)->ungrab_keyboard) ATSPI_DEVICE_GET_CLASS (device)->ungrab_keyboard (device); } - diff --git a/atspi/atspi-device.h b/atspi/atspi-device.h index a246842a..37ae067d 100644 --- a/atspi/atspi-device.h +++ b/atspi/atspi-device.h @@ -3,7 +3,7 @@ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * * Copyright 2020 SUSE LLC. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -30,12 +30,12 @@ G_BEGIN_DECLS -#define ATSPI_TYPE_DEVICE (atspi_device_get_type ()) -#define ATSPI_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_DEVICE, AtspiDevice)) -#define ATSPI_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_DEVICE, AtspiDeviceClass)) -#define ATSPI_IS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_DEVICE)) -#define ATSPI_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_DEVICE)) -#define ATSPI_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_DEVICE, AtspiDeviceClass)) +#define ATSPI_TYPE_DEVICE (atspi_device_get_type ()) +#define ATSPI_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_DEVICE, AtspiDevice)) +#define ATSPI_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_DEVICE, AtspiDeviceClass)) +#define ATSPI_IS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_DEVICE)) +#define ATSPI_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_DEVICE)) +#define ATSPI_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_DEVICE, AtspiDeviceClass)) typedef struct _AtspiDevice AtspiDevice; struct _AtspiDevice @@ -100,4 +100,4 @@ void atspi_device_ungrab_keyboard (AtspiDevice *device); G_END_DECLS -#endif /* _ATSPI_DEVICE_H_ */ +#endif /* _ATSPI_DEVICE_H_ */ diff --git a/atspi/atspi-document.c b/atspi/atspi-document.c index a92c0e22..de2ad373 100644 --- a/atspi/atspi-document.c +++ b/atspi/atspi-document.c @@ -27,7 +27,7 @@ * atspi_document_get_locale: * @obj: a pointer to the #AtspiDocument object on which to operate. * - * Gets the locale associated with the document's content, + * Gets the locale associated with the document's content, * e.g. the locale for LOCALE_TYPE_MESSAGES. * * Returns: a string compliant with the POSIX standard for locale description. @@ -58,12 +58,12 @@ atspi_document_get_locale (AtspiDocument *obj, GError **error) **/ gchar * atspi_document_get_attribute_value (AtspiDocument *obj, - gchar *attribute, - GError **error) + gchar *attribute, + GError **error) { return atspi_document_get_document_attribute_value (obj, attribute, error); } - + /** * atspi_document_get_document_attribute_value: * @obj: a pointer to the #AtspiDocument object on which to operate. @@ -76,8 +76,8 @@ atspi_document_get_attribute_value (AtspiDocument *obj, **/ gchar * atspi_document_get_document_attribute_value (AtspiDocument *obj, - gchar *attribute, - GError **error) + gchar *attribute, + GError **error) { gchar *retval = NULL; @@ -90,15 +90,14 @@ atspi_document_get_document_attribute_value (AtspiDocument *obj, return retval; } - /** * atspi_document_get_attributes: (rename-to atspi_document_get_document_attributes) * @obj: a pointer to the #AtspiDocument object on which to operate. - * + * * Gets all constant attributes for the document as a whole. For attributes * that change within the document content, see @atspi_text_get_attribute_run instead. - * + * * Returns: (element-type gchar* gchar*) (transfer full): a #GHashTable * containing the constant attributes of the document, as name-value pairs. * @@ -113,10 +112,10 @@ atspi_document_get_attributes (AtspiDocument *obj, GError **error) /** * atspi_document_get_document_attributes: * @obj: a pointer to the #AtspiDocument object on which to operate. - * + * * Gets all constant attributes for the document as a whole. For attributes * that change within the document content, see @atspi_text_get_attribute_run instead. - * + * * Returns: (element-type gchar* gchar*) (transfer full): a #GHashTable * containing the constant attributes of the document, as name-value pairs. **/ @@ -125,7 +124,7 @@ atspi_document_get_document_attributes (AtspiDocument *obj, GError **error) { DBusMessage *message; - g_return_val_if_fail (obj != NULL, NULL); + g_return_val_if_fail (obj != NULL, NULL); message = _atspi_dbus_call_partial (obj, atspi_interface_document, "GetAttributes", error, ""); return _atspi_dbus_return_hash_from_message (message); @@ -183,16 +182,15 @@ atspi_document_get_type (void) { static GType type = 0; - if (!type) { - static const GTypeInfo tinfo = + if (!type) { - sizeof (AtspiDocument), - (GBaseInitFunc) atspi_document_base_init, - (GBaseFinalizeFunc) NULL, - }; - - type = g_type_register_static (G_TYPE_INTERFACE, "AtspiDocument", &tinfo, 0); - - } + static const GTypeInfo tinfo = { + sizeof (AtspiDocument), + (GBaseInitFunc) atspi_document_base_init, + (GBaseFinalizeFunc) NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiDocument", &tinfo, 0); + } return type; } diff --git a/atspi/atspi-document.h b/atspi/atspi-document.h index 429b8c6d..5dd228c8 100644 --- a/atspi/atspi-document.h +++ b/atspi/atspi-document.h @@ -4,7 +4,7 @@ * * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -33,10 +33,10 @@ G_BEGIN_DECLS -#define ATSPI_TYPE_DOCUMENT (atspi_document_get_type ()) -#define ATSPI_IS_DOCUMENT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_DOCUMENT) -#define ATSPI_DOCUMENT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_DOCUMENT, AtspiDocument) -#define ATSPI_DOCUMENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_DOCUMENT, AtspiDocument)) +#define ATSPI_TYPE_DOCUMENT (atspi_document_get_type ()) +#define ATSPI_IS_DOCUMENT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_DOCUMENT) +#define ATSPI_DOCUMENT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_DOCUMENT, AtspiDocument) +#define ATSPI_DOCUMENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_DOCUMENT, AtspiDocument)) GType atspi_document_get_type (); @@ -45,24 +45,23 @@ struct _AtspiDocument GTypeInterface parent; }; -gchar * atspi_document_get_locale (AtspiDocument *obj, GError **error); +gchar *atspi_document_get_locale (AtspiDocument *obj, GError **error); #ifndef ATSPI_DISABLE_DEPRECATED -gchar * atspi_document_get_attribute_value (AtspiDocument *obj, gchar *attribute, GError **error); +gchar *atspi_document_get_attribute_value (AtspiDocument *obj, gchar *attribute, GError **error); #endif -gchar * atspi_document_get_document_attribute_value (AtspiDocument *obj, gchar *attribute, GError **error); +gchar *atspi_document_get_document_attribute_value (AtspiDocument *obj, gchar *attribute, GError **error); #ifndef ATSPI_DISABLE_DEPRECATED -GHashTable * atspi_document_get_attributes (AtspiDocument *obj, GError **error); +GHashTable *atspi_document_get_attributes (AtspiDocument *obj, GError **error); #endif -GHashTable * atspi_document_get_document_attributes (AtspiDocument *obj, GError **error); +GHashTable *atspi_document_get_document_attributes (AtspiDocument *obj, GError **error); gint atspi_document_get_page_count (AtspiDocument *obj, GError **error); gint atspi_document_get_current_page_number (AtspiDocument *obj, GError **error); - G_END_DECLS -#endif /* _ATSPI_DOCUMENT_H_ */ +#endif /* _ATSPI_DOCUMENT_H_ */ diff --git a/atspi/atspi-editabletext.c b/atspi/atspi-editabletext.c index 75af1593..a9b8c39b 100644 --- a/atspi/atspi-editabletext.c +++ b/atspi/atspi-editabletext.c @@ -96,7 +96,7 @@ atspi_editable_text_set_text_contents (AtspiEditableText *obj, * atspi_editable_text_insert_text: * @obj: a pointer to the #AtspiEditableText object to modify. * @position: a #gint indicating the character offset at which to insert - * the new text. + * the new text. * @text: a string representing the text to insert, in UTF-8 encoding. * @length: the number of characters of text to insert, in bytes. If the * byte count of text is less than or equal to length, the entire contents @@ -136,7 +136,7 @@ atspi_editable_text_insert_text (AtspiEditableText *obj, * * Copies text from an #AtspiEditableText object into the system clipboard. * - * see: #atspi_editable_text_paste_text + * see: #atspi_editable_text_paste_text * * Returns: #TRUE if the operation was successful, otherwise #FALSE. **/ @@ -221,7 +221,7 @@ atspi_editable_text_delete_text (AtspiEditableText *obj, * atspi_editable_text_paste_text: * @obj: a pointer to the #AtspiEditableText object to modify. * @position: a #gint indicating the character offset at which to insert - * the new text. + * the new text. * * Inserts text from the system clipboard into an #AtspiEditableText object. * As with all character offsets, the specified @position may not be the @@ -255,16 +255,15 @@ atspi_editable_text_get_type (void) { static GType type = 0; - if (!type) { - static const GTypeInfo tinfo = + if (!type) { - sizeof (AtspiEditableText), - (GBaseInitFunc) atspi_editable_text_base_init, - (GBaseFinalizeFunc) NULL, - }; - - type = g_type_register_static (G_TYPE_INTERFACE, "AtspiEditableText", &tinfo, 0); - - } + static const GTypeInfo tinfo = { + sizeof (AtspiEditableText), + (GBaseInitFunc) atspi_editable_text_base_init, + (GBaseFinalizeFunc) NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiEditableText", &tinfo, 0); + } return type; } diff --git a/atspi/atspi-editabletext.h b/atspi/atspi-editabletext.h index efa5630b..ae015a4b 100644 --- a/atspi/atspi-editabletext.h +++ b/atspi/atspi-editabletext.h @@ -4,7 +4,7 @@ * * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -33,10 +33,10 @@ G_BEGIN_DECLS -#define ATSPI_TYPE_EDITABLE_TEXT (atspi_editable_text_get_type ()) -#define ATSPI_IS_EDITABLE_TEXT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_EDITABLE_TEXT) -#define ATSPI_EDITABLE_TEXT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_EDITABLE_TEXT, AtspiEditableText) -#define ATSPI_EDITABLE_TEXT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_EDITABLE_TEXT, AtspiEditableText)) +#define ATSPI_TYPE_EDITABLE_TEXT (atspi_editable_text_get_type ()) +#define ATSPI_IS_EDITABLE_TEXT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_EDITABLE_TEXT) +#define ATSPI_EDITABLE_TEXT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_EDITABLE_TEXT, AtspiEditableText) +#define ATSPI_EDITABLE_TEXT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_EDITABLE_TEXT, AtspiEditableText)) GType atspi_editable_text_get_type (); @@ -63,4 +63,4 @@ gboolean atspi_editable_text_paste_text (AtspiEditableText *obj, gint position, G_END_DECLS -#endif /* _ATSPI_EDITABLE_TEXT_H_ */ +#endif /* _ATSPI_EDITABLE_TEXT_H_ */ diff --git a/atspi/atspi-event-listener-private.h b/atspi/atspi-event-listener-private.h index 054aa498..c35f2d1c 100644 --- a/atspi/atspi-event-listener-private.h +++ b/atspi/atspi-event-listener-private.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -40,4 +40,4 @@ _atspi_reregister_event_listeners (); G_END_DECLS -#endif /* _ATSPI_EVENT_LISTENER_H_ */ +#endif /* _ATSPI_EVENT_LISTENER_H_ */ diff --git a/atspi/atspi-event-listener.c b/atspi/atspi-event-listener.c index 4c268c41..5cc7fee3 100644 --- a/atspi/atspi-event-listener.c +++ b/atspi/atspi-event-listener.c @@ -22,11 +22,11 @@ * Boston, MA 02110-1301, USA. */ -#include "atspi-private.h" #include "atspi-accessible-private.h" +#include "atspi-private.h" +#include <ctype.h> #include <string.h> #include <strings.h> -#include <ctype.h> /** * AtspiEventListener: @@ -86,21 +86,21 @@ callback_ref (void *callback, GDestroyNotify callback_destroyed) CallbackInfo *info; if (!callbacks) - { - callbacks = g_hash_table_new (g_direct_hash, g_direct_equal); - if (!callbacks) - return; - } + { + callbacks = g_hash_table_new (g_direct_hash, g_direct_equal); + if (!callbacks) + return; + } info = g_hash_table_lookup (callbacks, callback); if (!info) - { - info = g_new (CallbackInfo, 1); - info->callback = callback; - info->callback_destroyed = callback_destroyed; - info->ref_count = 1; - g_hash_table_insert (callbacks, callback, info); - } + { + info = g_new (CallbackInfo, 1); + info->callback = callback; + info->callback_destroyed = callback_destroyed; + info->ref_count = 1; + g_hash_table_insert (callbacks, callback, info); + } else info->ref_count++; } @@ -114,21 +114,21 @@ callback_unref (gpointer callback) return; info = g_hash_table_lookup (callbacks, callback); if (!info) - { - g_warning ("AT-SPI: Dereferencing invalid callback %p\n", callback); - return; - } + { + g_warning ("AT-SPI: Dereferencing invalid callback %p\n", callback); + return; + } info->ref_count--; if (info->ref_count == 0) - { + { #if 0 /* TODO: Figure out why this seg faults from Python */ if (info->callback_destroyed) (*info->callback_destroyed) (info->callback); #endif - g_free (info); - g_hash_table_remove (callbacks, callback); - } + g_free (info); + g_hash_table_remove (callbacks, callback); + } } /** @@ -145,8 +145,8 @@ callback_unref (gpointer callback) */ AtspiEventListener * atspi_event_listener_new (AtspiEventListenerCB callback, - gpointer user_data, - GDestroyNotify callback_destroyed) + gpointer user_data, + GDestroyNotify callback_destroyed) { AtspiEventListener *listener = g_object_new (ATSPI_TYPE_EVENT_LISTENER, NULL); listener->callback = callback; @@ -182,7 +182,6 @@ static GList *event_listeners = NULL; static GList *pending_removals = NULL; static int in_send = 0; - static gchar * convert_name_from_dbus (const char *name, gboolean path_hack) { @@ -193,25 +192,25 @@ convert_name_from_dbus (const char *name, gboolean path_hack) if (!name) return g_strdup (""); - ret = g_malloc (g_utf8_strlen (name, -1) * 2 + 1); + ret = g_malloc (g_utf8_strlen (name, -1) * 2 + 1); q = ret; while (*p) - { - if (isupper (*p)) - { - if (q > ret) - *q++ = '-'; - *q++ = tolower (*p++); - } - else if (path_hack && *p == '/') { - *q++ = ':'; - p++; + if (isupper (*p)) + { + if (q > ret) + *q++ = '-'; + *q++ = tolower (*p++); + } + else if (path_hack && *p == '/') + { + *q++ = ':'; + p++; + } + else + *q++ = *p++; } - else - *q++ = *p++; - } *q = '\0'; return ret; } @@ -231,88 +230,88 @@ cache_process_children_changed (AtspiEvent *event) return; if (!strncmp (event->type, "object:children-changed:add", 27)) - { - g_ptr_array_remove (event->source->children, child); /* just to be safe */ - if (event->detail1 < 0 || event->detail1 > event->source->children->len) { - event->source->cached_properties &= ~ATSPI_CACHE_CHILDREN; - return; + g_ptr_array_remove (event->source->children, child); /* just to be safe */ + if (event->detail1 < 0 || event->detail1 > event->source->children->len) + { + event->source->cached_properties &= ~ATSPI_CACHE_CHILDREN; + return; + } + /* Unfortunately, there's no g_ptr_array_insert or similar */ + g_ptr_array_add (event->source->children, NULL); + memmove (event->source->children->pdata + event->detail1 + 1, + event->source->children->pdata + event->detail1, + (event->source->children->len - event->detail1 - 1) * sizeof (gpointer)); + g_ptr_array_index (event->source->children, event->detail1) = g_object_ref (child); } - /* Unfortunately, there's no g_ptr_array_insert or similar */ - g_ptr_array_add (event->source->children, NULL); - memmove (event->source->children->pdata + event->detail1 + 1, - event->source->children->pdata + event->detail1, - (event->source->children->len - event->detail1 - 1) * sizeof (gpointer)); - g_ptr_array_index (event->source->children, event->detail1) = g_object_ref (child); - } else - { - g_ptr_array_remove (event->source->children, child); - if (child == child->parent.app->root) - g_object_run_dispose (G_OBJECT (child->parent.app)); - } + { + g_ptr_array_remove (event->source->children, child); + if (child == child->parent.app->root) + g_object_run_dispose (G_OBJECT (child->parent.app)); + } } static void cache_process_property_change (AtspiEvent *event) { if (!strcmp (event->type, "object:property-change:accessible-parent")) - { - if (event->source->accessible_parent) - g_object_unref (event->source->accessible_parent); - if (G_VALUE_HOLDS (&event->any_data, ATSPI_TYPE_ACCESSIBLE)) - { - event->source->accessible_parent = g_value_dup_object (&event->any_data); - _atspi_accessible_add_cache (event->source, ATSPI_CACHE_PARENT); - } - else { - event->source->accessible_parent = NULL; - event->source->cached_properties &= ~ATSPI_CACHE_PARENT; + if (event->source->accessible_parent) + g_object_unref (event->source->accessible_parent); + if (G_VALUE_HOLDS (&event->any_data, ATSPI_TYPE_ACCESSIBLE)) + { + event->source->accessible_parent = g_value_dup_object (&event->any_data); + _atspi_accessible_add_cache (event->source, ATSPI_CACHE_PARENT); + } + else + { + event->source->accessible_parent = NULL; + event->source->cached_properties &= ~ATSPI_CACHE_PARENT; + } } - } else if (!strcmp (event->type, "object:property-change:accessible-name")) - { - if (event->source->name) - g_free (event->source->name); - if (G_VALUE_HOLDS_STRING (&event->any_data)) { - event->source->name = g_value_dup_string (&event->any_data); - _atspi_accessible_add_cache (event->source, ATSPI_CACHE_NAME); - } - else - { - event->source->name = NULL; - event->source->cached_properties &= ~ATSPI_CACHE_NAME; + if (event->source->name) + g_free (event->source->name); + if (G_VALUE_HOLDS_STRING (&event->any_data)) + { + event->source->name = g_value_dup_string (&event->any_data); + _atspi_accessible_add_cache (event->source, ATSPI_CACHE_NAME); + } + else + { + event->source->name = NULL; + event->source->cached_properties &= ~ATSPI_CACHE_NAME; + } } - } else if (!strcmp (event->type, "object:property-change:accessible-description")) - { - if (event->source->description) - g_free (event->source->description); - if (G_VALUE_HOLDS_STRING (&event->any_data)) { - event->source->description = g_value_dup_string (&event->any_data); - _atspi_accessible_add_cache (event->source, ATSPI_CACHE_DESCRIPTION); - } - else - { - event->source->description = NULL; - event->source->cached_properties &= ~ATSPI_CACHE_DESCRIPTION; + if (event->source->description) + g_free (event->source->description); + if (G_VALUE_HOLDS_STRING (&event->any_data)) + { + event->source->description = g_value_dup_string (&event->any_data); + _atspi_accessible_add_cache (event->source, ATSPI_CACHE_DESCRIPTION); + } + else + { + event->source->description = NULL; + event->source->cached_properties &= ~ATSPI_CACHE_DESCRIPTION; + } } - } else if (!strcmp (event->type, "object:property-change:accessible-role")) - { - if (G_VALUE_HOLDS_INT (&event->any_data)) - { - event->source->role = g_value_get_int (&event->any_data); - _atspi_accessible_add_cache (event->source, ATSPI_CACHE_ROLE); - } - else { - event->source->cached_properties &= ~ATSPI_CACHE_ROLE; + if (G_VALUE_HOLDS_INT (&event->any_data)) + { + event->source->role = g_value_get_int (&event->any_data); + _atspi_accessible_add_cache (event->source, ATSPI_CACHE_ROLE); + } + else + { + event->source->cached_properties &= ~ATSPI_CACHE_ROLE; + } } - } } static void @@ -330,16 +329,20 @@ demarshal_rect (DBusMessageIter *iter, AtspiRect *rect) DBusMessageIter iter_struct; dbus_message_iter_recurse (iter, &iter_struct); - if (dbus_message_iter_get_arg_type (&iter_struct) != DBUS_TYPE_INT32) return FALSE; + if (dbus_message_iter_get_arg_type (&iter_struct) != DBUS_TYPE_INT32) + return FALSE; dbus_message_iter_get_basic (&iter_struct, &x); dbus_message_iter_next (&iter_struct); - if (dbus_message_iter_get_arg_type (&iter_struct) != DBUS_TYPE_INT32) return FALSE; + if (dbus_message_iter_get_arg_type (&iter_struct) != DBUS_TYPE_INT32) + return FALSE; dbus_message_iter_get_basic (&iter_struct, &y); dbus_message_iter_next (&iter_struct); - if (dbus_message_iter_get_arg_type (&iter_struct) != DBUS_TYPE_INT32) return FALSE; + if (dbus_message_iter_get_arg_type (&iter_struct) != DBUS_TYPE_INT32) + return FALSE; dbus_message_iter_get_basic (&iter_struct, &width); dbus_message_iter_next (&iter_struct); - if (dbus_message_iter_get_arg_type (&iter_struct) != DBUS_TYPE_INT32) return FALSE; + if (dbus_message_iter_get_arg_type (&iter_struct) != DBUS_TYPE_INT32) + return FALSE; dbus_message_iter_get_basic (&iter_struct, &height); rect->x = x; rect->y = y; @@ -355,52 +358,61 @@ convert_event_type_to_dbus (const char *eventType, char **categoryp, char **name char *category = NULL, *name = NULL, *detail = NULL; char *saveptr = NULL; - if (tmp == NULL) return FALSE; + if (tmp == NULL) + return FALSE; category = strtok_r (tmp, ":", &saveptr); - if (category) category = g_strdup (category); + if (category) + category = g_strdup (category); name = strtok_r (NULL, ":", &saveptr); if (name) - { - name = g_strdup (name); - detail = strtok_r (NULL, ":", &saveptr); - if (detail) detail = g_strdup (detail); - } - if (matchrule_array) - { - gchar *matchrule; - (*matchrule_array) = g_ptr_array_new (); - matchrule = g_strdup_printf ("type='signal',interface='org.a11y.atspi.Event.%s'", category); - if (app) - { - gchar *new_str = g_strconcat (matchrule, ",sender='", - app->parent.app->bus_name, "'", - NULL); - g_free (matchrule); - matchrule = new_str; - } - if (name && name [0]) { - gchar *new_str = g_strconcat (matchrule, ",member='", name, "'", NULL); - g_free (matchrule); - matchrule = new_str; + name = g_strdup (name); + detail = strtok_r (NULL, ":", &saveptr); + if (detail) + detail = g_strdup (detail); } - if (detail && detail [0]) + if (matchrule_array) { - gchar *new_str = g_strconcat (matchrule, ",arg0='", detail, "'", NULL); - g_ptr_array_add (*matchrule_array, new_str); - new_str = g_strconcat (matchrule, ",arg0path='", detail, "/'", NULL); - g_ptr_array_add (*matchrule_array, new_str); - g_free (matchrule); + gchar *matchrule; + (*matchrule_array) = g_ptr_array_new (); + matchrule = g_strdup_printf ("type='signal',interface='org.a11y.atspi.Event.%s'", category); + if (app) + { + gchar *new_str = g_strconcat (matchrule, ",sender='", + app->parent.app->bus_name, "'", + NULL); + g_free (matchrule); + matchrule = new_str; + } + if (name && name[0]) + { + gchar *new_str = g_strconcat (matchrule, ",member='", name, "'", NULL); + g_free (matchrule); + matchrule = new_str; + } + if (detail && detail[0]) + { + gchar *new_str = g_strconcat (matchrule, ",arg0='", detail, "'", NULL); + g_ptr_array_add (*matchrule_array, new_str); + new_str = g_strconcat (matchrule, ",arg0path='", detail, "/'", NULL); + g_ptr_array_add (*matchrule_array, new_str); + g_free (matchrule); + } + else + g_ptr_array_add (*matchrule_array, matchrule); } - else - g_ptr_array_add (*matchrule_array, matchrule); - } - if (categoryp) *categoryp = category; - else g_free (category); - if (namep) *namep = name; - else if (name) g_free (name); - if (detailp) *detailp = detail; - else if (detail) g_free (detail); + if (categoryp) + *categoryp = category; + else + g_free (category); + if (namep) + *namep = name; + else if (name) + g_free (name); + if (detailp) + *detailp = detail; + else if (detail) + g_free (detail); g_free (tmp); return TRUE; } @@ -408,15 +420,16 @@ convert_event_type_to_dbus (const char *eventType, char **categoryp, char **name static void listener_entry_free (EventListenerEntry *e) { - gpointer callback = (e->callback == remove_datum ? (gpointer)e->user_data : (gpointer)e->callback); + gpointer callback = (e->callback == remove_datum ? (gpointer) e->user_data : (gpointer) e->callback); g_free (e->event_type); g_free (e->category); g_free (e->name); - if (e->detail) g_free (e->detail); + if (e->detail) + g_free (e->detail); callback_unref (callback); - for (int i=0; i < e->properties->len; i++) - g_free (g_array_index (e->properties, char*, i)); + for (int i = 0; i < e->properties->len; i++) + g_free (g_array_index (e->properties, char *, i)); g_array_free (e->properties, TRUE); @@ -458,7 +471,7 @@ listener_entry_free (EventListenerEntry *e) * * (other object events) * - * object:state-changed + * object:state-changed * object:children-changed * object:visible-data-changed * object:selection-changed @@ -476,7 +489,7 @@ listener_entry_free (EventListenerEntry *e) * object:announcement * * (screen reader events) -* screen-reader:region-changed + * screen-reader:region-changed * * (window events) * @@ -510,7 +523,7 @@ listener_entry_free (EventListenerEntry *e) * mouse:b3p * mouse:b3r * - * NOTE: this character string may be UTF-8, but should not contain byte + * NOTE: this character string may be UTF-8, but should not contain byte * value 56 * (ascii ':'), except as a delimiter, since non-UTF-8 string * delimiting functions are used internally. @@ -525,11 +538,11 @@ listener_entry_free (EventListenerEntry *e) **/ gboolean atspi_event_listener_register (AtspiEventListener *listener, - const gchar *event_type, - GError **error) + const gchar *event_type, + GError **error) { /* TODO: Keep track of which events have been registered, so that we - * deregister all of them when the event listener is destroyed */ + * deregister all of them when the event listener is destroyed */ return atspi_event_listener_register_from_callback (listener->callback, listener->user_data, @@ -543,7 +556,7 @@ atspi_event_listener_register (AtspiEventListener *listener, * @event_type: a character string indicating the type of events for which * notification is requested. See #atspi_event_listener_register * for a description of the format and legal event types. -* @properties: (element-type gchar*) (transfer none) (allow-none): a list of + * @properties: (element-type gchar*) (transfer none) (allow-none): a list of * properties that should be sent along with the event. The * properties are valued for the duration of the event callback. * TODO: Document. @@ -554,12 +567,12 @@ atspi_event_listener_register (AtspiEventListener *listener, **/ gboolean atspi_event_listener_register_full (AtspiEventListener *listener, - const gchar *event_type, - GArray *properties, - GError **error) + const gchar *event_type, + GArray *properties, + GError **error) { /* TODO: Keep track of which events have been registered, so that we - * deregister all of them when the event listener is destroyed */ + * deregister all of them when the event listener is destroyed */ return atspi_event_listener_register_from_callback_full (listener->callback, listener->user_data, @@ -575,7 +588,7 @@ atspi_event_listener_register_full (AtspiEventListener *listener, * @event_type: a character string indicating the type of events for which * notification is requested. See #atspi_event_listener_register * for a description of the format and legal event types. -* @properties: (element-type gchar*) (transfer none) (allow-none): a list of + * @properties: (element-type gchar*) (transfer none) (allow-none): a list of * properties that should be sent along with the event. The * properties are valued for the duration of the event callback. * @app: (allow-none): the application whose events should be reported, or @@ -587,10 +600,10 @@ atspi_event_listener_register_full (AtspiEventListener *listener, **/ gboolean atspi_event_listener_register_with_app (AtspiEventListener *listener, - const gchar *event_type, - GArray *properties, - AtspiAccessible *app, - GError **error) + const gchar *event_type, + GArray *properties, + AtspiAccessible *app, + GError **error) { return atspi_event_listener_register_from_callback_with_app (listener->callback, listener->user_data, @@ -604,13 +617,13 @@ atspi_event_listener_register_with_app (AtspiEventListener *listener, static gboolean notify_event_registered (EventListenerEntry *e) { - const char *app_path = (e->app? e->app->parent.app->bus_name: ""); + const char *app_path = (e->app ? e->app->parent.app->bus_name : ""); dbind_method_call_reentrant (_atspi_bus (), atspi_bus_registry, - atspi_path_registry, - atspi_interface_registry, - "RegisterEvent", - NULL, "sass", e->event_type, + atspi_path_registry, + atspi_interface_registry, + "RegisterEvent", + NULL, "sass", e->event_type, e->properties, app_path); return TRUE; @@ -618,14 +631,14 @@ notify_event_registered (EventListenerEntry *e) /** * atspi_event_listener_register_from_callback: - * @callback: (scope notified): the #AtspiEventListenerCB to be registered + * @callback: (scope notified): the #AtspiEventListenerCB to be registered * against an event type. * @user_data: (closure): User data to be passed to the callback. * @callback_destroyed: A #GDestroyNotify called when the callback is destroyed. * @event_type: a character string indicating the type of events for which * notification is requested. See #atspi_event_listener_register * for a description of the format. - * + * * Registers an #AtspiEventListenerCB against an @event_type. * * Returns: #TRUE if successfull, otherwise #FALSE. @@ -633,10 +646,10 @@ notify_event_registered (EventListenerEntry *e) **/ gboolean atspi_event_listener_register_from_callback (AtspiEventListenerCB callback, - void *user_data, - GDestroyNotify callback_destroyed, - const gchar *event_type, - GError **error) + void *user_data, + GDestroyNotify callback_destroyed, + const gchar *event_type, + GError **error) { return atspi_event_listener_register_from_callback_with_app (callback, user_data, @@ -676,11 +689,11 @@ copy_event_properties (GArray *src) **/ gboolean atspi_event_listener_register_from_callback_full (AtspiEventListenerCB callback, - void *user_data, - GDestroyNotify callback_destroyed, - const gchar *event_type, - GArray *properties, - GError **error) + void *user_data, + GDestroyNotify callback_destroyed, + const gchar *event_type, + GArray *properties, + GError **error) { return atspi_event_listener_register_from_callback_with_app (callback, user_data, @@ -696,7 +709,7 @@ atspi_event_listener_register_from_callback_full (AtspiEventListenerCB callback, * @callback_destroyed: (destroy callback) * @event_type: * @properties: (element-type utf8) -* @app: (allow-none) + * @app: (allow-none) * @error: * * Returns: #TRUE if successful, otherwise #FALSE. @@ -704,12 +717,12 @@ atspi_event_listener_register_from_callback_full (AtspiEventListenerCB callback, **/ gboolean atspi_event_listener_register_from_callback_with_app (AtspiEventListenerCB callback, - void *user_data, - GDestroyNotify callback_destroyed, - const gchar *event_type, - GArray *properties, - AtspiAccessible *app, - GError **error) + void *user_data, + GDestroyNotify callback_destroyed, + const gchar *event_type, + GArray *properties, + AtspiAccessible *app, + GError **error) { EventListenerEntry *e; DBusError d_error; @@ -722,42 +735,42 @@ atspi_event_listener_register_from_callback_with_app (AtspiEventListenerCB callb } if (!event_type) - { - g_warning ("called atspi_event_listener_register_from_callback with a NULL event_type"); - return FALSE; - } + { + g_warning ("called atspi_event_listener_register_from_callback with a NULL event_type"); + return FALSE; + } e = g_new0 (EventListenerEntry, 1); e->event_type = g_strdup (event_type); e->callback = callback; e->user_data = user_data; e->callback_destroyed = callback_destroyed; - callback_ref (callback == remove_datum ? (gpointer)user_data : (gpointer)callback, + callback_ref (callback == remove_datum ? (gpointer) user_data : (gpointer) callback, callback_destroyed); if (!convert_event_type_to_dbus (event_type, &e->category, &e->name, &e->detail, app, &matchrule_array)) - { - g_free (e->event_type); - g_free (e); - return FALSE; - } + { + g_free (e->event_type); + g_free (e); + return FALSE; + } if (app) e->app = g_object_ref (app); e->properties = copy_event_properties (properties); event_listeners = g_list_prepend (event_listeners, e); for (i = 0; i < matchrule_array->len; i++) - { - char *matchrule = g_ptr_array_index (matchrule_array, i); - dbus_error_init (&d_error); - dbus_bus_add_match (_atspi_bus(), matchrule, &d_error); - if (dbus_error_is_set (&d_error)) - { - g_warning ("AT-SPI: Adding match: %s", d_error.message); - dbus_error_free (&d_error); - /* TODO: Set error */ - } + { + char *matchrule = g_ptr_array_index (matchrule_array, i); + dbus_error_init (&d_error); + dbus_bus_add_match (_atspi_bus (), matchrule, &d_error); + if (dbus_error_is_set (&d_error)) + { + g_warning ("AT-SPI: Adding match: %s", d_error.message); + dbus_error_free (&d_error); + /* TODO: Set error */ + } - g_free (matchrule); - } + g_free (matchrule); + } g_ptr_array_free (matchrule_array, TRUE); notify_event_registered (e); @@ -790,16 +803,16 @@ _atspi_reregister_event_listeners () * and toolkit events (e.g. "Gtk", "AWT"). * Examples: "focus:", "Gtk:GtkWidget:button_press_event". * - * Registers an #AtspiEventListenetSimpleCB. The method is similar to + * Registers an #AtspiEventListenetSimpleCB. The method is similar to * #atspi_event_listener_register, but @callback takes no user_data. * * Returns: #TRUE if successfull, otherwise #FALSE. **/ gboolean atspi_event_listener_register_no_data (AtspiEventListenerSimpleCB callback, - GDestroyNotify callback_destroyed, - const gchar *event_type, - GError **error) + GDestroyNotify callback_destroyed, + const gchar *event_type, + GError **error) { return atspi_event_listener_register_from_callback (remove_datum, callback, callback_destroyed, @@ -809,7 +822,7 @@ atspi_event_listener_register_no_data (AtspiEventListenerSimpleCB callback, static gboolean is_superset (const gchar *super, const gchar *sub) { - if (!super || !super [0]) + if (!super || !super[0]) return TRUE; return (strcmp (super, sub) == 0); } @@ -827,8 +840,8 @@ is_superset (const gchar *super, const gchar *sub) **/ gboolean atspi_event_listener_deregister (AtspiEventListener *listener, - const gchar *event_type, - GError **error) + const gchar *event_type, + GError **error) { return atspi_event_listener_deregister_from_callback (listener->callback, listener->user_data, @@ -850,9 +863,9 @@ atspi_event_listener_deregister (AtspiEventListener *listener, **/ gboolean atspi_event_listener_deregister_from_callback (AtspiEventListenerCB callback, - void *user_data, - const gchar *event_type, - GError **error) + void *user_data, + const gchar *event_type, + GError **error) { char *category, *name, *detail; GPtrArray *matchrule_array; @@ -860,57 +873,58 @@ atspi_event_listener_deregister_from_callback (AtspiEventListenerCB callback, GList *l; if (!convert_event_type_to_dbus (event_type, &category, &name, &detail, NULL, &matchrule_array)) - { - return FALSE; - } + { + return FALSE; + } if (!callback) { return FALSE; } for (l = event_listeners; l;) - { - EventListenerEntry *e = l->data; - if (e->callback == callback && - e->user_data == user_data && - is_superset (category, e->category) && - is_superset (name, e->name) && - is_superset (detail, e->detail)) { - DBusMessage *message, *reply; - l = g_list_next (l); - if (in_send) - { - pending_removals = g_list_remove (pending_removals, e); - pending_removals = g_list_append (pending_removals, e); - } + EventListenerEntry *e = l->data; + if (e->callback == callback && + e->user_data == user_data && + is_superset (category, e->category) && + is_superset (name, e->name) && + is_superset (detail, e->detail)) + { + DBusMessage *message, *reply; + l = g_list_next (l); + if (in_send) + { + pending_removals = g_list_remove (pending_removals, e); + pending_removals = g_list_append (pending_removals, e); + } + else + event_listeners = g_list_remove (event_listeners, e); + for (i = 0; i < matchrule_array->len; i++) + { + char *matchrule = g_ptr_array_index (matchrule_array, i); + dbus_bus_remove_match (_atspi_bus (), matchrule, NULL); + } + message = dbus_message_new_method_call (atspi_bus_registry, + atspi_path_registry, + atspi_interface_registry, + "DeregisterEvent"); + if (!message) + return FALSE; + dbus_message_append_args (message, DBUS_TYPE_STRING, &event_type, DBUS_TYPE_INVALID); + reply = _atspi_dbus_send_with_reply_and_block (message, error); + if (reply) + dbus_message_unref (reply); + + if (!in_send) + listener_entry_free (e); + } else - event_listeners = g_list_remove (event_listeners, e); - for (i = 0; i < matchrule_array->len; i++) - { - char *matchrule = g_ptr_array_index (matchrule_array, i); - dbus_bus_remove_match (_atspi_bus(), matchrule, NULL); - } - message = dbus_message_new_method_call (atspi_bus_registry, - atspi_path_registry, - atspi_interface_registry, - "DeregisterEvent"); - if (!message) - return FALSE; - dbus_message_append_args (message, DBUS_TYPE_STRING, &event_type, DBUS_TYPE_INVALID); - reply = _atspi_dbus_send_with_reply_and_block (message, error); - if (reply) - dbus_message_unref (reply); - - if (!in_send) - listener_entry_free (e); + l = g_list_next (l); } - else - l = g_list_next (l); - } g_free (category); g_free (name); - if (detail) g_free (detail); + if (detail) + g_free (detail); for (i = 0; i < matchrule_array->len; i++) g_free (g_ptr_array_index (matchrule_array, i)); g_ptr_array_free (matchrule_array, TRUE); @@ -931,8 +945,8 @@ atspi_event_listener_deregister_from_callback (AtspiEventListenerCB callback, **/ gboolean atspi_event_listener_deregister_no_data (AtspiEventListenerSimpleCB callback, - const gchar *event_type, - GError **error) + const gchar *event_type, + GError **error) { return atspi_event_listener_deregister_from_callback (remove_datum, callback, event_type, @@ -973,7 +987,7 @@ detail_matches_listener (const char *event_detail, const char *listener_detail) if (!event_detail) return (listener_detail ? FALSE : TRUE); - return !(listener_detail [strcspn (listener_detail, ":")] == '\0' + return !(listener_detail[strcspn (listener_detail, ":")] == '\0' ? strncmp (listener_detail, event_detail, strcspn (event_detail, ":")) : strcmp (listener_detail, event_detail)); @@ -996,51 +1010,52 @@ _atspi_send_event (AtspiEvent *e) /* Ensure that the value is set to avoid a Python exception */ /* TODO: Figure out how to do this without using a private field */ if (e->any_data.g_type == 0) - { - g_value_init (&e->any_data, G_TYPE_INT); - g_value_set_int (&e->any_data, 0); - } + { + g_value_init (&e->any_data, G_TYPE_INT); + g_value_set_int (&e->any_data, 0); + } if (!convert_event_type_to_dbus (e->type, &category, &name, &detail, NULL, NULL)) - { - g_warning ("AT-SPI: Couldn't parse event: %s\n", e->type); - return; - } + { + g_warning ("AT-SPI: Couldn't parse event: %s\n", e->type); + return; + } in_send++; for (l = event_listeners; l; l = g_list_next (l)) - { - EventListenerEntry *entry = l->data; - if (!strcmp (category, entry->category) && - (entry->name == NULL || !strcmp (name, entry->name)) && - detail_matches_listener (detail, entry->detail) && - (entry->app == NULL || !strcmp (entry->app->parent.app->bus_name, - e->source->parent.app->bus_name))) { - GList *l2; - for (l2 = called_listeners; l2; l2 = l2->next) - { - EventListenerEntry *e2 = l2->data; - if (entry->callback == e2->callback && entry->user_data == e2->user_data) - break; - } - if (!l2) - { - for (l2 = pending_removals; l2; l2 = l2->next) + EventListenerEntry *entry = l->data; + if (!strcmp (category, entry->category) && + (entry->name == NULL || !strcmp (name, entry->name)) && + detail_matches_listener (detail, entry->detail) && + (entry->app == NULL || !strcmp (entry->app->parent.app->bus_name, + e->source->parent.app->bus_name))) { - if (l2->data == entry) - break; + GList *l2; + for (l2 = called_listeners; l2; l2 = l2->next) + { + EventListenerEntry *e2 = l2->data; + if (entry->callback == e2->callback && entry->user_data == e2->user_data) + break; + } + if (!l2) + { + for (l2 = pending_removals; l2; l2 = l2->next) + { + if (l2->data == entry) + break; + } + } + if (!l2) + { + entry->callback (atspi_event_copy (e), entry->user_data); + called_listeners = g_list_prepend (called_listeners, entry); + } } - } - if (!l2) - { - entry->callback (atspi_event_copy (e), entry->user_data); - called_listeners = g_list_prepend (called_listeners, entry); - } } - } in_send--; - if (detail) g_free (detail); + if (detail) + g_free (detail); g_free (name); g_free (category); g_list_free (called_listeners); @@ -1068,30 +1083,30 @@ _atspi_dbus_handle_event (DBusConnection *bus, DBusMessage *message) if (strcmp (signature, "siiv(so)") != 0 && strcmp (signature, "siiva{sv}") != 0) - { - g_warning ("Got invalid signature %s for signal %s from interface %s\n", signature, member, category); - return DBUS_HANDLER_RESULT_HANDLED; - } + { + g_warning ("Got invalid signature %s for signal %s from interface %s\n", signature, member, category); + return DBUS_HANDLER_RESULT_HANDLED; + } memset (&e, 0, sizeof (e)); if (category) - { - category = g_utf8_strrchr (category, -1, '.'); - if (category == NULL) + { + category = g_utf8_strrchr (category, -1, '.'); + if (category == NULL) + { + // TODO: Error + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + category++; + } + else { // TODO: Error + // Note that the single caller of this function, process_deferred_message(), ignores the return value. + // We should probably free the message if we aren't going to process it after all. return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } - category++; - } - else - { - // TODO: Error - // Note that the single caller of this function, process_deferred_message(), ignores the return value. - // We should probably free the message if we aren't going to process it after all. - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } dbus_message_iter_get_basic (&iter, &detail); dbus_message_iter_next (&iter); dbus_message_iter_get_basic (&iter, &detail1); @@ -1105,108 +1120,108 @@ _atspi_dbus_handle_event (DBusConnection *bus, DBusMessage *message) name = convert_name_from_dbus (member, FALSE); detail = convert_name_from_dbus (detail, TRUE); - if (strcasecmp (category, name) != 0) - { - p = g_strconcat (converted_type, ":", name, NULL); - g_free (converted_type); - converted_type = p; - } - else if (detail [0] == '\0') - { - p = g_strconcat (converted_type, ":", NULL); - g_free (converted_type); - converted_type = p; - } + if (strcasecmp (category, name) != 0) + { + p = g_strconcat (converted_type, ":", name, NULL); + g_free (converted_type); + converted_type = p; + } + else if (detail[0] == '\0') + { + p = g_strconcat (converted_type, ":", NULL); + g_free (converted_type); + converted_type = p; + } if (detail[0] != '\0') - { - p = g_strconcat (converted_type, ":", detail, NULL); - g_free (converted_type); - converted_type = p; - } + { + p = g_strconcat (converted_type, ":", detail, NULL); + g_free (converted_type); + converted_type = p; + } e.type = converted_type; if (strcmp (category, "ScreenReader") != 0) - { - e.source = _atspi_ref_accessible (sender, dbus_message_get_path (message)); - if (e.source == NULL) { - g_warning ("Got no valid source accessible for signal %s from interface %s\n", member, category); - g_free (converted_type); - g_free (name); - g_free (detail); - return DBUS_HANDLER_RESULT_HANDLED; + e.source = _atspi_ref_accessible (sender, dbus_message_get_path (message)); + if (e.source == NULL) + { + g_warning ("Got no valid source accessible for signal %s from interface %s\n", member, category); + g_free (converted_type); + g_free (name); + g_free (detail); + return DBUS_HANDLER_RESULT_HANDLED; + } } - } dbus_message_iter_recurse (&iter, &iter_variant); switch (dbus_message_iter_get_arg_type (&iter_variant)) - { - case DBUS_TYPE_STRUCT: { - AtspiRect rect; - if (demarshal_rect (&iter_variant, &rect)) - { - g_value_init (&e.any_data, ATSPI_TYPE_RECT); - g_value_set_boxed (&e.any_data, &rect); - } - else + case DBUS_TYPE_STRUCT: { - AtspiAccessible *accessible; - accessible = _atspi_dbus_consume_accessible (&iter_variant); - if (!strcmp (category, "ScreenReader")) - { - g_object_unref (e.source); - e.source = accessible; - } + AtspiRect rect; + if (demarshal_rect (&iter_variant, &rect)) + { + g_value_init (&e.any_data, ATSPI_TYPE_RECT); + g_value_set_boxed (&e.any_data, &rect); + } else - { - g_value_init (&e.any_data, ATSPI_TYPE_ACCESSIBLE); - g_value_set_instance (&e.any_data, accessible); - if (accessible) - g_object_unref (accessible); /* value now owns it */ - } + { + AtspiAccessible *accessible; + accessible = _atspi_dbus_consume_accessible (&iter_variant); + if (!strcmp (category, "ScreenReader")) + { + g_object_unref (e.source); + e.source = accessible; + } + else + { + g_value_init (&e.any_data, ATSPI_TYPE_ACCESSIBLE); + g_value_set_instance (&e.any_data, accessible); + if (accessible) + g_object_unref (accessible); /* value now owns it */ + } + } + break; } - break; - } case DBUS_TYPE_STRING: - { - dbus_message_iter_get_basic (&iter_variant, &p); - g_value_init (&e.any_data, G_TYPE_STRING); - g_value_set_string (&e.any_data, p); + { + dbus_message_iter_get_basic (&iter_variant, &p); + g_value_init (&e.any_data, G_TYPE_STRING); + g_value_set_string (&e.any_data, p); + break; + } + default: break; } - default: - break; - } g_assert (e.source != NULL); dbus_message_iter_next (&iter); if (dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_ARRAY) - { - /* new form -- parse properties sent with event */ - cache = _atspi_dbus_update_cache_from_dict (e.source, &iter); - } + { + /* new form -- parse properties sent with event */ + cache = _atspi_dbus_update_cache_from_dict (e.source, &iter); + } e.sender = _atspi_ref_accessible (sender, ATSPI_DBUS_PATH_ROOT); if (!strncmp (e.type, "object:children-changed", 23)) - { - cache_process_children_changed (&e); - } + { + cache_process_children_changed (&e); + } else if (!strncmp (e.type, "object:property-change", 22)) - { - cache_process_property_change (&e); - } + { + cache_process_property_change (&e); + } else if (!strncmp (e.type, "object:state-changed", 20)) - { - cache_process_state_changed (&e); - } + { + cache_process_state_changed (&e); + } else if (!strncmp (e.type, "focus", 5)) - { - /* BGO#663992 - TODO: figure out the real problem */ - e.source->cached_properties &= ~(ATSPI_CACHE_STATES); - } + { + /* BGO#663992 - TODO: figure out the real problem */ + e.source->cached_properties &= ~(ATSPI_CACHE_STATES); + } _atspi_send_event (&e); diff --git a/atspi/atspi-event-listener.h b/atspi/atspi-event-listener.h index 687e1e78..b294525e 100644 --- a/atspi/atspi-event-listener.h +++ b/atspi/atspi-event-listener.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -40,26 +40,26 @@ GType atspi_event_get_type (void); * @user_data: User data which is passed to the callback each time a notification takes place. * * A function prototype for callbacks via which clients are notified of AT-SPI events. - * + * **/ -typedef void (*AtspiEventListenerCB) (AtspiEvent *event, - void *user_data); +typedef void (*AtspiEventListenerCB) (AtspiEvent *event, + void *user_data); /** * AtspiEventListenerSimpleCB: * @event: (transfer full): The event for which notification is sent. * * Like #AtspiEventlistenerCB, but with no user_data. - * + * **/ -typedef void (*AtspiEventListenerSimpleCB) (const AtspiEvent *event); +typedef void (*AtspiEventListenerSimpleCB) (const AtspiEvent *event); -#define ATSPI_TYPE_EVENT_LISTENER (atspi_event_listener_get_type ()) -#define ATSPI_EVENT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_EVENT_LISTENER, AtspiEventListener)) -#define ATSPI_EVENT_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_EVENT_LISTENER, AtspiEventListenerClass)) -#define ATSPI_IS_EVENT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_EVENT_LISTENER)) -#define ATSPI_IS_EVENT_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_EVENT_LISTENER)) -#define ATSPI_EVENT_LISTENER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_EVENT_LISTENER, AtspiEventListenerClass)) +#define ATSPI_TYPE_EVENT_LISTENER (atspi_event_listener_get_type ()) +#define ATSPI_EVENT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_EVENT_LISTENER, AtspiEventListener)) +#define ATSPI_EVENT_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_EVENT_LISTENER, AtspiEventListenerClass)) +#define ATSPI_IS_EVENT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_EVENT_LISTENER)) +#define ATSPI_IS_EVENT_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_EVENT_LISTENER)) +#define ATSPI_EVENT_LISTENER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_EVENT_LISTENER, AtspiEventListenerClass)) typedef struct _AtspiEventListener AtspiEventListener; struct _AtspiEventListener @@ -80,8 +80,8 @@ GType atspi_event_listener_get_type (void); AtspiEventListener * atspi_event_listener_new (AtspiEventListenerCB callback, - gpointer user_data, - GDestroyNotify callback_destroyed); + gpointer user_data, + GDestroyNotify callback_destroyed); AtspiEventListener * atspi_event_listener_new_simple (AtspiEventListenerSimpleCB callback, @@ -89,68 +89,68 @@ atspi_event_listener_new_simple (AtspiEventListenerSimpleCB callback, gboolean atspi_event_listener_register (AtspiEventListener *listener, - const gchar *event_type, - GError **error); + const gchar *event_type, + GError **error); gboolean atspi_event_listener_register_full (AtspiEventListener *listener, - const gchar *event_type, - GArray *properties, - GError **error); + const gchar *event_type, + GArray *properties, + GError **error); gboolean atspi_event_listener_register_with_app (AtspiEventListener *listener, - const gchar *event_type, + const gchar *event_type, GArray *properties, AtspiAccessible *app, - GError **error); + GError **error); gboolean atspi_event_listener_register_from_callback (AtspiEventListenerCB callback, - void *user_data, - GDestroyNotify callback_destroyed, - const gchar *event_type, - GError **error); + void *user_data, + GDestroyNotify callback_destroyed, + const gchar *event_type, + GError **error); gboolean atspi_event_listener_register_from_callback_full (AtspiEventListenerCB callback, - void *user_data, - GDestroyNotify callback_destroyed, - const gchar *event_type, + void *user_data, + GDestroyNotify callback_destroyed, + const gchar *event_type, GArray *properties, - GError **error); + GError **error); gboolean atspi_event_listener_register_from_callback_with_app (AtspiEventListenerCB callback, - void *user_data, - GDestroyNotify callback_destroyed, - const gchar *event_type, + void *user_data, + GDestroyNotify callback_destroyed, + const gchar *event_type, GArray *properties, AtspiAccessible *app, - GError **error); + GError **error); gboolean atspi_event_listener_register_no_data (AtspiEventListenerSimpleCB callback, - GDestroyNotify callback_destroyed, - const gchar *event_type, - GError **error); + GDestroyNotify callback_destroyed, + const gchar *event_type, + GError **error); gboolean atspi_event_listener_deregister (AtspiEventListener *listener, - const gchar *event_type, - GError **error); + const gchar *event_type, + GError **error); gboolean atspi_event_listener_deregister_from_callback (AtspiEventListenerCB callback, - void *user_data, - const gchar *event_type, - GError **error); + void *user_data, + const gchar *event_type, + GError **error); gboolean atspi_event_listener_deregister_no_data (AtspiEventListenerSimpleCB callback, - const gchar *event_type, - GError **error); + const gchar *event_type, + GError **error); G_END_DECLS -#endif /* _ATSPI_EVENT_LISTENER_H_ */ +#endif /* _ATSPI_EVENT_LISTENER_H_ */ diff --git a/atspi/atspi-gmain.c b/atspi/atspi-gmain.c index 588a60d1..941fee8c 100644 --- a/atspi/atspi-gmain.c +++ b/atspi/atspi-gmain.c @@ -5,7 +5,7 @@ * Copyright (C) 2005 Red Hat, Inc. * * Licensed under the Academic Free License version 2.1 - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -15,7 +15,7 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA @@ -24,9 +24,9 @@ * and unnecessary code removed. */ +#include "glib.h" #include <config.h> #include <dbus/dbus.h> -#include "glib.h" #include <string.h> #include <libintl.h> @@ -41,16 +41,16 @@ */ typedef struct { - GSource source; /* the parent GSource */ + GSource source; /* the parent GSource */ DBusConnection *connection; /* the connection to dispatch */ } DBusGMessageQueue; -static gboolean message_queue_prepare (GSource *source, - gint *timeout); -static gboolean message_queue_check (GSource *source); -static gboolean message_queue_dispatch (GSource *source, - GSourceFunc callback, - gpointer user_data); +static gboolean message_queue_prepare (GSource *source, + gint *timeout); +static gboolean message_queue_check (GSource *source); +static gboolean message_queue_dispatch (GSource *source, + GSourceFunc callback, + gpointer user_data); static const GSourceFuncs message_queue_funcs = { message_queue_prepare, @@ -61,13 +61,13 @@ static const GSourceFuncs message_queue_funcs = { static gboolean message_queue_prepare (GSource *source, - gint *timeout) + gint *timeout) { - DBusConnection *connection = ((DBusGMessageQueue *)source)->connection; - + DBusConnection *connection = ((DBusGMessageQueue *) source)->connection; + *timeout = -1; - return (dbus_connection_get_dispatch_status (connection) == DBUS_DISPATCH_DATA_REMAINS); + return (dbus_connection_get_dispatch_status (connection) == DBUS_DISPATCH_DATA_REMAINS); } static gboolean @@ -77,17 +77,17 @@ message_queue_check (GSource *source) } static gboolean -message_queue_dispatch (GSource *source, - GSourceFunc callback, - gpointer user_data) +message_queue_dispatch (GSource *source, + GSourceFunc callback, + gpointer user_data) { - DBusConnection *connection = ((DBusGMessageQueue *)source)->connection; + DBusConnection *connection = ((DBusGMessageQueue *) source)->connection; dbus_connection_ref (connection); /* Only dispatch once - we don't want to starve other GSource */ dbus_connection_dispatch (connection); - + dbus_connection_unref (connection); return TRUE; @@ -95,14 +95,13 @@ message_queue_dispatch (GSource *source, typedef struct { - GMainContext *context; /* the main context */ - GSList *ios; /* all IOHandler */ - GSList *timeouts; /* all TimeoutHandler */ - DBusConnection *connection; /* NULL if this is really for a server not a connection */ + GMainContext *context; /* the main context */ + GSList *ios; /* all IOHandler */ + GSList *timeouts; /* all TimeoutHandler */ + DBusConnection *connection; /* NULL if this is really for a server not a connection */ GSource *message_queue_source; /* DBusGMessageQueue */ } ConnectionSetup; - typedef struct { ConnectionSetup *cs; @@ -120,8 +119,8 @@ typedef struct dbus_int32_t _dbus_gmain_connection_slot = -1; static dbus_int32_t server_slot = -1; -static ConnectionSetup* -connection_setup_new (GMainContext *context, +static ConnectionSetup * +connection_setup_new (GMainContext *context, DBusConnection *connection) { ConnectionSetup *cs; @@ -129,9 +128,9 @@ connection_setup_new (GMainContext *context, cs = g_new0 (ConnectionSetup, 1); g_assert (context != NULL); - + cs->context = context; - g_main_context_ref (cs->context); + g_main_context_ref (cs->context); if (connection) { @@ -139,10 +138,10 @@ connection_setup_new (GMainContext *context, cs->message_queue_source = g_source_new ((GSourceFuncs *) &message_queue_funcs, sizeof (DBusGMessageQueue)); - ((DBusGMessageQueue*)cs->message_queue_source)->connection = connection; + ((DBusGMessageQueue *) cs->message_queue_source)->connection = connection; g_source_attach (cs->message_queue_source, cs->context); } - + return cs; } @@ -155,7 +154,7 @@ io_handler_source_finalized (gpointer data) if (handler->watch) dbus_watch_set_data (handler->watch, NULL, NULL); - + g_free (handler); } @@ -189,9 +188,9 @@ io_handler_watch_freed (void *data) } static gboolean -io_handler_dispatch (GIOChannel *source, - GIOCondition condition, - gpointer data) +io_handler_dispatch (GIOChannel *source, + GIOCondition condition, + gpointer data) { IOHandler *handler; guint dbus_condition = 0; @@ -200,10 +199,10 @@ io_handler_dispatch (GIOChannel *source, handler = data; connection = handler->cs->connection; - + if (connection) dbus_connection_ref (connection); - + if (condition & G_IO_IN) dbus_condition |= DBUS_WATCH_READABLE; if (condition & G_IO_OUT) @@ -222,7 +221,7 @@ io_handler_dispatch (GIOChannel *source, if (connection) dbus_connection_unref (connection); - + return TRUE; } @@ -231,16 +230,16 @@ io_handler_dispatch (GIOChannel *source, */ static void connection_setup_add_watch (ConnectionSetup *cs, - DBusWatch *watch) + DBusWatch *watch) { guint flags; GIOCondition condition; GIOChannel *channel; IOHandler *handler; - + if (!dbus_watch_get_enabled (watch)) return; - + flags = dbus_watch_get_flags (watch); condition = G_IO_ERR | G_IO_HUP; @@ -252,23 +251,23 @@ connection_setup_add_watch (ConnectionSetup *cs, handler = g_new0 (IOHandler, 1); handler->cs = cs; handler->watch = watch; - + channel = g_io_channel_unix_new (dbus_watch_get_unix_fd (watch)); - + handler->source = g_io_create_watch (channel, condition); g_source_set_callback (handler->source, (GSourceFunc) io_handler_dispatch, handler, io_handler_source_finalized); g_source_attach (handler->source, cs->context); cs->ios = g_slist_prepend (cs->ios, handler); - + dbus_watch_set_data (watch, handler, io_handler_watch_freed); g_io_channel_unref (channel); } static void connection_setup_remove_watch (ConnectionSetup *cs, - DBusWatch *watch) + DBusWatch *watch) { IOHandler *handler; @@ -276,7 +275,7 @@ connection_setup_remove_watch (ConnectionSetup *cs, if (handler == NULL || handler->cs != cs) return; - + io_handler_destroy_source (handler); } @@ -289,7 +288,7 @@ timeout_handler_source_finalized (gpointer data) if (handler->timeout) dbus_timeout_set_data (handler->timeout, NULL, NULL); - + g_free (handler); } @@ -323,26 +322,26 @@ timeout_handler_timeout_freed (void *data) } static gboolean -timeout_handler_dispatch (gpointer data) +timeout_handler_dispatch (gpointer data) { TimeoutHandler *handler; handler = data; dbus_timeout_handle (handler->timeout); - + return TRUE; } static void connection_setup_add_timeout (ConnectionSetup *cs, - DBusTimeout *timeout) + DBusTimeout *timeout) { TimeoutHandler *handler; - + if (!dbus_timeout_get_enabled (timeout)) return; - + handler = g_new0 (TimeoutHandler, 1); handler->cs = cs; handler->timeout = timeout; @@ -359,15 +358,15 @@ connection_setup_add_timeout (ConnectionSetup *cs, static void connection_setup_remove_timeout (ConnectionSetup *cs, - DBusTimeout *timeout) + DBusTimeout *timeout) { TimeoutHandler *handler; - + handler = dbus_timeout_get_data (timeout); if (handler == NULL) return; - + timeout_handler_destroy_source (handler); } @@ -390,27 +389,27 @@ connection_setup_free (ConnectionSetup *cs) g_source_destroy (source); g_source_unref (source); } - + g_main_context_unref (cs->context); g_free (cs); } static dbus_bool_t add_watch (DBusWatch *watch, - gpointer data) + gpointer data) { ConnectionSetup *cs; cs = data; connection_setup_add_watch (cs, watch); - + return TRUE; } static void remove_watch (DBusWatch *watch, - gpointer data) + gpointer data) { ConnectionSetup *cs; @@ -421,7 +420,7 @@ remove_watch (DBusWatch *watch, static void watch_toggled (DBusWatch *watch, - void *data) + void *data) { /* Because we just exit on OOM, enable/disable is * no different from add/remove @@ -434,12 +433,12 @@ watch_toggled (DBusWatch *watch, static dbus_bool_t add_timeout (DBusTimeout *timeout, - void *data) + void *data) { ConnectionSetup *cs; cs = data; - + if (!dbus_timeout_get_enabled (timeout)) return TRUE; @@ -450,7 +449,7 @@ add_timeout (DBusTimeout *timeout, static void remove_timeout (DBusTimeout *timeout, - void *data) + void *data) { ConnectionSetup *cs; @@ -461,7 +460,7 @@ remove_timeout (DBusTimeout *timeout, static void timeout_toggled (DBusTimeout *timeout, - void *data) + void *data) { /* Because we just exit on OOM, enable/disable is * no different from add/remove @@ -480,18 +479,17 @@ wakeup_main (void *data) g_main_context_wakeup (cs->context); } - /* Move to a new context */ -static ConnectionSetup* -connection_setup_new_from_old (GMainContext *context, +static ConnectionSetup * +connection_setup_new_from_old (GMainContext *context, ConnectionSetup *old) { ConnectionSetup *cs; g_assert (old->context != context); - + cs = connection_setup_new (context, old->connection); - + while (old->ios != NULL) { IOHandler *handler = old->ios->data; @@ -529,11 +527,11 @@ connection_setup_new_from_old (GMainContext *context, */ void atspi_dbus_connection_setup_with_g_main (DBusConnection *connection, - GMainContext *context) + GMainContext *context) { ConnectionSetup *old_setup; ConnectionSetup *cs; - + /* FIXME we never free the slot, so its refcount just keeps growing, * which is kind of broken. */ @@ -545,7 +543,7 @@ atspi_dbus_connection_setup_with_g_main (DBusConnection *connection, context = g_main_context_default (); cs = NULL; - + old_setup = dbus_connection_get_data (connection, _dbus_gmain_connection_slot); if (old_setup != NULL) { @@ -553,7 +551,7 @@ atspi_dbus_connection_setup_with_g_main (DBusConnection *connection, return; /* nothing to do */ cs = connection_setup_new_from_old (context, old_setup); - + /* Nuke the old setup */ dbus_connection_set_data (connection, _dbus_gmain_connection_slot, NULL, NULL); old_setup = NULL; @@ -563,9 +561,9 @@ atspi_dbus_connection_setup_with_g_main (DBusConnection *connection, cs = connection_setup_new (context, connection); if (!dbus_connection_set_data (connection, _dbus_gmain_connection_slot, cs, - (DBusFreeFunction)connection_setup_free)) + (DBusFreeFunction) connection_setup_free)) goto nomem; - + if (!dbus_connection_set_watch_functions (connection, add_watch, remove_watch, @@ -579,14 +577,14 @@ atspi_dbus_connection_setup_with_g_main (DBusConnection *connection, timeout_toggled, cs, NULL)) goto nomem; - + dbus_connection_set_wakeup_main_function (connection, - wakeup_main, - cs, NULL); - + wakeup_main, + cs, NULL); + return; - nomem: +nomem: g_error ("Not enough memory to set up DBusConnection for use with GLib"); } @@ -605,12 +603,12 @@ atspi_dbus_connection_setup_with_g_main (DBusConnection *connection, * connection. */ void -atspi_dbus_server_setup_with_g_main (DBusServer *server, - GMainContext *context) +atspi_dbus_server_setup_with_g_main (DBusServer *server, + GMainContext *context) { ConnectionSetup *old_setup; ConnectionSetup *cs; - + /* FIXME we never free the slot, so its refcount just keeps growing, * which is kind of broken. */ @@ -622,7 +620,7 @@ atspi_dbus_server_setup_with_g_main (DBusServer *server, context = g_main_context_default (); cs = NULL; - + old_setup = dbus_server_get_data (server, server_slot); if (old_setup != NULL) { @@ -630,7 +628,7 @@ atspi_dbus_server_setup_with_g_main (DBusServer *server, return; /* nothing to do */ cs = connection_setup_new_from_old (context, old_setup); - + /* Nuke the old setup */ if (!dbus_server_set_data (server, server_slot, NULL, NULL)) goto nomem; @@ -641,9 +639,9 @@ atspi_dbus_server_setup_with_g_main (DBusServer *server, cs = connection_setup_new (context, NULL); if (!dbus_server_set_data (server, server_slot, cs, - (DBusFreeFunction)connection_setup_free)) + (DBusFreeFunction) connection_setup_free)) goto nomem; - + if (!dbus_server_set_watch_functions (server, add_watch, remove_watch, @@ -657,9 +655,9 @@ atspi_dbus_server_setup_with_g_main (DBusServer *server, timeout_toggled, cs, NULL)) goto nomem; - + return; - nomem: +nomem: g_error ("Not enough memory to set up DBusServer for use with GLib"); } diff --git a/atspi/atspi-gmain.h b/atspi/atspi-gmain.h index 9efbe5e5..1fc3fb47 100644 --- a/atspi/atspi-gmain.h +++ b/atspi/atspi-gmain.h @@ -2,7 +2,7 @@ /* atspi-gmain.h atspi dbus gmain prototypes * * Licensed under the Academic Free License version 2.1 - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or @@ -12,7 +12,7 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA @@ -24,15 +24,18 @@ #ifndef _ATSPI_GMAIN_H #define _ATSPI_GMAIN_H +#include <dbus/dbus.h> +#include <glib.h> + G_BEGIN_DECLS void atspi_dbus_connection_setup_with_g_main (DBusConnection *connection, - GMainContext *context); + GMainContext *context); void -atspi_dbus_server_setup_with_g_main (DBusServer *server, - GMainContext *context); +atspi_dbus_server_setup_with_g_main (DBusServer *server, + GMainContext *context); G_END_DECLS diff --git a/atspi/atspi-hyperlink.c b/atspi/atspi-hyperlink.c index c815a31e..af091752 100644 --- a/atspi/atspi-hyperlink.c +++ b/atspi/atspi-hyperlink.c @@ -55,7 +55,7 @@ AtspiHyperlink * _atspi_hyperlink_new (AtspiApplication *app, const gchar *path) { AtspiHyperlink *hyperlink; - + hyperlink = g_object_new (ATSPI_TYPE_HYPERLINK, NULL); hyperlink->parent.app = g_object_ref (app); hyperlink->parent.path = g_strdup (path); @@ -124,7 +124,7 @@ atspi_hyperlink_get_uri (AtspiHyperlink *obj, int i, GError **error) * Returns: (transfer full): an #AtspiAccessible that represents the object * associated with the @ith anchor of the specified #AtspiHyperlink. **/ -AtspiAccessible* +AtspiAccessible * atspi_hyperlink_get_object (AtspiHyperlink *obj, gint i, GError **error) { dbus_int32_t d_i = i; @@ -207,7 +207,6 @@ atspi_hyperlink_get_end_index (AtspiHyperlink *obj, GError **error) return d_end_offset; } - /** * atspi_hyperlink_is_valid: * @obj: a pointer to the #AtspiHyperlink on which to operate. diff --git a/atspi/atspi-hyperlink.h b/atspi/atspi-hyperlink.h index 7caea90b..ebfb4e20 100644 --- a/atspi/atspi-hyperlink.h +++ b/atspi/atspi-hyperlink.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -30,17 +30,17 @@ #include "atspi-constants.h" -#include "atspi-text.h" /* for AtspiRange */ +#include "atspi-text.h" /* for AtspiRange */ #include "atspi-types.h" G_BEGIN_DECLS -#define ATSPI_TYPE_HYPERLINK (atspi_hyperlink_get_type ()) -#define ATSPI_HYPERLINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_HYPERLINK, AtspiHyperlink)) -#define ATSPI_HYPERLINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_HYPERLINK, AtspiHyperlinkClass)) -#define ATSPI_IS_HYPERLINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_HYPERLINK)) -#define ATSPI_IS_HYPERLINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_HYPERLINK)) -#define ATSPI_HYPERLINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_HYPERLINK, AtspiHyperlinkClass)) +#define ATSPI_TYPE_HYPERLINK (atspi_hyperlink_get_type ()) +#define ATSPI_HYPERLINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_HYPERLINK, AtspiHyperlink)) +#define ATSPI_HYPERLINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_HYPERLINK, AtspiHyperlinkClass)) +#define ATSPI_IS_HYPERLINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_HYPERLINK)) +#define ATSPI_IS_HYPERLINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_HYPERLINK)) +#define ATSPI_HYPERLINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_HYPERLINK, AtspiHyperlinkClass)) struct _AtspiHyperlink { @@ -53,18 +53,18 @@ struct _AtspiHyperlinkClass AtspiObjectClass parent_class; }; -GType atspi_hyperlink_get_type (void); +GType atspi_hyperlink_get_type (void); AtspiHyperlink * _atspi_hyperlink_new (AtspiApplication *app, const gchar *path); gint atspi_hyperlink_get_n_anchors (AtspiHyperlink *obj, GError **error); -gchar * atspi_hyperlink_get_uri (AtspiHyperlink *obj, int i, GError **error); +gchar *atspi_hyperlink_get_uri (AtspiHyperlink *obj, int i, GError **error); -AtspiAccessible* atspi_hyperlink_get_object (AtspiHyperlink *obj, gint i, GError **error); +AtspiAccessible *atspi_hyperlink_get_object (AtspiHyperlink *obj, gint i, GError **error); -AtspiRange * atspi_hyperlink_get_index_range (AtspiHyperlink *obj, GError **error); +AtspiRange *atspi_hyperlink_get_index_range (AtspiHyperlink *obj, GError **error); gint atspi_hyperlink_get_start_index (AtspiHyperlink *obj, GError **error); @@ -74,4 +74,4 @@ gboolean atspi_hyperlink_is_valid (AtspiHyperlink *obj, GError **error); G_END_DECLS -#endif /* _ATSPI_HYPERLINK_H_ */ +#endif /* _ATSPI_HYPERLINK_H_ */ diff --git a/atspi/atspi-hypertext.c b/atspi/atspi-hypertext.c index ffe20f21..c08c8bfe 100644 --- a/atspi/atspi-hypertext.c +++ b/atspi/atspi-hypertext.c @@ -77,7 +77,7 @@ atspi_hypertext_get_link (AtspiHypertext *obj, gint link_index, GError **error) { dbus_int32_t d_link_index = link_index; DBusMessage *reply; - + g_return_val_if_fail (obj != NULL, NULL); reply = _atspi_dbus_call_partial (obj, atspi_interface_hypertext, "GetLink", error, "i", d_link_index); @@ -99,7 +99,7 @@ atspi_hypertext_get_link (AtspiHypertext *obj, gint link_index, GError **error) **/ int atspi_hypertext_get_link_index (AtspiHypertext *obj, - gint character_offset, + gint character_offset, GError **error) { dbus_int32_t d_character_offset = character_offset; @@ -122,16 +122,15 @@ atspi_hypertext_get_type (void) { static GType type = 0; - if (!type) { - static const GTypeInfo tinfo = + if (!type) { - sizeof (AtspiHypertext), - (GBaseInitFunc) atspi_hypertext_base_init, - (GBaseFinalizeFunc) NULL, - }; - - type = g_type_register_static (G_TYPE_INTERFACE, "AtspiHypertext", &tinfo, 0); - - } + static const GTypeInfo tinfo = { + sizeof (AtspiHypertext), + (GBaseInitFunc) atspi_hypertext_base_init, + (GBaseFinalizeFunc) NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiHypertext", &tinfo, 0); + } return type; } diff --git a/atspi/atspi-hypertext.h b/atspi/atspi-hypertext.h index 891fd3a9..83e7add4 100644 --- a/atspi/atspi-hypertext.h +++ b/atspi/atspi-hypertext.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -34,10 +34,10 @@ G_BEGIN_DECLS -#define ATSPI_TYPE_HYPERTEXT (atspi_hypertext_get_type ()) -#define ATSPI_IS_HYPERTEXT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_HYPERTEXT) -#define ATSPI_HYPERTEXT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_HYPERTEXT, AtspiHypertext) -#define ATSPI_HYPERTEXT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_HYPERTEXT, AtspiHypertext)) +#define ATSPI_TYPE_HYPERTEXT (atspi_hypertext_get_type ()) +#define ATSPI_IS_HYPERTEXT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_HYPERTEXT) +#define ATSPI_HYPERTEXT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_HYPERTEXT, AtspiHypertext) +#define ATSPI_HYPERTEXT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_HYPERTEXT, AtspiHypertext)) GType atspi_hypertext_get_type (); @@ -48,10 +48,10 @@ struct _AtspiHypertext gint atspi_hypertext_get_n_links (AtspiHypertext *obj, GError **error); -AtspiHyperlink * atspi_hypertext_get_link (AtspiHypertext *obj, gint link_index, GError **error); +AtspiHyperlink *atspi_hypertext_get_link (AtspiHypertext *obj, gint link_index, GError **error); -gint atspi_hypertext_get_link_index (AtspiHypertext *obj, gint character_offset, GError **error); +gint atspi_hypertext_get_link_index (AtspiHypertext *obj, gint character_offset, GError **error); G_END_DECLS -#endif /* _ATSPI_HYPERTEXT_H_ */ +#endif /* _ATSPI_HYPERTEXT_H_ */ diff --git a/atspi/atspi-image.c b/atspi/atspi-image.c index 4fd5ae71..40737ab6 100644 --- a/atspi/atspi-image.c +++ b/atspi/atspi-image.c @@ -84,8 +84,8 @@ atspi_image_get_image_size (AtspiImage *obj, GError **error) * STATE_VISIBLE and STATE_SHOWING. * * Returns: a pointer to an #AtspiPoint where x and y correspond to the - * minimum coordinates of the displayed image. - * + * minimum coordinates of the displayed image. + * **/ AtspiPoint * atspi_image_get_image_position (AtspiImage *obj, @@ -119,13 +119,13 @@ atspi_image_get_image_position (AtspiImage *obj, * The returned values are meaningful only if the Image has both * STATE_VISIBLE and STATE_SHOWING. * - * Returns: a pointer to an #AtspiRect corresponding to the image's bounding box. The minimum x and y coordinates, + * Returns: a pointer to an #AtspiRect corresponding to the image's bounding box. The minimum x and y coordinates, * width, and height are specified. **/ AtspiRect * atspi_image_get_image_extents (AtspiImage *obj, - AtspiCoordType ctype, - GError **error) + AtspiCoordType ctype, + GError **error) { dbus_uint32_t d_ctype = ctype; AtspiRect bbox; @@ -147,7 +147,7 @@ atspi_image_get_image_extents (AtspiImage *obj, * Returns: A POSIX LC_MESSAGES-style locale value for image description and text. **/ gchar * -atspi_image_get_image_locale (AtspiImage *obj, GError **error) +atspi_image_get_image_locale (AtspiImage *obj, GError **error) { gchar *retval = NULL; @@ -168,16 +168,15 @@ atspi_image_get_type (void) { static GType type = 0; - if (!type) { - static const GTypeInfo tinfo = + if (!type) { - sizeof (AtspiImage), - (GBaseInitFunc) atspi_image_base_init, - (GBaseFinalizeFunc) NULL, - }; - - type = g_type_register_static (G_TYPE_INTERFACE, "AtspiImage", &tinfo, 0); - - } + static const GTypeInfo tinfo = { + sizeof (AtspiImage), + (GBaseInitFunc) atspi_image_base_init, + (GBaseFinalizeFunc) NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiImage", &tinfo, 0); + } return type; } diff --git a/atspi/atspi-image.h b/atspi/atspi-image.h index 57fe3a17..c101223a 100644 --- a/atspi/atspi-image.h +++ b/atspi/atspi-image.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -34,10 +34,10 @@ G_BEGIN_DECLS -#define ATSPI_TYPE_IMAGE (atspi_image_get_type ()) -#define ATSPI_IS_IMAGE(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_IMAGE) -#define ATSPI_IMAGE(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_IMAGE, AtspiImage) -#define ATSPI_IMAGE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_IMAGE, AtspiImage)) +#define ATSPI_TYPE_IMAGE (atspi_image_get_type ()) +#define ATSPI_IS_IMAGE(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_IMAGE) +#define ATSPI_IMAGE(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_IMAGE, AtspiImage) +#define ATSPI_IMAGE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_IMAGE, AtspiImage)) GType atspi_image_get_type (); @@ -46,16 +46,16 @@ struct _AtspiImage GTypeInterface parent; }; -gchar * atspi_image_get_image_description (AtspiImage *obj, GError **error); +gchar *atspi_image_get_image_description (AtspiImage *obj, GError **error); -AtspiPoint * atspi_image_get_image_size (AtspiImage *obj, GError **error); +AtspiPoint *atspi_image_get_image_size (AtspiImage *obj, GError **error); -AtspiPoint * atspi_image_get_image_position (AtspiImage *obj, AtspiCoordType ctype, GError **error); +AtspiPoint *atspi_image_get_image_position (AtspiImage *obj, AtspiCoordType ctype, GError **error); -AtspiRect * atspi_image_get_image_extents (AtspiImage *obj, AtspiCoordType ctype, GError **error); +AtspiRect *atspi_image_get_image_extents (AtspiImage *obj, AtspiCoordType ctype, GError **error); -gchar * atspi_image_get_image_locale (AtspiImage *obj, GError **error); +gchar *atspi_image_get_image_locale (AtspiImage *obj, GError **error); G_END_DECLS -#endif /* _ATSPI_IMAGE_H_ */ +#endif /* _ATSPI_IMAGE_H_ */ diff --git a/atspi/atspi-matchrule-private.h b/atspi/atspi-matchrule-private.h index a8b579a0..df12ba49 100644 --- a/atspi/atspi-matchrule-private.h +++ b/atspi/atspi-matchrule-private.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -38,4 +38,4 @@ _atspi_match_rule_marshal (AtspiMatchRule *rule, DBusMessageIter *iter); G_END_DECLS -#endif /* _ATSPI_MATCH_RULE_PRIVATE_H_ */ +#endif /* _ATSPI_MATCH_RULE_PRIVATE_H_ */ diff --git a/atspi/atspi-matchrule.c b/atspi/atspi-matchrule.c index a75150ee..b7508ca6 100644 --- a/atspi/atspi-matchrule.c +++ b/atspi/atspi-matchrule.c @@ -44,16 +44,16 @@ atspi_match_rule_dispose (GObject *object) AtspiMatchRule *rule = ATSPI_MATCH_RULE (object); if (rule->states) - { - g_object_unref (rule->states); - rule->states = NULL; - } + { + g_object_unref (rule->states); + rule->states = NULL; + } if (rule->attributes) - { - g_hash_table_unref (rule->attributes); - rule->attributes = NULL; - } + { + g_hash_table_unref (rule->attributes); + rule->attributes = NULL; + } G_OBJECT_CLASS (atspi_match_rule_parent_class)->dispose (object); } @@ -65,11 +65,11 @@ atspi_match_rule_finalize (GObject *object) gint i; if (rule->interfaces) - { - for (i = 0; i < rule->interfaces->len; i++) - g_free (g_array_index (rule->interfaces, gchar *, i)); - g_array_free (rule->interfaces, TRUE); - } + { + for (i = 0; i < rule->interfaces->len; i++) + g_free (g_array_index (rule->interfaces, gchar *, i)); + g_array_free (rule->interfaces, TRUE); + } if (rule->attributes) g_hash_table_unref (rule->attributes); @@ -114,7 +114,7 @@ atspi_match_rule_class_init (AtspiMatchRuleClass *klass) * inverting it would match all objects that are not of ROLE_HEADING, * focusable and clickable at the same time. * - * Creates a new #AtspiMatchRule with specified @states, @attributes, + * Creates a new #AtspiMatchRule with specified @states, @attributes, * @interfaces, and @roles. * * Returns: (transfer full): A new #AtspiMatchRule. @@ -138,44 +138,45 @@ atspi_match_rule_new (AtspiStateSet *states, rule->statematchtype = statematchtype; if (attributes) - { - GHashTableIter hash_table_iter; - gchar *key, *value; - rule->attributes = g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) g_free); - g_hash_table_iter_init (&hash_table_iter, attributes); - while (g_hash_table_iter_next (&hash_table_iter, (gpointer *)&key, - (gpointer *)&value)) - g_hash_table_insert (rule->attributes, g_strdup (key), g_strdup (value)); - } else + { + GHashTableIter hash_table_iter; + gchar *key, *value; + rule->attributes = g_hash_table_new_full (g_str_hash, g_str_equal, + (GDestroyNotify) g_free, + (GDestroyNotify) g_free); + g_hash_table_iter_init (&hash_table_iter, attributes); + while (g_hash_table_iter_next (&hash_table_iter, (gpointer *) &key, + (gpointer *) &value)) + g_hash_table_insert (rule->attributes, g_strdup (key), g_strdup (value)); + } + else rule->attributes = NULL; rule->attributematchtype = attributematchtype; if (interfaces) - { - rule->interfaces = g_array_new (TRUE, TRUE, sizeof (gchar *)); - for (i = 0; i < interfaces->len; i++) { - gchar *val = g_strdup (g_array_index (interfaces, gchar *, i)); - rule->interfaces = g_array_append_val (rule->interfaces, val); + rule->interfaces = g_array_new (TRUE, TRUE, sizeof (gchar *)); + for (i = 0; i < interfaces->len; i++) + { + gchar *val = g_strdup (g_array_index (interfaces, gchar *, i)); + rule->interfaces = g_array_append_val (rule->interfaces, val); + } } - } rule->interfacematchtype = interfacematchtype; if (roles) - { - for (i = 0; i < roles->len; i++) { - AtspiRole role = g_array_index (roles, AtspiRole, i); - if (role < 128) - rule->roles [role / 32] |= (1 << (role % 32)); - else - g_warning ("AT-SPI: unexpected role %d\n", role); + for (i = 0; i < roles->len; i++) + { + AtspiRole role = g_array_index (roles, AtspiRole, i); + if (role < 128) + rule->roles[role / 32] |= (1 << (role % 32)); + else + g_warning ("AT-SPI: unexpected role %d\n", role); + } } - } else - rule->roles [0] = rule->roles [1] = 0; + rule->roles[0] = rule->roles[1] = 0; rule->rolematchtype = rolematchtype; rule->invert = invert; @@ -190,7 +191,7 @@ append_entry (gpointer key, gpointer val, gpointer data) DBusMessageIter iter_entry; if (!dbus_message_iter_open_container (iter, DBUS_TYPE_DICT_ENTRY, NULL, - &iter_entry)) + &iter_entry)) return; dbus_message_iter_append_basic (&iter_entry, DBUS_TYPE_STRING, &key); dbus_message_iter_append_basic (&iter_entry, DBUS_TYPE_STRING, &val); @@ -201,7 +202,7 @@ gboolean _atspi_match_rule_marshal (AtspiMatchRule *rule, DBusMessageIter *iter) { DBusMessageIter iter_struct, iter_array, iter_dict; - dbus_int32_t states [2]; + dbus_int32_t states[2]; dbus_int32_t d_statematchtype = rule->statematchtype; dbus_int32_t d_attributematchtype = rule->attributematchtype; dbus_int32_t d_interfacematchtype = rule->interfacematchtype; @@ -216,17 +217,17 @@ _atspi_match_rule_marshal (AtspiMatchRule *rule, DBusMessageIter *iter) /* states */ if (rule->states) - { - states [0] = rule->states->states & 0xffffffff; - states [1] = rule->states->states >> 32; - } + { + states[0] = rule->states->states & 0xffffffff; + states[1] = rule->states->states >> 32; + } else - { - states [0] = states [1] = 0; - } + { + states[0] = states[1] = 0; + } dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "i", &iter_array); - dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_INT32, &states [0]); - dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_INT32, &states [1]); + dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_INT32, &states[0]); + dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_INT32, &states[1]); dbus_message_iter_close_container (&iter_struct, &iter_array); dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, &d_statematchtype); @@ -240,15 +241,15 @@ _atspi_match_rule_marshal (AtspiMatchRule *rule, DBusMessageIter *iter) dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, &d_attributematchtype); if (!dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "i", - &iter_array)) + &iter_array)) return FALSE; - d_role = rule->roles [0]; + d_role = rule->roles[0]; dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_INT32, &d_role); - d_role = rule->roles [1]; + d_role = rule->roles[1]; dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_INT32, &d_role); - d_role = rule->roles [2]; + d_role = rule->roles[2]; dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_INT32, &d_role); - d_role = rule->roles [3]; + d_role = rule->roles[3]; dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_INT32, &d_role); dbus_message_iter_close_container (&iter_struct, &iter_array); dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, @@ -256,16 +257,16 @@ _atspi_match_rule_marshal (AtspiMatchRule *rule, DBusMessageIter *iter) /* interfaces */ if (!dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "s", - &iter_array)) + &iter_array)) return FALSE; if (rule->interfaces) - { - for (i = 0; i < rule->interfaces->len; i++) { - char *val = g_array_index (rule->interfaces, gchar *, i); - dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_STRING, &val); + for (i = 0; i < rule->interfaces->len; i++) + { + char *val = g_array_index (rule->interfaces, gchar *, i); + dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_STRING, &val); + } } - } dbus_message_iter_close_container (&iter_struct, &iter_array); dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, &d_interfacematchtype); diff --git a/atspi/atspi-matchrule.h b/atspi/atspi-matchrule.h index ddcb0d6a..09ae1ecf 100644 --- a/atspi/atspi-matchrule.h +++ b/atspi/atspi-matchrule.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -28,18 +28,18 @@ #include "glib-object.h" -#include "atspi-stateset.h" #include "atspi-constants.h" +#include "atspi-stateset.h" #include "atspi-types.h" G_BEGIN_DECLS -#define ATSPI_TYPE_MATCH_RULE (atspi_match_rule_get_type ()) -#define ATSPI_MATCH_RULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_MATCH_RULE, AtspiMatchRule)) -#define ATSPI_MATCH_RULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_MATCH_RULE, AtspiMatchRuleClass)) -#define ATSPI_IS_MATCH_RULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_MATCH_RULE)) -#define ATSPI_IS_MATCH_RULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_MATCH_RULE)) -#define ATSPI_MATCH_RULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_MATCH_RULE, AtspiMatchRuleClass)) +#define ATSPI_TYPE_MATCH_RULE (atspi_match_rule_get_type ()) +#define ATSPI_MATCH_RULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_MATCH_RULE, AtspiMatchRule)) +#define ATSPI_MATCH_RULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_MATCH_RULE, AtspiMatchRuleClass)) +#define ATSPI_IS_MATCH_RULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_MATCH_RULE)) +#define ATSPI_IS_MATCH_RULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_MATCH_RULE)) +#define ATSPI_MATCH_RULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_MATCH_RULE, AtspiMatchRuleClass)) typedef struct _AtspiMatchRule AtspiMatchRule; struct _AtspiMatchRule @@ -51,7 +51,7 @@ struct _AtspiMatchRule AtspiCollectionMatchType attributematchtype; GArray *interfaces; AtspiCollectionMatchType interfacematchtype; - gint roles [4]; + gint roles[4]; AtspiCollectionMatchType rolematchtype; gboolean invert; }; @@ -77,4 +77,4 @@ atspi_match_rule_new (AtspiStateSet *states, G_END_DECLS -#endif /* _ATSPI_MATCH_RULE_H_ */ +#endif /* _ATSPI_MATCH_RULE_H_ */ diff --git a/atspi/atspi-misc-private.h b/atspi/atspi-misc-private.h index b3040d5d..e386a241 100644 --- a/atspi/atspi-misc-private.h +++ b/atspi/atspi-misc-private.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -73,9 +73,9 @@ extern const char *atspi_interface_value; /* function prototypes */ gint _atspi_get_iface_num (const char *iface); -DBusConnection * _atspi_bus (); +DBusConnection *_atspi_bus (); -AtspiAccessible * _atspi_ref_accessible (const char *app, const char *path); +AtspiAccessible *_atspi_ref_accessible (const char *app, const char *path); AtspiAccessible * _atspi_dbus_return_accessible_from_message (DBusMessage *message); @@ -97,7 +97,7 @@ DBusMessage *_atspi_dbus_call_partial_va (gpointer obj, const char *interface, c dbus_bool_t _atspi_dbus_get_property (gpointer obj, const char *interface, const char *name, GError **error, const char *type, void *data); -DBusMessage * _atspi_dbus_send_with_reply_and_block (DBusMessage *message, GError **error); +DBusMessage *_atspi_dbus_send_with_reply_and_block (DBusMessage *message, GError **error); GHashTable *_atspi_dbus_return_hash_from_message (DBusMessage *message); @@ -111,25 +111,24 @@ void _atspi_dbus_set_interfaces (AtspiAccessible *accessible, DBusMessageIter *i void _atspi_dbus_set_state (AtspiAccessible *accessible, DBusMessageIter *iter); -#define _ATSPI_DBUS_CHECK_SIG(message, type, error, ret) \ - if (!message) \ - return (ret); \ - if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR) \ - { \ - const char *err; \ - dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &err, DBUS_TYPE_INVALID); \ - if (err) \ - g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_IPC, err); \ - dbus_message_unref (message); \ - return ret; \ - } \ - if (strcmp (dbus_message_get_signature (message), type) != 0) \ - { \ - g_warning ("AT-SPI: Expected message signature %s but got %s at %s line %d", type, dbus_message_get_signature (message), __FILE__, __LINE__); \ - dbus_message_unref (message); \ - return (ret); \ - } - +#define _ATSPI_DBUS_CHECK_SIG(message, type, error, ret) \ + if (!message) \ + return (ret); \ + if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR) \ + { \ + const char *err; \ + dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &err, DBUS_TYPE_INVALID); \ + if (err) \ + g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_IPC, err); \ + dbus_message_unref (message); \ + return ret; \ + } \ + if (strcmp (dbus_message_get_signature (message), type) != 0) \ + { \ + g_warning ("AT-SPI: Expected message signature %s but got %s at %s line %d", type, dbus_message_get_signature (message), __FILE__, __LINE__); \ + dbus_message_unref (message); \ + return (ret); \ + } /** * ATSPI_ERROR: @@ -138,7 +137,7 @@ void _atspi_dbus_set_state (AtspiAccessible *accessible, DBusMessageIter *iter); * be from the #ATSPIAtspiError enumeration. See #GError for information on * error domains. */ -#define ATSPI_ERROR _atspi_error_quark() +#define ATSPI_ERROR _atspi_error_quark () GQuark _atspi_error_quark (void); /** @@ -162,7 +161,7 @@ GHashTable *_atspi_dbus_update_cache_from_dict (AtspiAccessible *accessible, DBu gboolean _atspi_prepare_screen_reader_interface (); -gchar * _atspi_strdup_and_adjust_for_dbus (const char *s); +gchar *_atspi_strdup_and_adjust_for_dbus (const char *s); G_END_DECLS -#endif /* _ATSPI_MISC_PRIVATE_H_ */ +#endif /* _ATSPI_MISC_PRIVATE_H_ */ diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c index dc22a53b..388d65d1 100644 --- a/atspi/atspi-misc.c +++ b/atspi/atspi-misc.c @@ -33,9 +33,9 @@ #include "X11/Xlib.h" #endif #include "atspi-gmain.h" +#include <ctype.h> #include <stdio.h> #include <string.h> -#include <ctype.h> /** * AtspiMisc: @@ -79,8 +79,7 @@ const char *atspi_interface_text = ATSPI_DBUS_INTERFACE_TEXT; const char *atspi_interface_cache = ATSPI_DBUS_INTERFACE_CACHE; const char *atspi_interface_value = ATSPI_DBUS_INTERFACE_VALUE; -static const char *interfaces[] = -{ +static const char *interfaces[] = { ATSPI_DBUS_INTERFACE_ACCESSIBLE, ATSPI_DBUS_INTERFACE_ACTION, ATSPI_DBUS_INTERFACE_APPLICATION, @@ -107,16 +106,17 @@ _atspi_get_iface_num (const char *iface) int i; for (i = 0; interfaces[i]; i++) - { - if (!strcmp(iface, interfaces[i])) return i; - } + { + if (!strcmp (iface, interfaces[i])) + return i; + } return -1; } GHashTable * _atspi_get_live_refs (void) { - if (!live_refs) + if (!live_refs) { live_refs = g_hash_table_new (g_direct_hash, g_direct_equal); } @@ -158,12 +158,12 @@ cleanup () /* TODO: Do we need this code, or should we just dispose the desktop? */ for (i = desktop->children->len - 1; i >= 0; i--) - { - AtspiAccessible *child = g_ptr_array_index (desktop->children, i); - if (child->parent.app) - g_object_run_dispose (G_OBJECT (child->parent.app)); - g_object_run_dispose (G_OBJECT (child)); - } + { + AtspiAccessible *child = g_ptr_array_index (desktop->children, i); + if (child->parent.app) + g_object_run_dispose (G_OBJECT (child->parent.app)); + g_object_run_dispose (G_OBJECT (child)); + } g_object_run_dispose (G_OBJECT (desktop->parent.app)); g_object_unref (desktop); @@ -177,7 +177,7 @@ end: bus = NULL; } - cleanup_deferred_message (); + cleanup_deferred_message (); } static gboolean atspi_inited = FALSE; @@ -194,32 +194,33 @@ handle_get_bus_address (DBusPendingCall *pending, void *user_data) DBusPendingCall *new_pending; if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_METHOD_RETURN) - { - if (dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &address, - DBUS_TYPE_INVALID) && address [0]) { - DBusError error; - DBusConnection *bus; + if (dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &address, + DBUS_TYPE_INVALID) && + address[0]) + { + DBusError error; + DBusConnection *bus; - dbus_error_init (&error); - bus = dbus_connection_open_private (address, &error); - if (bus) - { - if (app->bus) - { - dbus_connection_unref (app->bus); - } - app->bus = bus; - atspi_dbus_connection_setup_with_g_main(bus, g_main_context_default()); - } - else - { - if (!strcmp (error.name, DBUS_ERROR_FILE_NOT_FOUND)) - g_warning ("AT-SPI: Unable to open bus connection: %s", error.message); - dbus_error_free (&error); - } + dbus_error_init (&error); + bus = dbus_connection_open_private (address, &error); + if (bus) + { + if (app->bus) + { + dbus_connection_unref (app->bus); + } + app->bus = bus; + atspi_dbus_connection_setup_with_g_main (bus, g_main_context_default ()); + } + else + { + if (!strcmp (error.name, DBUS_ERROR_FILE_NOT_FOUND)) + g_warning ("AT-SPI: Unable to open bus connection: %s", error.message); + dbus_error_free (&error); + } + } } - } dbus_message_unref (reply); dbus_pending_call_unref (pending); @@ -246,14 +247,17 @@ get_application (const char *bus_name) DBusPendingCall *pending = NULL; if (!app_hash) - { - app_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_object_unref); - if (!app_hash) return NULL; - } + { + app_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_object_unref); + if (!app_hash) + return NULL; + } app = g_hash_table_lookup (app_hash, bus_name); - if (app) return app; + if (app) + return app; bus_name_dup = g_strdup (bus_name); - if (!bus_name_dup) return NULL; + if (!bus_name_dup) + return NULL; // TODO: change below to something that will send state-change:defunct notification if necessary */ app = _atspi_application_new (bus_name); app->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); @@ -267,10 +271,10 @@ get_application (const char *bus_name) dbus_connection_send_with_reply (app->bus, message, &pending, 2000); dbus_message_unref (message); if (!pending) - { - g_hash_table_remove (app_hash, bus_name_dup); - return NULL; - } + { + g_hash_table_remove (app_hash, bus_name_dup); + return NULL; + } dbus_pending_call_set_notify (pending, handle_get_bus_address, app, NULL); return app; } @@ -287,21 +291,21 @@ ref_accessible (const char *app_name, const char *path) app = get_application (app_name); if (!strcmp (path, "/org/a11y/atspi/accessible/root")) - { - if (!app->root) { - app->root = _atspi_accessible_new (app, atspi_path_root); - app->root->accessible_parent = atspi_get_desktop (0); - g_ptr_array_add (app->root->accessible_parent->children, g_object_ref (app->root)); + if (!app->root) + { + app->root = _atspi_accessible_new (app, atspi_path_root); + app->root->accessible_parent = atspi_get_desktop (0); + g_ptr_array_add (app->root->accessible_parent->children, g_object_ref (app->root)); + } + return g_object_ref (app->root); } - return g_object_ref (app->root); - } a = g_hash_table_lookup (app->hash, path); if (a) - { - return g_object_ref (a); - } + { + return g_object_ref (a); + } a = _atspi_accessible_new (app, path); if (!a) return NULL; @@ -320,13 +324,13 @@ ref_hyperlink (const char *app_name, const char *path) hyperlink = g_hash_table_lookup (app->hash, path); if (hyperlink) - { - return g_object_ref (hyperlink); - } + { + return g_object_ref (hyperlink); + } hyperlink = _atspi_hyperlink_new (app, path); g_hash_table_insert (app->hash, g_strdup (hyperlink->parent.path), hyperlink); /* TODO: This should be a weak ref */ - g_object_ref (hyperlink); /* for the hash */ + g_object_ref (hyperlink); /* for the hash */ return hyperlink; } @@ -353,10 +357,10 @@ handle_remove_accessible (DBusConnection *bus, DBusMessage *message) AtspiAccessible *a; if (strcmp (signature, "(so)") != 0) - { - g_warning ("AT-SPI: Unknown signature %s for RemoveAccessible", signature); - return DBUS_HANDLER_RESULT_HANDLED; - } + { + g_warning ("AT-SPI: Unknown signature %s for RemoveAccessible", signature); + return DBUS_HANDLER_RESULT_HANDLED; + } dbus_message_iter_init (message, &iter); dbus_message_iter_recurse (&iter, &iter_struct); @@ -369,7 +373,7 @@ handle_remove_accessible (DBusConnection *bus, DBusMessage *message) return DBUS_HANDLER_RESULT_HANDLED; g_object_run_dispose (G_OBJECT (a)); g_hash_table_remove (app->hash, a->parent.path); - g_object_unref (a); /* unref our own ref */ + g_object_unref (a); /* unref our own ref */ return DBUS_HANDLER_RESULT_HANDLED; } @@ -384,27 +388,27 @@ handle_name_owner_changed (DBusConnection *bus, DBusMessage *message) DBUS_TYPE_STRING, &old, DBUS_TYPE_STRING, &new, DBUS_TYPE_INVALID)) - { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } + { + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } if (!strcmp (name, "org.a11y.atspi.Registry")) - { - if (registry_lost && !old[0]) { - _atspi_reregister_event_listeners (); - _atspi_reregister_device_listeners (); - registry_lost = FALSE; + if (registry_lost && !old[0]) + { + _atspi_reregister_event_listeners (); + _atspi_reregister_device_listeners (); + registry_lost = FALSE; + } + else if (!new[0]) + registry_lost = TRUE; } - else if (!new[0]) - registry_lost = TRUE; - } else if (app_hash) - { - AtspiApplication *app = g_hash_table_lookup (app_hash, old); - if (app && !strcmp (app->bus_name, old)) - g_object_run_dispose (G_OBJECT (app)); - } + { + AtspiApplication *app = g_hash_table_lookup (app_hash, old); + if (app && !strcmp (app->bus_name, old)) + g_object_run_dispose (G_OBJECT (app)); + } return DBUS_HANDLER_RESULT_HANDLED; } @@ -458,48 +462,48 @@ add_accessible_from_iter (DBusMessageIter *iter) accessible->accessible_parent = parent; if (dbus_message_iter_get_arg_type (&iter_struct) == 'i') - { - /* Get index in parent */ - dbus_message_iter_get_basic (&iter_struct, &index); - if (index >= 0 && accessible->accessible_parent) { - if (index >= accessible->accessible_parent->children->len) - { - /* There is no room for this object */ - g_ptr_array_set_size (accessible->accessible_parent->children, index + 1); - } - else - { - /* This place is already taken - let's free this place with dignity */ - if (g_ptr_array_index (accessible->accessible_parent->children, index)) - g_object_unref (g_ptr_array_index (accessible->accessible_parent->children, index)); - } - g_ptr_array_index (accessible->accessible_parent->children, index) = g_object_ref (accessible); - } + /* Get index in parent */ + dbus_message_iter_get_basic (&iter_struct, &index); + if (index >= 0 && accessible->accessible_parent) + { + if (index >= accessible->accessible_parent->children->len) + { + /* There is no room for this object */ + g_ptr_array_set_size (accessible->accessible_parent->children, index + 1); + } + else + { + /* This place is already taken - let's free this place with dignity */ + if (g_ptr_array_index (accessible->accessible_parent->children, index)) + g_object_unref (g_ptr_array_index (accessible->accessible_parent->children, index)); + } + g_ptr_array_index (accessible->accessible_parent->children, index) = g_object_ref (accessible); + } - /* get child count */ - dbus_message_iter_next (&iter_struct); - dbus_message_iter_get_basic (&iter_struct, &count); - if (count >= 0) - { - g_ptr_array_set_size (accessible->children, count); - children_cached = TRUE; + /* get child count */ + dbus_message_iter_next (&iter_struct); + dbus_message_iter_get_basic (&iter_struct, &count); + if (count >= 0) + { + g_ptr_array_set_size (accessible->children, count); + children_cached = TRUE; + } } - } else if (dbus_message_iter_get_arg_type (&iter_struct) == 'a') - { - /* It's the old API with a list of children */ - /* TODO: Perhaps remove this code eventually */ - dbus_message_iter_recurse (&iter_struct, &iter_array); - while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID) { - AtspiAccessible *child; - child = _atspi_dbus_consume_accessible (&iter_array); - g_ptr_array_remove (accessible->children, child); - g_ptr_array_add (accessible->children, child); + /* It's the old API with a list of children */ + /* TODO: Perhaps remove this code eventually */ + dbus_message_iter_recurse (&iter_struct, &iter_array); + while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID) + { + AtspiAccessible *child; + child = _atspi_dbus_consume_accessible (&iter_array); + g_ptr_array_remove (accessible->children, child); + g_ptr_array_add (accessible->children, child); + } + children_cached = TRUE; } - children_cached = TRUE; - } /* interfaces */ dbus_message_iter_next (&iter_struct); @@ -529,10 +533,10 @@ add_accessible_from_iter (DBusMessageIter *iter) dbus_message_iter_next (&iter_struct); _atspi_accessible_add_cache (accessible, ATSPI_CACHE_NAME | ATSPI_CACHE_ROLE | - ATSPI_CACHE_PARENT | ATSPI_CACHE_DESCRIPTION); + ATSPI_CACHE_PARENT | ATSPI_CACHE_DESCRIPTION); if (!atspi_state_set_contains (accessible->states, - ATSPI_STATE_MANAGES_DESCENDANTS) && - children_cached) + ATSPI_STATE_MANAGES_DESCENDANTS) && + children_cached) _atspi_accessible_add_cache (accessible, ATSPI_CACHE_CHILDREN); /* This is a bit of a hack since the cache holds a ref, so we don't need @@ -547,32 +551,31 @@ handle_get_items (DBusPendingCall *pending, void *user_data) DBusMessageIter iter, iter_array; if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR) - { - const char *sender = dbus_message_get_sender (reply); - const char *error = NULL; - const char *error_name = dbus_message_get_error_name (reply); - if (!strcmp (error_name, DBUS_ERROR_SERVICE_UNKNOWN) - || !strcmp (error_name, DBUS_ERROR_NO_REPLY)) - { - } - else { - dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &error, - DBUS_TYPE_INVALID); - g_warning ("AT-SPI: Error in GetItems, sender=%s, error=%s", sender, error); + const char *sender = dbus_message_get_sender (reply); + const char *error = NULL; + const char *error_name = dbus_message_get_error_name (reply); + if (!strcmp (error_name, DBUS_ERROR_SERVICE_UNKNOWN) || !strcmp (error_name, DBUS_ERROR_NO_REPLY)) + { + } + else + { + dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &error, + DBUS_TYPE_INVALID); + g_warning ("AT-SPI: Error in GetItems, sender=%s, error=%s", sender, error); + } + dbus_message_unref (reply); + dbus_pending_call_unref (pending); + return; } - dbus_message_unref (reply); - dbus_pending_call_unref (pending); - return; - } dbus_message_iter_init (reply, &iter); dbus_message_iter_recurse (&iter, &iter_array); while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID) - { - add_accessible_from_iter (&iter_array); - dbus_message_iter_next (&iter_array); - } + { + add_accessible_from_iter (&iter_array); + dbus_message_iter_next (&iter_array); + } dbus_message_unref (reply); dbus_pending_call_unref (pending); } @@ -587,46 +590,46 @@ ref_accessible_desktop (AtspiApplication *app) gchar *bus_name_dup; if (desktop) - { - g_object_ref (desktop); - return desktop; - } + { + g_object_ref (desktop); + return desktop; + } desktop = _atspi_accessible_new (app, atspi_path_root); if (!desktop) - { - return NULL; - } + { + return NULL; + } g_hash_table_insert (app->hash, g_strdup (desktop->parent.path), g_object_ref (desktop)); app->root = g_object_ref (desktop); desktop->name = g_strdup ("main"); message = dbus_message_new_method_call (atspi_bus_registry, - atspi_path_root, - atspi_interface_accessible, - "GetChildren"); + atspi_path_root, + atspi_interface_accessible, + "GetChildren"); if (!message) return NULL; error = NULL; reply = _atspi_dbus_send_with_reply_and_block (message, &error); if (!reply || strcmp (dbus_message_get_signature (reply), "a(so)") != 0) - { - if (error != NULL) { - g_warning ("Couldn't get application list: %s", error->message); - g_clear_error (&error); + if (error != NULL) + { + g_warning ("Couldn't get application list: %s", error->message); + g_clear_error (&error); + } + if (reply) + dbus_message_unref (reply); + return NULL; } - if (reply) - dbus_message_unref (reply); - return NULL; - } dbus_message_iter_init (reply, &iter); dbus_message_iter_recurse (&iter, &iter_array); while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID) - { - const char *app_name, *path; - get_reference_from_iter (&iter_array, &app_name, &path); - add_app_to_desktop (desktop, app_name); - } + { + const char *app_name, *path; + get_reference_from_iter (&iter_array, &app_name, &path); + add_app_to_desktop (desktop, app_name); + } /* Record the alternate name as an alias for org.a11y.atspi.Registry */ bus_name_dup = g_strdup (dbus_message_get_sender (reply)); @@ -644,12 +647,12 @@ _atspi_ref_accessible (const char *app, const char *path) AtspiApplication *a = get_application (app); if (!a) return NULL; - if ( APP_IS_REGISTRY(a)) - { - if (!a->root) - g_object_unref (ref_accessible_desktop (a)); /* sets a->root */ - return g_object_ref (a->root); - } + if (APP_IS_REGISTRY (a)) + { + if (!a->root) + g_object_unref (ref_accessible_desktop (a)); /* sets a->root */ + return g_object_ref (a->root); + } return ref_accessible (app, path); } @@ -665,14 +668,14 @@ _atspi_dbus_return_accessible_from_message (DBusMessage *message) signature = dbus_message_get_signature (message); if (!strcmp (signature, "(so)")) - { - dbus_message_iter_init (message, &iter); - retval = _atspi_dbus_consume_accessible (&iter); - } + { + dbus_message_iter_init (message, &iter); + retval = _atspi_dbus_consume_accessible (&iter); + } else - { - g_warning ("AT-SPI: Called _atspi_dbus_return_accessible_from_message with strange signature %s", signature); - } + { + g_warning ("AT-SPI: Called _atspi_dbus_return_accessible_from_message with strange signature %s", signature); + } dbus_message_unref (message); return retval; } @@ -693,20 +696,20 @@ _atspi_dbus_return_hyperlink_from_message (DBusMessage *message) DBusMessageIter iter; AtspiHyperlink *retval = NULL; const char *signature; - + if (!message) return NULL; signature = dbus_message_get_signature (message); if (!strcmp (signature, "(so)")) - { - dbus_message_iter_init (message, &iter); - retval = _atspi_dbus_return_hyperlink_from_iter (&iter); - } + { + dbus_message_iter_init (message, &iter); + retval = _atspi_dbus_return_hyperlink_from_iter (&iter); + } else - { - g_warning ("AT-SPI: Called _atspi_dbus_return_hyperlink_from_message with strange signature %s", signature); - } + { + g_warning ("AT-SPI: Called _atspi_dbus_return_hyperlink_from_message with strange signature %s", signature); + } dbus_message_unref (message); return retval; } @@ -731,10 +734,10 @@ handle_add_accessible (DBusConnection *bus, DBusMessage *message) if (strcmp (signature, cache_signal_type) != 0 && strcmp (signature, old_cache_signal_type) != 0) - { - g_warning ("AT-SPI: AddAccessible with unknown signature %s\n", signature); - return DBUS_HANDLER_RESULT_HANDLED; - } + { + g_warning ("AT-SPI: AddAccessible with unknown signature %s\n", signature); + return DBUS_HANDLER_RESULT_HANDLED; + } dbus_message_iter_init (message, &iter); add_accessible_from_iter (&iter); @@ -757,31 +760,31 @@ process_deferred_message (BusDataClosure *closure) if (type == DBUS_MESSAGE_TYPE_SIGNAL && !strncmp (interface, "org.a11y.atspi.Event.", 21)) - { - _atspi_dbus_handle_event (closure->bus, closure->message); - } + { + _atspi_dbus_handle_event (closure->bus, closure->message); + } if (dbus_message_is_method_call (closure->message, atspi_interface_device_event_listener, "NotifyEvent")) - { - _atspi_dbus_handle_DeviceEvent (closure->bus, closure->message); - } + { + _atspi_dbus_handle_DeviceEvent (closure->bus, closure->message); + } if (dbus_message_is_signal (closure->message, atspi_interface_cache, "AddAccessible")) - { - handle_add_accessible (closure->bus, closure->message); - } + { + handle_add_accessible (closure->bus, closure->message); + } if (dbus_message_is_signal (closure->message, atspi_interface_cache, "RemoveAccessible")) - { - handle_remove_accessible (closure->bus, closure->message); - } + { + handle_remove_accessible (closure->bus, closure->message); + } if (dbus_message_is_signal (closure->message, "org.freedesktop.DBus", "NameOwnerChanged")) - { - handle_name_owner_changed (closure->bus, closure->message); - } + { + handle_name_owner_changed (closure->bus, closure->message); + } } static GQueue *deferred_messages = NULL; static void -destroy_deferred_message_item(gpointer ptr) +destroy_deferred_message_item (gpointer ptr) { BusDataClosure *c = ptr; dbus_message_unref (c->message); @@ -790,13 +793,13 @@ destroy_deferred_message_item(gpointer ptr) } static void -cleanup_deferred_message(void) +cleanup_deferred_message (void) { if (deferred_messages) - { - g_queue_free_full (deferred_messages, destroy_deferred_message_item); - deferred_messages = NULL; - } + { + g_queue_free_full (deferred_messages, destroy_deferred_message_item); + deferred_messages = NULL; + } } static gboolean @@ -809,10 +812,10 @@ process_deferred_messages (void) return TRUE; in_process_deferred_messages = 1; while ((closure = g_queue_pop_head (deferred_messages))) - { - process_deferred_message (closure); - destroy_deferred_message_item (closure); - } + { + process_deferred_message (closure); + destroy_deferred_message_item (closure); + } in_process_deferred_messages = 0; return FALSE; } @@ -838,13 +841,13 @@ defer_message (DBusConnection *connection, DBusMessage *message) g_queue_push_tail (deferred_messages, closure); if (process_deferred_messages_source == NULL) - { - process_deferred_messages_source = g_idle_source_new (); - g_source_set_callback (process_deferred_messages_source, - process_deferred_messages_callback, NULL, NULL); - g_source_attach (process_deferred_messages_source, atspi_main_context); - g_source_unref (process_deferred_messages_source); - } + { + process_deferred_messages_source = g_idle_source_new (); + g_source_set_callback (process_deferred_messages_source, + process_deferred_messages_callback, NULL, NULL); + g_source_attach (process_deferred_messages_source, atspi_main_context); + g_source_unref (process_deferred_messages_source); + } return DBUS_HANDLER_RESULT_HANDLED; } @@ -860,26 +863,26 @@ atspi_dbus_filter (DBusConnection *bus, DBusMessage *message, void *data) if (type == DBUS_MESSAGE_TYPE_SIGNAL && !strncmp (interface, "org.a11y.atspi.Event.", 21)) - { - return defer_message (bus, message); - } + { + return defer_message (bus, message); + } if (dbus_message_is_method_call (message, atspi_interface_device_event_listener, "NotifyEvent")) - { - return defer_message (bus, message); - } + { + return defer_message (bus, message); + } if (dbus_message_is_signal (message, atspi_interface_cache, "AddAccessible")) - { - return defer_message (bus, message); - } + { + return defer_message (bus, message); + } if (dbus_message_is_signal (message, atspi_interface_cache, "RemoveAccessible")) - { - return defer_message (bus, message); - } + { + return defer_message (bus, message); + } if (dbus_message_is_signal (message, "org.freedesktop.DBus", "NameOwnerChanged")) - { - defer_message (bus, message); - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } + { + defer_message (bus, message); + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } @@ -888,7 +891,7 @@ atspi_dbus_filter (DBusConnection *bus, DBusMessage *message, void *data) * * Connects to the accessibility registry and initializes the SPI. * - * Returns: 0 on success, 1 if already initialized, or an integer error code. + * Returns: 0 on success, 1 if already initialized, or an integer error code. **/ int atspi_init (void) @@ -903,13 +906,13 @@ atspi_init (void) atspi_inited = TRUE; - _atspi_get_live_refs(); + _atspi_get_live_refs (); bus = atspi_get_a11y_bus (); if (!bus) return 2; dbus_bus_register (bus, NULL); - atspi_dbus_connection_setup_with_g_main(bus, g_main_context_default()); + atspi_dbus_connection_setup_with_g_main (bus, g_main_context_default ()); dbus_connection_add_filter (bus, atspi_dbus_filter, NULL, NULL); match = g_strdup_printf ("type='signal',interface='%s',member='AddAccessible'", atspi_interface_cache); dbus_bus_add_match (bus, match, NULL); @@ -985,7 +988,7 @@ atspi_event_quit (void) /** * atspi_exit: * - * Disconnects from #AtspiRegistry instances and releases + * Disconnects from #AtspiRegistry instances and releases * any floating resources. Call only once at exit. * * Returns: 0 if there were no leaks, otherwise other integer values. @@ -1031,27 +1034,27 @@ check_for_hang (DBusMessage *message, DBusError *error, DBusConnection *bus, con { if (!message && error->name && !strcmp (error->name, "org.freedesktop.DBus.Error.NoReply")) - { - GSList *l; - DBusMessage *message; - gchar *bus_name_dup; - DBusPendingCall *pending = NULL; - for (l = hung_processes; l; l = l->next) - if (!strcmp (l->data, bus_name)) + { + GSList *l; + DBusMessage *message; + gchar *bus_name_dup; + DBusPendingCall *pending = NULL; + for (l = hung_processes; l; l = l->next) + if (!strcmp (l->data, bus_name)) + return; + message = dbus_message_new_method_call (bus_name, "/", + "org.freedesktop.DBus.Peer", + "Ping"); + if (!message) return; - message = dbus_message_new_method_call (bus_name, "/", - "org.freedesktop.DBus.Peer", - "Ping"); - if (!message) - return; - dbus_connection_send_with_reply (bus, message, &pending, -1); - dbus_message_unref (message); - if (!pending) - return; - bus_name_dup = g_strdup (bus_name); - hung_processes = g_slist_append (hung_processes, bus_name_dup); - dbus_pending_call_set_notify (pending, remove_hung_process, bus_name_dup, NULL); - } + dbus_connection_send_with_reply (bus, message, &pending, -1); + dbus_message_unref (message); + if (!pending) + return; + bus_name_dup = g_strdup (bus_name); + hung_processes = g_slist_append (hung_processes, bus_name_dup); + dbus_pending_call_set_notify (pending, remove_hung_process, bus_name_dup, NULL); + } } static gboolean @@ -1069,18 +1072,18 @@ static gboolean check_app (AtspiApplication *app, GError **error) { if (!app || !app->bus) - { - g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_APPLICATION_GONE, - _("The application no longer exists")); - return FALSE; - } + { + g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_APPLICATION_GONE, + _ ("The application no longer exists")); + return FALSE; + } if (atspi_main_loop && connection_is_hung (app->bus_name)) - { + { g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_IPC, "The process appears to be hung."); - return FALSE; - } + return FALSE; + } return TRUE; } @@ -1092,11 +1095,11 @@ set_timeout (AtspiApplication *app) int diff; if (app && app_startup_time > 0) - { - gettimeofday (&tv, NULL); - diff = (tv.tv_sec - app->time_added.tv_sec) * 1000 + (tv.tv_usec - app->time_added.tv_usec) / 1000; - dbind_set_timeout (MAX(method_call_timeout, app_startup_time - diff)); - } + { + gettimeofday (&tv, NULL); + diff = (tv.tv_sec - app->time_added.tv_sec) * 1000 + (tv.tv_usec - app->time_added.tv_usec) / 1000; + dbind_set_timeout (MAX (method_call_timeout, app_startup_time - diff)); + } else dbind_set_timeout (method_call_timeout); } @@ -1122,10 +1125,10 @@ _atspi_dbus_call (gpointer obj, const char *interface, const char *method, GErro check_for_hang (NULL, &err, aobj->app->bus, aobj->app->bus_name); process_deferred_messages (); if (dbus_error_is_set (&err)) - { - g_set_error(error, ATSPI_ERROR, ATSPI_ERROR_IPC, "%s", err.message); - dbus_error_free (&err); - } + { + g_set_error (error, ATSPI_ERROR, ATSPI_ERROR_IPC, "%s", err.message); + dbus_error_free (&err); + } return retval; } @@ -1134,7 +1137,8 @@ _atspi_dbus_call_partial (gpointer obj, const char *interface, const char *method, GError **error, - const char *type, ...) + const char *type, + ...) { DBusMessage *ret; va_list args; @@ -1146,20 +1150,19 @@ _atspi_dbus_call_partial (gpointer obj, return ret; } - DBusMessage * _atspi_dbus_call_partial_va (gpointer obj, - const char *interface, - const char *method, - GError **error, - const char *type, - va_list args) + const char *interface, + const char *method, + GError **error, + const char *type, + va_list args) { AtspiObject *aobj = ATSPI_OBJECT (obj); DBusError err; - DBusMessage *msg = NULL, *reply = NULL; - DBusMessageIter iter; - const char *p; + DBusMessage *msg = NULL, *reply = NULL; + DBusMessageIter iter; + const char *p; dbus_error_init (&err); @@ -1182,20 +1185,20 @@ out: dbus_message_unref (msg); process_deferred_messages (); if (dbus_error_is_set (&err)) - { - /* TODO: Set gerror */ - dbus_error_free (&err); - } + { + /* TODO: Set gerror */ + dbus_error_free (&err); + } if (reply && dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR) - { - const char *err_str = NULL; - dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &err_str, DBUS_TYPE_INVALID); - if (err_str) - g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_IPC, err_str); - dbus_message_unref (reply); - return NULL; - } + { + const char *err_str = NULL; + dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &err_str, DBUS_TYPE_INVALID); + if (err_str) + g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_IPC, err_str); + dbus_message_unref (reply); + return NULL; + } return reply; } @@ -1208,7 +1211,7 @@ _atspi_dbus_get_property (gpointer obj, const char *interface, const char *name, DBusError err; dbus_bool_t retval = FALSE; AtspiObject *aobj = ATSPI_OBJECT (obj); - char expected_type = (type [0] == '(' ? 'r' : type [0]); + char expected_type = (type[0] == '(' ? 'r' : type[0]); if (!aobj) return FALSE; @@ -1221,10 +1224,10 @@ _atspi_dbus_get_property (gpointer obj, const char *interface, const char *name, "org.freedesktop.DBus.Properties", "Get"); if (!message) - { - // TODO: throw exception - return FALSE; - } + { + // TODO: throw exception + return FALSE; + } dbus_message_append_args (message, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID); dbus_error_init (&err); set_timeout (aobj->app); @@ -1233,47 +1236,47 @@ _atspi_dbus_get_property (gpointer obj, const char *interface, const char *name, dbus_message_unref (message); process_deferred_messages (); if (!reply) - { - /* TODO: throw exception */ - goto done; - } + { + /* TODO: throw exception */ + goto done; + } if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR) - { - const char *err_str = NULL; - dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &err_str, DBUS_TYPE_INVALID); - if (err_str) - g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_IPC, err_str); - goto done; - } + { + const char *err_str = NULL; + dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &err_str, DBUS_TYPE_INVALID); + if (err_str) + g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_IPC, err_str); + goto done; + } dbus_message_iter_init (reply, &iter); if (dbus_message_iter_get_arg_type (&iter) != 'v') - { - g_warning ("atspi_dbus_get_property: expected a variant when fetching %s from interface %s; got %s\n", name, interface, dbus_message_get_signature (reply)); - goto done; - } + { + g_warning ("atspi_dbus_get_property: expected a variant when fetching %s from interface %s; got %s\n", name, interface, dbus_message_get_signature (reply)); + goto done; + } dbus_message_iter_recurse (&iter, &iter_variant); if (dbus_message_iter_get_arg_type (&iter_variant) != expected_type) - { - g_warning ("atspi_dbus_get_property: Wrong type: expected %s, got %c\n", type, dbus_message_iter_get_arg_type (&iter_variant)); - goto done; - } + { + g_warning ("atspi_dbus_get_property: Wrong type: expected %s, got %c\n", type, dbus_message_iter_get_arg_type (&iter_variant)); + goto done; + } if (!strcmp (type, "(so)")) - { - *((AtspiAccessible **)data) = _atspi_dbus_consume_accessible (&iter_variant); - } - else - { - if (type [0] == 's') { - *(char**) data = NULL; + *((AtspiAccessible **) data) = _atspi_dbus_consume_accessible (&iter_variant); } + else + { + if (type[0] == 's') + { + *(char **) data = NULL; + } - dbus_message_iter_get_basic (&iter_variant, data); - if (type [0] == 's') - *(char **)data = g_strdup (*(char **)data); - } + dbus_message_iter_get_basic (&iter_variant, data); + if (type[0] == 's') + *(char **) data = g_strdup (*(char **) data); + } retval = TRUE; done: dbus_error_free (&err); @@ -1293,20 +1296,20 @@ _atspi_dbus_send_with_reply_and_block (DBusMessage *message, GError **error) app = get_application (dbus_message_get_destination (message)); if (app && !app->bus) - return NULL; /* will fail anyway; app has been disposed */ + return NULL; /* will fail anyway; app has been disposed */ - bus = (app ? app->bus : _atspi_bus()); + bus = (app ? app->bus : _atspi_bus ()); dbus_error_init (&err); set_timeout (app); reply = dbind_send_and_allow_reentry (bus, message, &err); process_deferred_messages (); dbus_message_unref (message); if (dbus_error_is_set (&err)) - { - if (error) - g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_IPC, err.message); - dbus_error_free (&err); - } + { + if (error) + g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_IPC, err.message); + dbus_error_free (&err); + } return reply; } @@ -1337,15 +1340,15 @@ _atspi_dbus_hash_from_iter (DBusMessageIter *iter) dbus_message_iter_recurse (iter, &iter_array); while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID) - { - const char *name, *value; - dbus_message_iter_recurse (&iter_array, &iter_dict); - dbus_message_iter_get_basic (&iter_dict, &name); - dbus_message_iter_next (&iter_dict); - dbus_message_iter_get_basic (&iter_dict, &value); - g_hash_table_insert (hash, g_strdup (name), g_strdup (value)); - dbus_message_iter_next (&iter_array); - } + { + const char *name, *value; + dbus_message_iter_recurse (&iter_array, &iter_dict); + dbus_message_iter_get_basic (&iter_dict, &name); + dbus_message_iter_next (&iter_dict); + dbus_message_iter_get_basic (&iter_dict, &value); + g_hash_table_insert (hash, g_strdup (name), g_strdup (value)); + dbus_message_iter_next (&iter_array); + } return hash; } @@ -1375,27 +1378,30 @@ _atspi_dbus_attribute_array_from_iter (DBusMessageIter *iter) dbus_message_iter_recurse (iter, &iter_array); while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID) - { - const char *name, *value; - gchar *str; - dbus_message_iter_recurse (&iter_array, &iter_dict); - dbus_message_iter_get_basic (&iter_dict, &name); - dbus_message_iter_next (&iter_dict); - dbus_message_iter_get_basic (&iter_dict, &value); - str = g_strdup_printf ("%s:%s", name, value); - array = g_array_append_val (array, str); - dbus_message_iter_next (&iter_array);; - } + { + const char *name, *value; + gchar *str; + dbus_message_iter_recurse (&iter_array, &iter_dict); + dbus_message_iter_get_basic (&iter_dict, &name); + dbus_message_iter_next (&iter_dict); + dbus_message_iter_get_basic (&iter_dict, &value); + str = g_strdup_printf ("%s:%s", name, value); + array = g_array_append_val (array, str); + dbus_message_iter_next (&iter_array); + ; + } return array; } -typedef enum { +typedef enum +{ DEMARSHAL_STATUS_SUCCESS, DEMARSHAL_STATUS_INVALID_SIGNATURE, DEMARSHAL_STATUS_INVALID_VALUE, } DemarshalStatus; -typedef struct { +typedef struct +{ /* array of (char *) */ GPtrArray *names; } InterfaceNames; @@ -1412,19 +1418,19 @@ interface_names_demarshal (DBusMessageIter *iter, InterfaceNames **out_interface GPtrArray *names = g_ptr_array_new_with_free_func (g_free); if (!matches) - { - return DEMARSHAL_STATUS_INVALID_SIGNATURE; - } + { + return DEMARSHAL_STATUS_INVALID_SIGNATURE; + } DBusMessageIter iter_array; dbus_message_iter_recurse (iter, &iter_array); while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID) - { - const char *iface; - dbus_message_iter_get_basic (&iter_array, &iface); - g_ptr_array_add (names, g_strdup (iface)); - dbus_message_iter_next (&iter_array); - } + { + const char *iface; + dbus_message_iter_get_basic (&iter_array, &iface); + g_ptr_array_add (names, g_strdup (iface)); + dbus_message_iter_next (&iter_array); + } InterfaceNames *ifaces = g_new0 (InterfaceNames, 1); ifaces->names = names; @@ -1473,10 +1479,10 @@ _atspi_dbus_set_interfaces (AtspiAccessible *accessible, DBusMessageIter *iter) accessible->interfaces = 0; if (interface_names_demarshal (iter, &ifaces) != DEMARSHAL_STATUS_SUCCESS) - { - g_warning ("Passed iterator with invalid signature"); - return; - } + { + g_warning ("Passed iterator with invalid signature"); + return; + } accessible->interfaces = interface_names_to_bitmask (ifaces); interface_names_free (ifaces); @@ -1494,20 +1500,20 @@ _atspi_dbus_set_state (AtspiAccessible *accessible, DBusMessageIter *iter) dbus_message_iter_recurse (iter, &iter_array); dbus_message_iter_get_fixed_array (&iter_array, &states, &count); if (count != 2) - { - g_warning ("AT-SPI: expected 2 values in states array; got %d\n", count); - if (!accessible->states) - accessible->states = _atspi_state_set_new_internal (accessible, 0); - } + { + g_warning ("AT-SPI: expected 2 values in states array; got %d\n", count); + if (!accessible->states) + accessible->states = _atspi_state_set_new_internal (accessible, 0); + } else - { - guint64 val = ((guint64)states [1]) << 32; - val += states [0]; - if (!accessible->states) - accessible->states = _atspi_state_set_new_internal (accessible, val); - else - accessible->states->states = val; - } + { + guint64 val = ((guint64) states[1]) << 32; + val += states[0]; + if (!accessible->states) + accessible->states = _atspi_state_set_new_internal (accessible, val); + else + accessible->states->states = val; + } _atspi_accessible_add_cache (accessible, ATSPI_CACHE_STATES); } @@ -1583,17 +1589,17 @@ get_accessibility_bus_address_x11 (void) g_warning ("Could not open X display"); return NULL; } - + AT_SPI_BUS = XInternAtom (bridge_display, "AT_SPI_BUS", False); XGetWindowProperty (bridge_display, - XDefaultRootWindow (bridge_display), - AT_SPI_BUS, 0L, - (long) BUFSIZ, False, - (Atom) 31, &actual_type, &actual_format, - &nitems, &leftover, &data_x11); + XDefaultRootWindow (bridge_display), + AT_SPI_BUS, 0L, + (long) BUFSIZ, False, + (Atom) 31, &actual_type, &actual_format, + &nitems, &leftover, &data_x11); XCloseDisplay (bridge_display); - data = g_strdup ((gchar *)data_x11); + data = g_strdup ((gchar *) data_x11); XFree (data_x11); return data; } @@ -1613,34 +1619,34 @@ get_accessibility_bus_address_dbus (void) return NULL; message = dbus_message_new_method_call ("org.a11y.Bus", - "/org/a11y/bus", - "org.a11y.Bus", - "GetAddress"); + "/org/a11y/bus", + "org.a11y.Bus", + "GetAddress"); dbus_error_init (&error); reply = dbus_connection_send_with_reply_and_block (session_bus, - message, - -1, - &error); + message, + -1, + &error); dbus_message_unref (message); if (!reply) - { - g_warning ("AT-SPI: Error retrieving accessibility bus address: %s: %s", - error.name, error.message); - dbus_error_free (&error); - goto out; - } - + { + g_warning ("AT-SPI: Error retrieving accessibility bus address: %s: %s", + error.name, error.message); + dbus_error_free (&error); + goto out; + } + { const char *tmp_address; if (!dbus_message_get_args (reply, - NULL, - DBUS_TYPE_STRING, - &tmp_address, - DBUS_TYPE_INVALID)) + NULL, + DBUS_TYPE_STRING, + &tmp_address, + DBUS_TYPE_INVALID)) { - dbus_message_unref (reply); + dbus_message_unref (reply); goto out; } address = g_strdup (tmp_address); @@ -1701,7 +1707,7 @@ atspi_get_a11y_bus (void) if (!a11y_bus) { - if (!g_getenv("SSH_CONNECTION")) + if (!g_getenv ("SSH_CONNECTION")) g_warning ("Couldn't connect to accessibility bus: %s", error.message); dbus_error_free (&error); return NULL; @@ -1709,16 +1715,16 @@ atspi_get_a11y_bus (void) else { if (!dbus_bus_register (a11y_bus, &error)) - { - g_warning ("Couldn't register with accessibility bus: %s", error.message); + { + g_warning ("Couldn't register with accessibility bus: %s", error.message); dbus_error_free (&error); dbus_connection_close (a11y_bus); dbus_connection_unref (a11y_bus); a11y_bus = NULL; - return NULL; - } + return NULL; + } } - + /* Simulate a weak ref on the bus */ dbus_connection_set_data (a11y_bus, a11y_dbus_slot, a11y_bus, a11y_bus_free); @@ -1770,27 +1776,27 @@ atspi_set_main_context (GMainContext *cnx) if (atspi_main_context == cnx) return; if (process_deferred_messages_source != NULL) - { - g_source_destroy (process_deferred_messages_source); - process_deferred_messages_source = g_idle_source_new (); - g_source_set_callback (process_deferred_messages_source, - process_deferred_messages_callback, NULL, NULL); - g_source_attach (process_deferred_messages_source, cnx); - g_source_unref (process_deferred_messages_source); - } + { + g_source_destroy (process_deferred_messages_source); + process_deferred_messages_source = g_idle_source_new (); + g_source_set_callback (process_deferred_messages_source, + process_deferred_messages_callback, NULL, NULL); + g_source_attach (process_deferred_messages_source, cnx); + g_source_unref (process_deferred_messages_source); + } atspi_main_context = cnx; atspi_dbus_connection_setup_with_g_main (atspi_get_a11y_bus (), cnx); if (desktop) - { - gint i; - for (i = desktop->children->len - 1; i >= 0; i--) { - AtspiAccessible *child = g_ptr_array_index (desktop->children, i); - if (child->parent.app && child->parent.app->bus) - atspi_dbus_connection_setup_with_g_main (child->parent.app->bus, cnx); + gint i; + for (i = desktop->children->len - 1; i >= 0; i--) + { + AtspiAccessible *child = g_ptr_array_index (desktop->children, i); + if (child->parent.app && child->parent.app->bus) + atspi_dbus_connection_setup_with_g_main (child->parent.app->bus, cnx); + } } - } } #ifdef DEBUG_REF_COUNTS @@ -1816,11 +1822,11 @@ _atspi_name_compat (gchar *name) gchar *p = name; while (*p) - { - if (*p == '-') - *p = ' '; - p++; - } + { + if (*p == '-') + *p = ' '; + p++; + } return name; } @@ -1866,89 +1872,91 @@ _atspi_dbus_update_cache_from_dict (AtspiAccessible *accessible, DBusMessageIter dbus_message_iter_recurse (iter, &iter_dict); while (dbus_message_iter_get_arg_type (&iter_dict) != DBUS_TYPE_INVALID) - { - const char *key; - GValue *val = NULL; - dbus_message_iter_recurse (&iter_dict, &iter_dict_entry); - dbus_message_iter_get_basic (&iter_dict_entry, &key); - dbus_message_iter_next (&iter_dict_entry); - dbus_message_iter_recurse (&iter_dict_entry, &iter_variant); - if (!strcmp (key, "interfaces")) - { - _atspi_dbus_set_interfaces (accessible, &iter_variant); - } - else if (!strcmp (key, "Attributes")) - { - char *iter_sig = dbus_message_iter_get_signature (&iter_variant); - val = g_new0 (GValue, 1);; - g_value_init (val, G_TYPE_HASH_TABLE); - if (strcmp (iter_sig, "a{ss}") != 0) - { - dbus_free (iter_sig); - break; - } - dbus_free (iter_sig); - g_value_take_boxed (val, _atspi_dbus_hash_from_iter (&iter_variant)); - } - else if (!strcmp (key, "Component.ScreenExtents")) { - dbus_int32_t d_int; - AtspiRect extents; - char *iter_sig = dbus_message_iter_get_signature (&iter_variant); - val = g_new0 (GValue, 1);; - g_value_init (val, ATSPI_TYPE_RECT); - if (strcmp (iter_sig, "(iiii)") != 0) - { - dbus_free (iter_sig); - break; - } - dbus_free (iter_sig); - dbus_message_iter_recurse (&iter_variant, &iter_struct); - dbus_message_iter_get_basic (&iter_struct, &d_int); - extents.x = d_int; - dbus_message_iter_next (&iter_struct); - dbus_message_iter_get_basic (&iter_struct, &d_int); - extents.y = d_int; - dbus_message_iter_next (&iter_struct); - dbus_message_iter_get_basic (&iter_struct, &d_int); - extents.width = d_int; - dbus_message_iter_next (&iter_struct); - dbus_message_iter_get_basic (&iter_struct, &d_int); - extents.height = d_int; - g_value_set_boxed (val, &extents); + const char *key; + GValue *val = NULL; + dbus_message_iter_recurse (&iter_dict, &iter_dict_entry); + dbus_message_iter_get_basic (&iter_dict_entry, &key); + dbus_message_iter_next (&iter_dict_entry); + dbus_message_iter_recurse (&iter_dict_entry, &iter_variant); + if (!strcmp (key, "interfaces")) + { + _atspi_dbus_set_interfaces (accessible, &iter_variant); + } + else if (!strcmp (key, "Attributes")) + { + char *iter_sig = dbus_message_iter_get_signature (&iter_variant); + val = g_new0 (GValue, 1); + ; + g_value_init (val, G_TYPE_HASH_TABLE); + if (strcmp (iter_sig, "a{ss}") != 0) + { + dbus_free (iter_sig); + break; + } + dbus_free (iter_sig); + g_value_take_boxed (val, _atspi_dbus_hash_from_iter (&iter_variant)); + } + else if (!strcmp (key, "Component.ScreenExtents")) + { + dbus_int32_t d_int; + AtspiRect extents; + char *iter_sig = dbus_message_iter_get_signature (&iter_variant); + val = g_new0 (GValue, 1); + ; + g_value_init (val, ATSPI_TYPE_RECT); + if (strcmp (iter_sig, "(iiii)") != 0) + { + dbus_free (iter_sig); + break; + } + dbus_free (iter_sig); + dbus_message_iter_recurse (&iter_variant, &iter_struct); + dbus_message_iter_get_basic (&iter_struct, &d_int); + extents.x = d_int; + dbus_message_iter_next (&iter_struct); + dbus_message_iter_get_basic (&iter_struct, &d_int); + extents.y = d_int; + dbus_message_iter_next (&iter_struct); + dbus_message_iter_get_basic (&iter_struct, &d_int); + extents.width = d_int; + dbus_message_iter_next (&iter_struct); + dbus_message_iter_get_basic (&iter_struct, &d_int); + extents.height = d_int; + g_value_set_boxed (val, &extents); + } + if (val) + g_hash_table_insert (cache, g_strdup (key), val); + dbus_message_iter_next (&iter_dict); } - if (val) - g_hash_table_insert (cache, g_strdup (key), val); - dbus_message_iter_next (&iter_dict); - } return cache; } static const char *sr_introspection = "<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n" -"\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n" -"<node name=\"/org/a11y/atspi/screenreader\">\n" -" <interface name=\"org.a11y.Atspi.ScreenReader\">\n" -" <signal name=\"ReadingPosition\">\n" -" <arg type=\"i\"/>\n" -" <arg type=\"i\"/>\n" -" </signal>\n" -" </interface>\n" -"</node>"; + "\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n" + "<node name=\"/org/a11y/atspi/screenreader\">\n" + " <interface name=\"org.a11y.Atspi.ScreenReader\">\n" + " <signal name=\"ReadingPosition\">\n" + " <arg type=\"i\"/>\n" + " <arg type=\"i\"/>\n" + " </signal>\n" + " </interface>\n" + "</node>"; static DBusHandlerResult screen_reader_filter (DBusConnection *bus, DBusMessage *message, void *user_data) { if (dbus_message_is_method_call (message, DBUS_INTERFACE_INTROSPECTABLE, - "Introspect")) - { - DBusMessage *reply = dbus_message_new_method_return (message); - dbus_message_append_args (reply, DBUS_TYPE_STRING, &sr_introspection, - DBUS_TYPE_INVALID); - dbus_connection_send (bus, reply, NULL); - dbus_message_unref (reply); - return DBUS_HANDLER_RESULT_HANDLED; - } + "Introspect")) + { + DBusMessage *reply = dbus_message_new_method_return (message); + dbus_message_append_args (reply, DBUS_TYPE_STRING, &sr_introspection, + DBUS_TYPE_INVALID); + dbus_connection_send (bus, reply, NULL); + dbus_message_unref (reply); + return DBUS_HANDLER_RESULT_HANDLED; + } return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } @@ -1962,10 +1970,10 @@ _atspi_prepare_screen_reader_interface () return (initialized > 0); if (dbus_bus_request_name (a11y_bus, "org.a11y.Atspi.ScreenReader", 0, NULL) < 0) - { - initialized = -1; - return FALSE; - } + { + initialized = -1; + return FALSE; + } initialized = 1; dbus_connection_add_filter (a11y_bus, screen_reader_filter, NULL, NULL); @@ -1983,21 +1991,21 @@ _atspi_strdup_and_adjust_for_dbus (const char *s) return NULL; for (p = d; *p; p++) - { - if (*p == '-') - { - memmove (p, p + 1, g_utf8_strlen (p, -1)); - *p = toupper (*p); - } - else if (*p == ':') { - parts++; - if (parts == 2) - break; - p [1] = toupper (p [1]); + if (*p == '-') + { + memmove (p, p + 1, g_utf8_strlen (p, -1)); + *p = toupper (*p); + } + else if (*p == ':') + { + parts++; + if (parts == 2) + break; + p[1] = toupper (p[1]); + } } - } - d [0] = toupper (d [0]); + d[0] = toupper (d[0]); return d; } diff --git a/atspi/atspi-misc.h b/atspi/atspi-misc.h index 04617282..d820d94e 100644 --- a/atspi/atspi-misc.h +++ b/atspi/atspi-misc.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -46,7 +46,7 @@ atspi_set_timeout (gint val, gint startup_time); void atspi_set_main_context (GMainContext *cnx); -gchar * atspi_role_get_name (AtspiRole role); +gchar *atspi_role_get_name (AtspiRole role); G_END_DECLS -#endif /* _ATSPI_MISC_H_ */ +#endif /* _ATSPI_MISC_H_ */ diff --git a/atspi/atspi-mutter-private.h b/atspi/atspi-mutter-private.h index 49140d02..f2d1c10b 100644 --- a/atspi/atspi-mutter-private.h +++ b/atspi/atspi-mutter-private.h @@ -3,7 +3,7 @@ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * * Copyright 2019 SUSE LLC. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -33,4 +33,4 @@ gboolean _atspi_mutter_generate_mouse_event (glong x, glong y, const gchar *name void _atspi_mutter_set_reference_window (AtspiAccessible *accessible); G_END_DECLS -#endif /* _ATSPI_MUTTER_H_ */ +#endif /* _ATSPI_MUTTER_H_ */ diff --git a/atspi/atspi-mutter.c b/atspi/atspi-mutter.c index f6ceb84a..b40e2721 100644 --- a/atspi/atspi-mutter.c +++ b/atspi/atspi-mutter.c @@ -107,53 +107,53 @@ get_window_id (const char *name) if (!reply) return FALSE; if (strcmp (dbus_message_get_signature (reply), "a{ta{sv}}") != 0) - { - dbus_message_unref (reply); - return FALSE; - } + { + dbus_message_unref (reply); + return FALSE; + } dbus_message_iter_init (reply, &iter); dbus_message_iter_recurse (&iter, &iter_array); while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID) - { - dbus_message_iter_recurse (&iter_array, &iter_dict); - dbus_message_iter_get_basic (&iter_dict, &window_id); - dbus_message_iter_next (&iter_dict); - dbus_message_iter_recurse (&iter_dict, &iter_sub_array); - cur_name = NULL; - have_focus = FALSE; - while (dbus_message_iter_get_arg_type (&iter_sub_array) != DBUS_TYPE_INVALID) { - dbus_message_iter_recurse (&iter_sub_array, &iter_sub_dict); - dbus_message_iter_get_basic (&iter_sub_dict, &prop_name); - if (!strcmp (prop_name, "wm-class")) - { - DBusMessageIter iter_variant; - dbus_message_iter_next (&iter_sub_dict); - dbus_message_iter_recurse (&iter_sub_dict, &iter_variant); - dbus_message_iter_get_basic (&iter_variant, &cur_name); - } - if (!strcmp (prop_name, "has-focus")) - { - DBusMessageIter iter_variant; - dbus_message_iter_next (&iter_sub_dict); - dbus_message_iter_recurse (&iter_sub_dict, &iter_variant); - dbus_message_iter_get_basic (&iter_variant, &cur_focus); - have_focus = TRUE; - } - if (cur_name && have_focus) - { - if ((name && !strcmp (name, cur_name)) || cur_focus) + dbus_message_iter_recurse (&iter_array, &iter_dict); + dbus_message_iter_get_basic (&iter_dict, &window_id); + dbus_message_iter_next (&iter_dict); + dbus_message_iter_recurse (&iter_dict, &iter_sub_array); + cur_name = NULL; + have_focus = FALSE; + while (dbus_message_iter_get_arg_type (&iter_sub_array) != DBUS_TYPE_INVALID) { - dbus_message_unref (reply); - return window_id; + dbus_message_iter_recurse (&iter_sub_array, &iter_sub_dict); + dbus_message_iter_get_basic (&iter_sub_dict, &prop_name); + if (!strcmp (prop_name, "wm-class")) + { + DBusMessageIter iter_variant; + dbus_message_iter_next (&iter_sub_dict); + dbus_message_iter_recurse (&iter_sub_dict, &iter_variant); + dbus_message_iter_get_basic (&iter_variant, &cur_name); + } + if (!strcmp (prop_name, "has-focus")) + { + DBusMessageIter iter_variant; + dbus_message_iter_next (&iter_sub_dict); + dbus_message_iter_recurse (&iter_sub_dict, &iter_variant); + dbus_message_iter_get_basic (&iter_variant, &cur_focus); + have_focus = TRUE; + } + if (cur_name && have_focus) + { + if ((name && !strcmp (name, cur_name)) || cur_focus) + { + dbus_message_unref (reply); + return window_id; + } + break; + } + dbus_message_iter_next (&iter_sub_array); } - break; - } - dbus_message_iter_next (&iter_sub_array); + dbus_message_iter_next (&iter_array); } - dbus_message_iter_next (&iter_array); - } dbus_message_unref (reply); return 0; @@ -184,10 +184,10 @@ ensure_rd_session_id (GError **error) if (!reply) return FALSE; if (strcmp (dbus_message_get_signature (reply), "v") != 0) - { - dbus_message_unref (reply); - return FALSE; - } + { + dbus_message_unref (reply); + return FALSE; + } dbus_message_iter_init (reply, &iter); dbus_message_iter_recurse (&iter, &iter_variant); dbus_message_iter_get_basic (&iter_variant, &session_id); @@ -227,10 +227,10 @@ ensure_sc_session (GError **error) if (!reply) return FALSE; if (!dbus_message_get_args (reply, NULL, DBUS_TYPE_OBJECT_PATH, &sc_session_path, DBUS_TYPE_INVALID)) - { - dbus_message_unref (reply); - return FALSE; - } + { + dbus_message_unref (reply); + return FALSE; + } data.sc_session_path = g_strdup (sc_session_path); dbus_message_unref (reply); @@ -254,7 +254,7 @@ init_mutter (gboolean need_window, GError **error) return TRUE; window_id = (data.window_id_is_explicit) ? data.window_id - : get_window_id (NULL); + : get_window_id (NULL); if (!window_id) return FALSE; @@ -280,10 +280,10 @@ init_mutter (gboolean need_window, GError **error) if (!reply) return FALSE; if (!dbus_message_get_args (reply, NULL, DBUS_TYPE_OBJECT_PATH, &sc_stream_path, DBUS_TYPE_INVALID)) - { - dbus_message_unref (reply); - return FALSE; - } + { + dbus_message_unref (reply); + return FALSE; + } data.sc_stream_path = g_strdup (sc_stream_path); dbus_message_unref (reply); @@ -293,8 +293,9 @@ init_mutter (gboolean need_window, GError **error) gboolean _atspi_mutter_generate_keyboard_event (glong keyval, - const gchar *keystring, - AtspiKeySynthType synth_type, GError **error) + const gchar *keystring, + AtspiKeySynthType synth_type, + GError **error) { DBusError d_error; dbus_uint32_t d_keyval = keyval; @@ -304,31 +305,31 @@ _atspi_mutter_generate_keyboard_event (glong keyval, dbus_error_init (&d_error); switch (synth_type) - { - case ATSPI_KEY_PRESS: - dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyKeyboardKeycode", &d_error, "ub", d_keyval, TRUE); - break; - case ATSPI_KEY_RELEASE: - dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyKeyboardKeycode", &d_error, "ub", d_keyval, FALSE); - break; - case ATSPI_KEY_PRESSRELEASE: - dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyKeyboardKeycode", &d_error, "ub", d_keyval, TRUE); - dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyKeyboardKeycode", &d_error, "ub", d_keyval, FALSE); - break; - case ATSPI_KEY_SYM: - dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyKeyboardKeysym", &d_error, "ub", d_keyval, TRUE); - dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyKeyboardKeysym", &d_error, "ub", d_keyval, FALSE); - break; - default: - /* TODO: set error */ - g_warning ("%s: unsupported type", __func__); - return FALSE; - } + { + case ATSPI_KEY_PRESS: + dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyKeyboardKeycode", &d_error, "ub", d_keyval, TRUE); + break; + case ATSPI_KEY_RELEASE: + dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyKeyboardKeycode", &d_error, "ub", d_keyval, FALSE); + break; + case ATSPI_KEY_PRESSRELEASE: + dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyKeyboardKeycode", &d_error, "ub", d_keyval, TRUE); + dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyKeyboardKeycode", &d_error, "ub", d_keyval, FALSE); + break; + case ATSPI_KEY_SYM: + dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyKeyboardKeysym", &d_error, "ub", d_keyval, TRUE); + dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyKeyboardKeysym", &d_error, "ub", d_keyval, FALSE); + break; + default: + /* TODO: set error */ + g_warning ("%s: unsupported type", __func__); + return FALSE; + } if (dbus_error_is_set (&d_error)) { g_warning ("GenerateKeyboardEvent failed: %s", d_error.message); dbus_error_free (&d_error); - return FALSE; + return FALSE; } return TRUE; @@ -346,44 +347,44 @@ _atspi_mutter_generate_mouse_event (glong x, glong y, const gchar *name, GError dbus_error_init (&d_error); switch (name[0]) - { - case 'b': - button = name[1] - '1'; - if (button < 0 || button > 4) - return FALSE; - if (x != -1 && y != -1) - dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerMotionAbsolute", &d_error, "sdd", data.sc_stream_path, d_x, d_y); - switch (name[2]) { - case 'p': - dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerButton", &d_error, "ib", button, TRUE); - break; - case 'r': - dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerButton", &d_error, "ib", button, FALSE); + case 'b': + button = name[1] - '1'; + if (button < 0 || button > 4) + return FALSE; + if (x != -1 && y != -1) + dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerMotionAbsolute", &d_error, "sdd", data.sc_stream_path, d_x, d_y); + switch (name[2]) + { + case 'p': + dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerButton", &d_error, "ib", button, TRUE); + break; + case 'r': + dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerButton", &d_error, "ib", button, FALSE); + break; + case 'c': + dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerButton", &d_error, "ib", button, TRUE); + dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerButton", &d_error, "ib", button, FALSE); + break; + case 'd': + dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerButton", &d_error, "ib", button, TRUE); + dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerButton", &d_error, "ib", button, FALSE); + dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerButton", &d_error, "ib", button, TRUE); + dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerButton", &d_error, "ib", button, FALSE); + break; + default: + return FALSE; + } break; - case 'c': - dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerButton", &d_error, "ib", button, TRUE); - dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerButton", &d_error, "ib", button, FALSE); + case 'a': /* absolute motion */ + dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerMotionAbsolute", &d_error, "sdd", data.sc_stream_path, d_x, d_y); break; - case 'd': - dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerButton", &d_error, "ib", button, TRUE); - dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerButton", &d_error, "ib", button, FALSE); - dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerButton", &d_error, "ib", button, TRUE); - dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerButton", &d_error, "ib", button, FALSE); + case 'r': /* relative */ + dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerMotionRelative", &d_error, "dd", d_x, d_y); break; default: return FALSE; } - break; - case 'a': /* absolute motion */ - dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerMotionAbsolute", &d_error, "sdd", data.sc_stream_path, d_x, d_y); - break; - case 'r': /* relative */ - dbind_method_call_reentrant (data.bus, MUTTER_REMOTE_DESKTOP_BUS_NAME, data.rd_session_path, MUTTER_REMOTE_DESKTOP_SESSION_INTERFACE, "NotifyPointerMotionRelative", &d_error, "dd", d_x, d_y); - break; - default: - return FALSE; - } return TRUE; } @@ -391,17 +392,17 @@ void _atspi_mutter_set_reference_window (AtspiAccessible *accessible) { if (accessible) - { - AtspiRole role = atspi_accessible_get_role (accessible, NULL); - gchar *name; - g_return_if_fail (role != ATSPI_ROLE_APPLICATION); - name = atspi_accessible_get_name (accessible, NULL); - data.window_id = get_window_id (name); - data.window_id_is_explicit = TRUE; - } + { + AtspiRole role = atspi_accessible_get_role (accessible, NULL); + gchar *name; + g_return_if_fail (role != ATSPI_ROLE_APPLICATION); + name = atspi_accessible_get_name (accessible, NULL); + data.window_id = get_window_id (name); + data.window_id_is_explicit = TRUE; + } else - { - data.window_id_is_explicit = FALSE; - } + { + data.window_id_is_explicit = FALSE; + } } diff --git a/atspi/atspi-object.c b/atspi/atspi-object.c index a838ba0b..2e9a6d0e 100644 --- a/atspi/atspi-object.c +++ b/atspi/atspi-object.c @@ -36,10 +36,10 @@ atspi_object_dispose (GObject *object) AtspiObject *aobj = ATSPI_OBJECT (object); if (aobj->app) - { - g_object_unref (aobj->app); - aobj->app = NULL; - } + { + g_object_unref (aobj->app); + aobj->app = NULL; + } G_OBJECT_CLASS (atspi_object_parent_class)->dispose (object); } diff --git a/atspi/atspi-object.h b/atspi/atspi-object.h index 5acbde82..3bb0bc53 100644 --- a/atspi/atspi-object.h +++ b/atspi/atspi-object.h @@ -4,7 +4,7 @@ * * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -32,12 +32,12 @@ G_BEGIN_DECLS -#define ATSPI_TYPE_OBJECT (atspi_object_get_type ()) -#define ATSPI_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_OBJECT, AtspiObject)) -#define ATSPI_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_OBJECT, AtspiObjectClass)) -#define ATSPI_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_OBJECT)) -#define ATSPI_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_OBJECT)) -#define ATSPI_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_OBJECT, AtspiObjectClass)) +#define ATSPI_TYPE_OBJECT (atspi_object_get_type ()) +#define ATSPI_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_OBJECT, AtspiObject)) +#define ATSPI_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_OBJECT, AtspiObjectClass)) +#define ATSPI_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_OBJECT)) +#define ATSPI_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_OBJECT)) +#define ATSPI_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_OBJECT, AtspiObjectClass)) typedef struct _AtspiObject AtspiObject; struct _AtspiObject @@ -53,8 +53,8 @@ struct _AtspiObjectClass GObjectClass parent_class; }; -GType atspi_object_get_type (void); +GType atspi_object_get_type (void); G_END_DECLS -#endif /* _ATSPI_OBJECT_H_ */ +#endif /* _ATSPI_OBJECT_H_ */ diff --git a/atspi/atspi-private.h b/atspi/atspi-private.h index 9ddc6006..a38142cd 100644 --- a/atspi/atspi-private.h +++ b/atspi/atspi-private.h @@ -4,7 +4,7 @@ * * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,20 +25,20 @@ #ifndef _ATSPI_PRIVATE_H_ #define _ATSPI_PRIVATE_H_ -#include <config.h> #include "atspi-device-listener-private.h" #include "atspi-event-listener-private.h" #include "atspi-matchrule-private.h" #include "atspi-misc-private.h" #include "atspi-mutter-private.h" +#include <config.h> #include "glib/gi18n.h" -#include "atspi.h" #include "atspi-accessible-private.h" +#include "atspi.h" G_BEGIN_DECLS void _atspi_reregister_device_listeners (); G_END_DECLS -#endif /* _ATSPI_PRIVATE_H_ */ +#endif /* _ATSPI_PRIVATE_H_ */ diff --git a/atspi/atspi-registry.c b/atspi/atspi-registry.c index 1ec36599..19cb7e2e 100644 --- a/atspi/atspi-registry.c +++ b/atspi/atspi-registry.c @@ -41,9 +41,9 @@ typedef struct { AtspiDeviceListener *listener; - GArray *key_set; - AtspiKeyMaskType modmask; - AtspiKeyEventMask event_types; + GArray *key_set; + AtspiKeyMaskType modmask; + AtspiKeyEventMask event_types; gint sync_type; } DeviceListenerEntry; @@ -53,7 +53,7 @@ static GList *device_listeners; * atspi_get_desktop_count: * * Gets the number of virtual desktops. - * NOTE: multiple virtual desktops are not implemented yet; as a + * NOTE: multiple virtual desktops are not implemented yet; as a * consequence, this function always returns 1. * * Returns: a #gint indicating the number of active virtual desktops. @@ -76,10 +76,11 @@ atspi_get_desktop_count () * Returns: (transfer full): a pointer to the @i-th virtual desktop's * #AtspiAccessible representation. **/ -AtspiAccessible* +AtspiAccessible * atspi_get_desktop (gint i) { - if (i != 0) return NULL; + if (i != 0) + return NULL; return _atspi_ref_accessible (atspi_bus_registry, atspi_path_root); } @@ -116,19 +117,19 @@ notify_keystroke_listener (DeviceListenerEntry *e) gchar *path = _atspi_device_listener_get_path (e->listener); dbus_uint32_t d_modmask = e->modmask; dbus_uint32_t d_event_types = e->event_types; - AtspiEventListenerMode listener_mode; - gboolean retval = FALSE; + AtspiEventListenerMode listener_mode; + gboolean retval = FALSE; DBusError d_error; listener_mode.synchronous = - (dbus_bool_t) ((e->sync_type & ATSPI_KEYLISTENER_SYNCHRONOUS)!=0); + (dbus_bool_t) ((e->sync_type & ATSPI_KEYLISTENER_SYNCHRONOUS) != 0); listener_mode.preemptive = - (dbus_bool_t) ((e->sync_type & ATSPI_KEYLISTENER_CANCONSUME)!=0); + (dbus_bool_t) ((e->sync_type & ATSPI_KEYLISTENER_CANCONSUME) != 0); listener_mode.global = - (dbus_bool_t) ((e->sync_type & ATSPI_KEYLISTENER_ALL_WINDOWS)!=0); + (dbus_bool_t) ((e->sync_type & ATSPI_KEYLISTENER_ALL_WINDOWS) != 0); dbus_error_init (&d_error); - dbind_method_call_reentrant (_atspi_bus(), atspi_bus_registry, + dbind_method_call_reentrant (_atspi_bus (), atspi_bus_registry, atspi_path_dec, atspi_interface_dec, "RegisterKeystrokeListener", &d_error, "oa(iisi)uu(bbb)=>b", path, e->key_set, @@ -194,24 +195,24 @@ unregister_listener (gpointer data, GObject *object) * @sync_type: an #AtspiKeyListenerSyncType parameter indicating * the behavior of the notification/listener transaction. * @error: (allow-none): a pointer to a %NULL #GError pointer, or %NULL - * + * * Registers a listener for keystroke events, either pre-emptively for * all windows (%ATSPI_KEYLISTENER_ALL_WINDOWS), * non-preemptively (%ATSPI_KEYLISTENER_NOSYNC), or * pre-emptively at the toolkit level (%ATSPI_KEYLISTENER_CANCONSUME). * If ALL_WINDOWS or CANCONSUME are used, the event is consumed - * upon receipt if one of @listener's callbacks returns %TRUE + * upon receipt if one of @listener's callbacks returns %TRUE * (other sync_type values may be available in the future). * * Returns: %TRUE if successful, otherwise %FALSE. **/ gboolean -atspi_register_keystroke_listener (AtspiDeviceListener *listener, - GArray *key_set, - AtspiKeyMaskType modmask, - AtspiKeyEventMask event_types, - AtspiKeyListenerSyncType sync_type, - GError **error) +atspi_register_keystroke_listener (AtspiDeviceListener *listener, + GArray *key_set, + AtspiKeyMaskType modmask, + AtspiKeyEventMask event_types, + AtspiKeyListenerSyncType sync_type, + GError **error) { DeviceListenerEntry *e; @@ -230,18 +231,18 @@ atspi_register_keystroke_listener (AtspiDeviceListener *listener, e->key_set->len = key_set->len; for (i = 0; i < key_set->len; i++) { - AtspiKeyDefinition *kd = ((AtspiKeyDefinition *) key_set->data) + i; - AtspiKeyDefinition *d_kd = ((AtspiKeyDefinition *) e->key_set->data) + i; + AtspiKeyDefinition *kd = ((AtspiKeyDefinition *) key_set->data) + i; + AtspiKeyDefinition *d_kd = ((AtspiKeyDefinition *) e->key_set->data) + i; d_kd->keycode = kd->keycode; - d_kd->keysym = kd->keysym; - if (kd->keystring) - { - d_kd->keystring = kd->keystring; - } - else + d_kd->keysym = kd->keysym; + if (kd->keystring) + { + d_kd->keystring = kd->keystring; + } + else { - d_kd->keystring = ""; - } + d_kd->keystring = ""; + } } } else @@ -276,10 +277,10 @@ atspi_register_keystroke_listener (AtspiDeviceListener *listener, **/ gboolean atspi_deregister_keystroke_listener (AtspiDeviceListener *listener, - GArray *key_set, - AtspiKeyMaskType modmask, - AtspiKeyEventMask event_types, - GError **error) + GArray *key_set, + AtspiKeyMaskType modmask, + AtspiKeyEventMask event_types, + GError **error) { GArray *d_key_set; gchar *path; @@ -305,18 +306,18 @@ atspi_deregister_keystroke_listener (AtspiDeviceListener *listener, d_key_set->len = key_set->len; for (i = 0; i < key_set->len; ++i) { - AtspiKeyDefinition *kd = ((AtspiKeyDefinition *) key_set->data) + i; - AtspiKeyDefinition *d_kd = ((AtspiKeyDefinition *) d_key_set->data) + i; + AtspiKeyDefinition *kd = ((AtspiKeyDefinition *) key_set->data) + i; + AtspiKeyDefinition *d_kd = ((AtspiKeyDefinition *) d_key_set->data) + i; d_kd->keycode = kd->keycode; - d_kd->keysym = kd->keysym; - if (kd->keystring) - { - d_kd->keystring = kd->keystring; - } - else + d_kd->keysym = kd->keysym; + if (kd->keystring) { - d_kd->keystring = ""; - } + d_kd->keystring = kd->keystring; + } + else + { + d_kd->keystring = ""; + } } } else @@ -324,7 +325,7 @@ atspi_deregister_keystroke_listener (AtspiDeviceListener *listener, d_key_set = g_array_sized_new (FALSE, TRUE, sizeof (AtspiKeyDefinition), 0); } - dbind_method_call_reentrant (_atspi_bus(), atspi_bus_registry, + dbind_method_call_reentrant (_atspi_bus (), atspi_bus_registry, atspi_path_dec, atspi_interface_dec, "DeregisterKeystrokeListener", &d_error, "oa(iisi)uu", path, d_key_set, d_modmask, @@ -339,9 +340,9 @@ atspi_deregister_keystroke_listener (AtspiDeviceListener *listener, for (l = device_listeners; l;) { /* TODO: This code is all wrong / doesn't match what is in - * deviceeventcontroller.c. It would be nice to deprecate these methods - * in favor of methods that return an ID for the registration that can - * be passed to a deregister function, for instance. */ + * deviceeventcontroller.c. It would be nice to deprecate these methods + * in favor of methods that return an ID for the registration that can + * be passed to a deregister function, for instance. */ DeviceListenerEntry *e = l->data; if (e->modmask == modmask && e->event_types == event_types) { @@ -366,9 +367,10 @@ atspi_deregister_keystroke_listener (AtspiDeviceListener *listener, * Returns: Always returns %FALSE. **/ gboolean -atspi_register_device_event_listener (AtspiDeviceListener *listener, - AtspiDeviceEventMask event_types, - void *filter, GError **error) +atspi_register_device_event_listener (AtspiDeviceListener *listener, + AtspiDeviceEventMask event_types, + void *filter, + GError **error) { /* See https://gitlab.gnome.org/GNOME/at-spi2-core/-/issues/94 for why this code is removed */ return FALSE; @@ -388,7 +390,7 @@ atspi_register_device_event_listener (AtspiDeviceListener *listener, **/ gboolean atspi_deregister_device_event_listener (AtspiDeviceListener *listener, - void *filter, + void *filter, GError **error) { /* See https://gitlab.gnome.org/GNOME/at-spi2-core/-/issues/94 for why this code is removed */ @@ -426,23 +428,24 @@ using_mutter () **/ gboolean atspi_generate_keyboard_event (glong keyval, - const gchar *keystring, - AtspiKeySynthType synth_type, GError **error) + const gchar *keystring, + AtspiKeySynthType synth_type, + GError **error) { dbus_uint32_t d_synth_type = synth_type; dbus_int32_t d_keyval = keyval; DBusError d_error; if (using_mutter ()) - { - if (_atspi_mutter_generate_keyboard_event (keyval, keystring, synth_type, error)) - return TRUE; - } + { + if (_atspi_mutter_generate_keyboard_event (keyval, keystring, synth_type, error)) + return TRUE; + } dbus_error_init (&d_error); if (!keystring) keystring = ""; - dbind_method_call_reentrant (_atspi_bus(), atspi_bus_registry, atspi_path_dec, atspi_interface_dec, "GenerateKeyboardEvent", &d_error, "isu", d_keyval, keystring, d_synth_type); + dbind_method_call_reentrant (_atspi_bus (), atspi_bus_registry, atspi_path_dec, atspi_interface_dec, "GenerateKeyboardEvent", &d_error, "isu", d_keyval, keystring, d_synth_type); if (dbus_error_is_set (&d_error)) { g_warning ("GenerateKeyboardEvent failed: %s", d_error.message); @@ -478,13 +481,13 @@ atspi_generate_mouse_event (glong x, glong y, const gchar *name, GError **error) g_return_val_if_fail (name != NULL, FALSE); if (using_mutter ()) - { - if (_atspi_mutter_generate_mouse_event (x, y, name, error)) - return TRUE; - } + { + if (_atspi_mutter_generate_mouse_event (x, y, name, error)) + return TRUE; + } dbus_error_init (&d_error); - dbind_method_call_reentrant (_atspi_bus(), atspi_bus_registry, + dbind_method_call_reentrant (_atspi_bus (), atspi_bus_registry, atspi_path_dec, atspi_interface_dec, "GenerateMouseEvent", &d_error, "iis", d_x, d_y, name); diff --git a/atspi/atspi-registry.h b/atspi/atspi-registry.h index 43150c23..fea54c0c 100644 --- a/atspi/atspi-registry.h +++ b/atspi/atspi-registry.h @@ -4,7 +4,7 @@ * * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,8 +26,8 @@ #define _ATSPI_REGISTRY_H_ #include "atspi-accessible.h" -#include "atspi-types.h" #include "atspi-device-listener.h" +#include "atspi-types.h" G_BEGIN_DECLS @@ -35,38 +35,41 @@ GType atspi_key_definition_get_type (); gint atspi_get_desktop_count (); -AtspiAccessible* atspi_get_desktop (gint i); +AtspiAccessible *atspi_get_desktop (gint i); GArray *atspi_get_desktop_list (); gboolean -atspi_register_keystroke_listener (AtspiDeviceListener *listener, - GArray *key_set, - AtspiKeyMaskType modmask, - AtspiKeyEventMask event_types, - AtspiKeyListenerSyncType sync_type, - GError **error); +atspi_register_keystroke_listener (AtspiDeviceListener *listener, + GArray *key_set, + AtspiKeyMaskType modmask, + AtspiKeyEventMask event_types, + AtspiKeyListenerSyncType sync_type, + GError **error); gboolean atspi_deregister_keystroke_listener (AtspiDeviceListener *listener, - GArray *key_set, - AtspiKeyMaskType modmask, - AtspiKeyEventMask event_types, - GError **error); + GArray *key_set, + AtspiKeyMaskType modmask, + AtspiKeyEventMask event_types, + GError **error); gboolean -atspi_register_device_event_listener (AtspiDeviceListener *listener, - AtspiDeviceEventMask event_types, - void *filter, GError **error); +atspi_register_device_event_listener (AtspiDeviceListener *listener, + AtspiDeviceEventMask event_types, + void *filter, + GError **error); gboolean atspi_deregister_device_event_listener (AtspiDeviceListener *listener, - void *filter, GError **error); + void *filter, + GError **error); gboolean atspi_generate_keyboard_event (glong keyval, - const gchar *keystring, - AtspiKeySynthType synth_type, GError **error); + const gchar *keystring, + AtspiKeySynthType synth_type, + GError **error); gboolean atspi_generate_mouse_event (glong x, glong y, const gchar *name, GError **error); @@ -75,4 +78,4 @@ void atspi_set_reference_window (AtspiAccessible *accessible); G_END_DECLS -#endif /* _ATSPI_REGISTRY_H_ */ +#endif /* _ATSPI_REGISTRY_H_ */ diff --git a/atspi/atspi-relation.c b/atspi/atspi-relation.c index 527826f6..a36e84c1 100644 --- a/atspi/atspi-relation.c +++ b/atspi/atspi-relation.c @@ -108,12 +108,12 @@ _atspi_relation_new_from_iter (DBusMessageIter *iter) relation->targets = g_array_new (TRUE, TRUE, sizeof (AtspiAccessible *)); dbus_message_iter_recurse (&iter_struct, &iter_array); while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID) - { - AtspiAccessible *accessible; - accessible = _atspi_dbus_consume_accessible (&iter_array); - relation->targets = g_array_append_val (relation->targets, accessible); - /* Iter was moved already, so no need to call dbus_message_iter_next */ - } + { + AtspiAccessible *accessible; + accessible = _atspi_dbus_consume_accessible (&iter_array); + relation->targets = g_array_append_val (relation->targets, accessible); + /* Iter was moved already, so no need to call dbus_message_iter_next */ + } return relation; } @@ -131,7 +131,7 @@ atspi_relation_finalize (GObject *object) gint i; for (i = 0; i < relation->targets->len; i++) - g_object_unref (g_array_index (relation->targets, AtspiAccessible *, i)); + g_object_unref (g_array_index (relation->targets, AtspiAccessible *, i)); g_array_free (relation->targets, TRUE); G_OBJECT_CLASS (atspi_relation_parent_class)->finalize (object); diff --git a/atspi/atspi-relation.h b/atspi/atspi-relation.h index 0c32d6a8..0a8da577 100644 --- a/atspi/atspi-relation.h +++ b/atspi/atspi-relation.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -32,10 +32,10 @@ G_BEGIN_DECLS -#define ATSPI_TYPE_RELATION (atspi_relation_get_type ()) -#define ATSPI_IS_RELATION(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_RELATION) -#define ATSPI_RELATION(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_RELATION, AtspiRelation) -#define ATSPI_RELATION_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_RELATION, AtspiRelation)) +#define ATSPI_TYPE_RELATION (atspi_relation_get_type ()) +#define ATSPI_IS_RELATION(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_RELATION) +#define ATSPI_RELATION(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_RELATION, AtspiRelation) +#define ATSPI_RELATION_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_RELATION, AtspiRelation)) GType atspi_relation_get_type (); @@ -57,11 +57,11 @@ AtspiRelationType atspi_relation_get_relation_type (AtspiRelation *obj); gint atspi_relation_get_n_targets (AtspiRelation *obj); -AtspiAccessible * atspi_relation_get_target (AtspiRelation *obj, gint i); +AtspiAccessible *atspi_relation_get_target (AtspiRelation *obj, gint i); /* private */ -AtspiRelation * _atspi_relation_new_from_iter (DBusMessageIter *iter); +AtspiRelation *_atspi_relation_new_from_iter (DBusMessageIter *iter); G_END_DECLS -#endif /* _ATSPI_RELATION_H_ */ +#endif /* _ATSPI_RELATION_H_ */ diff --git a/atspi/atspi-selection.c b/atspi/atspi-selection.c index ead851b5..0c747835 100644 --- a/atspi/atspi-selection.c +++ b/atspi/atspi-selection.c @@ -67,7 +67,7 @@ atspi_selection_get_n_selected_children (AtspiSelection *obj, GError **error) * children is specified. * * Gets the i-th selected #AtspiAccessible child of an #AtspiSelection. - * Note that @selected_child_index refers to the index in the list + * Note that @selected_child_index refers to the index in the list * of 'selected' * children and generally differs from that used in * #atspi_accessible_get_child_at_index or returned by @@ -81,13 +81,14 @@ atspi_selection_get_n_selected_children (AtspiSelection *obj, GError **error) **/ AtspiAccessible * atspi_selection_get_selected_child (AtspiSelection *obj, - gint selected_child_index, GError **error) + gint selected_child_index, + GError **error) { dbus_int32_t d_selected_child_index = selected_child_index; DBusMessage *reply; g_return_val_if_fail (obj != NULL, NULL); - + reply = _atspi_dbus_call_partial (obj, atspi_interface_selection, "GetSelectedChild", error, "i", d_selected_child_index); @@ -161,15 +162,15 @@ atspi_selection_deselect_selected_child (AtspiSelection *obj, * Deselects a specific child of an #AtspiSelection. * Note that @child_index is the index of the child * in the parent container. - * + * * See #atspi_selection_deselect_selected_child - * + * * Returns: #TRUE if the child was successfully deselected, #FALSE otherwise. **/ gboolean atspi_selection_deselect_child (AtspiSelection *obj, - gint child_index, - GError **error) + gint child_index, + GError **error) { dbus_int32_t d_child_index = child_index; dbus_bool_t retval = FALSE; @@ -222,7 +223,7 @@ gboolean atspi_selection_select_all (AtspiSelection *obj, GError **error) { dbus_bool_t retval = FALSE; - + g_return_val_if_fail (obj != NULL, FALSE); _atspi_dbus_call (obj, atspi_interface_selection, "SelectAll", error, "=>b", &retval); @@ -244,7 +245,7 @@ gboolean atspi_selection_clear_selection (AtspiSelection *obj, GError **error) { dbus_bool_t retval = FALSE; - + g_return_val_if_fail (obj != NULL, FALSE); _atspi_dbus_call (obj, atspi_interface_selection, "ClearSelection", error, "=>b", &retval); @@ -262,16 +263,15 @@ atspi_selection_get_type (void) { static GType type = 0; - if (!type) { - static const GTypeInfo tinfo = + if (!type) { - sizeof (AtspiSelection), - (GBaseInitFunc) atspi_selection_base_init, - (GBaseFinalizeFunc) NULL, - }; - - type = g_type_register_static (G_TYPE_INTERFACE, "AtspiSelection", &tinfo, 0); - - } + static const GTypeInfo tinfo = { + sizeof (AtspiSelection), + (GBaseInitFunc) atspi_selection_base_init, + (GBaseFinalizeFunc) NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiSelection", &tinfo, 0); + } return type; } diff --git a/atspi/atspi-selection.h b/atspi/atspi-selection.h index dda225a7..651ca61c 100644 --- a/atspi/atspi-selection.h +++ b/atspi/atspi-selection.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -34,10 +34,10 @@ G_BEGIN_DECLS -#define ATSPI_TYPE_SELECTION (atspi_selection_get_type ()) -#define ATSPI_IS_SELECTION(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_SELECTION) -#define ATSPI_SELECTION(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_SELECTION, AtspiSelection) -#define ATSPI_SELECTION_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_SELECTION, AtspiSelection)) +#define ATSPI_TYPE_SELECTION (atspi_selection_get_type ()) +#define ATSPI_IS_SELECTION(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_SELECTION) +#define ATSPI_SELECTION(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_SELECTION, AtspiSelection) +#define ATSPI_SELECTION_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_SELECTION, AtspiSelection)) GType atspi_selection_get_type (); @@ -48,7 +48,7 @@ struct _AtspiSelection gint atspi_selection_get_n_selected_children (AtspiSelection *obj, GError **error); -AtspiAccessible * atspi_selection_get_selected_child (AtspiSelection *obj, gint selected_child_index, GError **error); +AtspiAccessible *atspi_selection_get_selected_child (AtspiSelection *obj, gint selected_child_index, GError **error); gboolean atspi_selection_select_child (AtspiSelection *obj, gint child_index, GError **error); @@ -58,7 +58,8 @@ gboolean atspi_selection_deselect_child (AtspiSelection *obj, gint child_index, gboolean atspi_selection_is_child_selected (AtspiSelection *obj, - gint child_index, GError **error); + gint child_index, + GError **error); gboolean atspi_selection_select_all (AtspiSelection *obj, GError **error); @@ -66,4 +67,4 @@ gboolean atspi_selection_clear_selection (AtspiSelection *obj, GError **error); G_END_DECLS -#endif /* _ATSPI_SELECTION_H_ */ +#endif /* _ATSPI_SELECTION_H_ */ diff --git a/atspi/atspi-stateset.c b/atspi/atspi-stateset.c index 2d5ca644..be71aae7 100644 --- a/atspi/atspi-stateset.c +++ b/atspi/atspi-stateset.c @@ -42,7 +42,7 @@ atspi_state_set_init (AtspiStateSet *set) } static void -atspi_state_set_class_init (AtspiStateSetClass* klass) +atspi_state_set_class_init (AtspiStateSetClass *klass) { } @@ -73,7 +73,7 @@ AtspiStateSet * _atspi_state_set_new_internal (AtspiAccessible *accessible, gint64 states) { AtspiStateSet *set; - + set = g_object_new (ATSPI_TYPE_STATE_SET, NULL); g_return_val_if_fail (set != NULL, NULL); @@ -106,14 +106,13 @@ atspi_state_set_set_by_name (AtspiStateSet *set, const gchar *name, gboolean ena value = g_enum_get_value_by_nick (G_ENUM_CLASS (type_class), name); if (!value) - { - g_warning ("AT-SPI: Attempt to set unknown state '%s'", name); - } + { + g_warning ("AT-SPI: Attempt to set unknown state '%s'", name); + } + else if (enabled) + set->states |= ((gint64) 1 << value->value); else - if (enabled) - set->states |= ((gint64)1 << value->value); - else - set->states &= ~((gint64)1 << value->value); + set->states &= ~((gint64) 1 << value->value); g_type_class_unref (type_class); } @@ -133,8 +132,8 @@ refresh_states (AtspiStateSet *set) states = (dbus_uint32_t *) state_array->data; - set->states = ((gint64)states [1]) << 32; - set->states |= (gint64) states [0]; + set->states = ((gint64) states[1]) << 32; + set->states |= (gint64) states[0]; g_array_free (state_array, TRUE); } @@ -151,7 +150,7 @@ void atspi_state_set_add (AtspiStateSet *set, AtspiStateType state) { g_return_if_fail (set != NULL); - set->states |= (((gint64)1) << state); + set->states |= (((gint64) 1) << state); } /** @@ -192,12 +191,12 @@ atspi_state_set_compare (AtspiStateSet *set, **/ gboolean atspi_state_set_contains (AtspiStateSet *set, - AtspiStateType state) + AtspiStateType state) { if (!set) return FALSE; refresh_states (set); - return (set->states & ((gint64)1 << state)) ? TRUE : FALSE; + return (set->states & ((gint64) 1 << state)) ? TRUE : FALSE; } /** @@ -217,7 +216,7 @@ atspi_state_set_contains (AtspiStateSet *set, **/ gboolean atspi_state_set_equals (AtspiStateSet *set, - AtspiStateSet *set2) + AtspiStateSet *set2) { if (set == set2) return TRUE; @@ -248,11 +247,11 @@ atspi_state_set_get_states (AtspiStateSet *set) if (!ret) return NULL; for (i = 0; i < 64; i++) - { - if (set->states & val) - ret = g_array_append_val (ret, i); - val <<= 1; - } + { + if (set->states & val) + ret = g_array_append_val (ret, i); + val <<= 1; + } return ret; } @@ -281,5 +280,5 @@ void atspi_state_set_remove (AtspiStateSet *set, AtspiStateType state) { g_return_if_fail (set != NULL); - set->states &= ~((gint64)1 << state); + set->states &= ~((gint64) 1 << state); } diff --git a/atspi/atspi-stateset.h b/atspi/atspi-stateset.h index e9e261ed..f00296ce 100644 --- a/atspi/atspi-stateset.h +++ b/atspi/atspi-stateset.h @@ -25,12 +25,12 @@ #ifndef _ATSPI_STATE_SET_H_ #define _ATSPI_STATE_SET_H_ -#define ATSPI_TYPE_STATE_SET (atspi_state_set_get_type ()) -#define ATSPI_STATE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_STATE_SET, AtspiStateSet)) -#define ATSPI_STATE_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_STATE_SET, AtspiStateSetClass)) -#define ATSPI_IS_STATE_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_STATE_SET)) -#define ATSPI_IS_STATE_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_STATE_SET)) -#define ATSPI_STATE_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_STATE_SET, AtspiStateSetClass)) +#define ATSPI_TYPE_STATE_SET (atspi_state_set_get_type ()) +#define ATSPI_STATE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_STATE_SET, AtspiStateSet)) +#define ATSPI_STATE_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_STATE_SET, AtspiStateSetClass)) +#define ATSPI_IS_STATE_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_STATE_SET)) +#define ATSPI_IS_STATE_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_STATE_SET)) +#define ATSPI_STATE_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_STATE_SET, AtspiStateSetClass)) G_BEGIN_DECLS @@ -50,26 +50,26 @@ struct _AtspiStateSetClass GType atspi_state_set_get_type (void); -AtspiStateSet * atspi_state_set_new (GArray *states); +AtspiStateSet *atspi_state_set_new (GArray *states); void atspi_state_set_set_by_name (AtspiStateSet *set, const gchar *name, gboolean enabled); void atspi_state_set_add (AtspiStateSet *set, AtspiStateType state); -AtspiStateSet * atspi_state_set_compare (AtspiStateSet *set, AtspiStateSet *set2); +AtspiStateSet *atspi_state_set_compare (AtspiStateSet *set, AtspiStateSet *set2); gboolean atspi_state_set_contains (AtspiStateSet *set, AtspiStateType state); gboolean atspi_state_set_equals (AtspiStateSet *set, AtspiStateSet *set2); -GArray * atspi_state_set_get_states (AtspiStateSet *set); +GArray *atspi_state_set_get_states (AtspiStateSet *set); gboolean atspi_state_set_is_empty (AtspiStateSet *set); void atspi_state_set_remove (AtspiStateSet *set, AtspiStateType state); -AtspiStateSet * _atspi_state_set_new_internal (struct _AtspiAccessible *accessible, gint64 states); +AtspiStateSet *_atspi_state_set_new_internal (struct _AtspiAccessible *accessible, gint64 states); G_END_DECLS -#endif /* _ATSPI_STATE_SET_H_ */ +#endif /* _ATSPI_STATE_SET_H_ */ diff --git a/atspi/atspi-table-cell.c b/atspi/atspi-table-cell.c index a33e0a89..4884f161 100644 --- a/atspi/atspi-table-cell.c +++ b/atspi/atspi-table-cell.c @@ -22,8 +22,8 @@ * Boston, MA 02110-1301, USA. */ -#include <stdlib.h> /* for malloc */ #include "atspi-private.h" +#include <stdlib.h> /* for malloc */ static GPtrArray * get_object_array_and_unref (DBusMessage *reply) @@ -35,20 +35,20 @@ get_object_array_and_unref (DBusMessage *reply) return NULL; if (strcmp (dbus_message_get_signature (reply), "a(so)") != 0) - { - dbus_message_unref (reply); - return NULL; - } + { + dbus_message_unref (reply); + return NULL; + } array = g_ptr_array_new (); dbus_message_iter_init (reply, &iter); dbus_message_iter_recurse (&iter, &iter_array); while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID) - { - AtspiAccessible *accessible = _atspi_dbus_consume_accessible (&iter_array); - g_ptr_array_add (array, accessible); - } + { + AtspiAccessible *accessible = _atspi_dbus_consume_accessible (&iter_array); + g_ptr_array_add (array, accessible); + } dbus_message_unref (reply); return array; } @@ -73,7 +73,7 @@ atspi_table_cell_get_column_span (AtspiTableCell *obj, GError **error) _atspi_dbus_get_property (obj, atspi_interface_table_cell, "ColumnSpan", error, "i", &retval); - + return retval; } @@ -85,7 +85,7 @@ atspi_table_cell_get_column_span (AtspiTableCell *obj, GError **error) * * Returns: (element-type AtspiAccessible) (transfer full): a GPtrArray of * AtspiAccessibles representing the column header cells. - */ + */ GPtrArray * atspi_table_cell_get_column_header_cells (AtspiTableCell *obj, GError **error) { @@ -94,7 +94,7 @@ atspi_table_cell_get_column_header_cells (AtspiTableCell *obj, GError **error) g_return_val_if_fail (obj != NULL, NULL); reply = _atspi_dbus_call_partial (obj, atspi_interface_table_cell, "GetColumnHeaderCells", error, ""); - + return get_object_array_and_unref (reply); } @@ -118,7 +118,7 @@ atspi_table_cell_get_row_span (AtspiTableCell *obj, GError **error) _atspi_dbus_get_property (obj, atspi_interface_table_cell, "RowSpan", error, "i", &retval); - + return retval; } @@ -139,7 +139,7 @@ atspi_table_cell_get_row_header_cells (AtspiTableCell *obj, GError **error) g_return_val_if_fail (obj != NULL, NULL); reply = _atspi_dbus_call_partial (obj, atspi_interface_table_cell, "GetRowHeaderCells", error, ""); - + return get_object_array_and_unref (reply); } @@ -169,7 +169,7 @@ atspi_table_cell_get_position (AtspiTableCell *obj, reply = _atspi_dbus_call_partial (obj, "org.freedesktop.DBus.Properties", "Get", error, "ss", atspi_interface_table_cell, "Position"); - + if (!reply) return -1; @@ -183,10 +183,10 @@ atspi_table_cell_get_position (AtspiTableCell *obj, iter_sig = dbus_message_iter_get_signature (&iter_variant); /* TODO: Also report error here */ if (strcmp (iter_sig, "(ii)") != 0) - { - dbus_free (iter_sig); - return FALSE; - } + { + dbus_free (iter_sig); + return FALSE; + } dbus_free (iter_sig); dbus_message_iter_recurse (&iter_variant, &iter_struct); @@ -215,13 +215,13 @@ atspi_table_cell_get_position (AtspiTableCell *obj, */ void atspi_table_cell_get_row_column_span (AtspiTableCell *obj, - gint *row, - gint *column, - gint *row_span, - gint *column_span, - GError **error) + gint *row, + gint *column, + gint *row_span, + gint *column_span, + GError **error) { - dbus_int32_t d_row = 0, d_column = 0, d_row_span = 0, d_column_span = 0; + dbus_int32_t d_row = 0, d_column = 0, d_row_span = 0, d_column_span = 0; if (row) *row = -1; @@ -265,7 +265,7 @@ atspi_table_cell_get_table (AtspiTableCell *obj, GError **error) _atspi_dbus_get_property (obj, atspi_interface_table_cell, "Table", error, "(so)", &retval); - + return retval; } @@ -279,16 +279,15 @@ atspi_table_cell_get_type (void) { static GType type = 0; - if (!type) { - static const GTypeInfo tinfo = + if (!type) { - sizeof (AtspiTableCell), - (GBaseInitFunc) atspi_table_cell_base_init, - (GBaseFinalizeFunc) NULL, - }; - - type = g_type_register_static (G_TYPE_INTERFACE, "AtspiTableCell", &tinfo, 0); - - } + static const GTypeInfo tinfo = { + sizeof (AtspiTableCell), + (GBaseInitFunc) atspi_table_cell_base_init, + (GBaseFinalizeFunc) NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiTableCell", &tinfo, 0); + } return type; } diff --git a/atspi/atspi-table-cell.h b/atspi/atspi-table-cell.h index b16cd4b1..f12f3532 100644 --- a/atspi/atspi-table-cell.h +++ b/atspi/atspi-table-cell.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -34,10 +34,10 @@ G_BEGIN_DECLS -#define ATSPI_TYPE_TABLE_CELL (atspi_table_cell_get_type ()) -#define ATSPI_IS_TABLE_CELL(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_TABLE_CELL) -#define ATSPI_TABLE_CELL(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_TABLE_CELL, AtspiTableCell) -#define ATSPI_TABLE_CELL_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_TABLE_CELL, AtspiTableCell)) +#define ATSPI_TYPE_TABLE_CELL (atspi_table_cell_get_type ()) +#define ATSPI_IS_TABLE_CELL(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_TABLE_CELL) +#define ATSPI_TABLE_CELL(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_TABLE_CELL, AtspiTableCell) +#define ATSPI_TABLE_CELL_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_TABLE_CELL, AtspiTableCell)) GType atspi_table_cell_get_type (); @@ -59,19 +59,19 @@ GPtrArray *atspi_table_cell_get_row_header_cells (AtspiTableCell *obj, GError **error); gint atspi_table_cell_get_position (AtspiTableCell *obj, - gint *row, - gint *column, - GError **error); + gint *row, + gint *column, + GError **error); void atspi_table_cell_get_row_column_span (AtspiTableCell *obj, - gint *row, - gint *column, - gint *row_span, - gint *column_span, - GError **error); + gint *row, + gint *column, + gint *row_span, + gint *column_span, + GError **error); AtspiAccessible *atspi_table_cell_get_table (AtspiTableCell *obj, GError **error); G_END_DECLS -#endif /* _ATSPI_TABLE_CELL_H_ */ +#endif /* _ATSPI_TABLE_CELL_H_ */ diff --git a/atspi/atspi-table.c b/atspi/atspi-table.c index b2027e1e..6d9140b6 100644 --- a/atspi/atspi-table.c +++ b/atspi/atspi-table.c @@ -22,8 +22,8 @@ * Boston, MA 02110-1301, USA. */ -#include <stdlib.h> /* for malloc */ #include "atspi-private.h" +#include <stdlib.h> /* for malloc */ /** * AtspiTable: @@ -80,7 +80,7 @@ atspi_table_get_summary (AtspiTable *obj, GError **error) _atspi_dbus_get_property (obj, atspi_interface_table, "Summary", error, "(so)", &retval); - return retval; + return retval; } /** @@ -101,7 +101,7 @@ atspi_table_get_n_rows (AtspiTable *obj, GError **error) g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_get_property (obj, atspi_interface_table, "NRows", error, "i", &retval); - + return retval; } @@ -123,7 +123,7 @@ atspi_table_get_n_columns (AtspiTable *obj, GError **error) g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_get_property (obj, atspi_interface_table, "NColumns", error, "i", &retval); - + return retval; } @@ -134,7 +134,7 @@ atspi_table_get_n_columns (AtspiTable *obj, GError **error) * @column: the specified table column, zero-indexed. * * Gets the table cell at the specified row and column indices. - * To get the accessible object at a particular (x, y) screen + * To get the accessible object at a particular (x, y) screen * coordinate, use #atspi_component_get_accessible_at_point. * * Returns: (transfer full): an #AtspiAccessible object representing the @@ -142,9 +142,9 @@ atspi_table_get_n_columns (AtspiTable *obj, GError **error) **/ AtspiAccessible * atspi_table_get_accessible_at (AtspiTable *obj, - gint row, - gint column, - GError **error) + gint row, + gint column, + GError **error) { dbus_int32_t d_row = row, d_column = column; DBusMessage *reply; @@ -163,7 +163,7 @@ atspi_table_get_accessible_at (AtspiTable *obj, * @column: the specified table column, zero-indexed. * * Gets the 1-D child index corresponding to the specified 2-D row and - * column indices. To get the accessible object at a particular (x, y) screen + * column indices. To get the accessible object at a particular (x, y) screen * coordinate, use #atspi_component_get_accessible_at_point. * * @see #atspi_table_get_row_at_index, #atspi_table_get_column_at_index @@ -173,9 +173,9 @@ atspi_table_get_accessible_at (AtspiTable *obj, **/ gint atspi_table_get_index_at (AtspiTable *obj, - gint row, - gint column, - GError **error) + gint row, + gint column, + GError **error) { dbus_int32_t d_row = row, d_column = column; dbus_int32_t retval = -1; @@ -183,7 +183,7 @@ atspi_table_get_index_at (AtspiTable *obj, g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_call (obj, atspi_interface_table, "GetIndexAt", error, "ii=>i", d_row, d_column, &retval); - + return retval; } @@ -192,7 +192,7 @@ atspi_table_get_index_at (AtspiTable *obj, * @obj: a pointer to the #AtspiTable implementor on which to operate. * @index: the specified child index, zero-indexed. * - * Gets the table row index occupied by the child at a particular 1-D + * Gets the table row index occupied by the child at a particular 1-D * child index. * * @see #atspi_table_get_index_at, #atspi_table_get_column_at_index @@ -202,8 +202,8 @@ atspi_table_get_index_at (AtspiTable *obj, **/ gint atspi_table_get_row_at_index (AtspiTable *obj, - gint index, - GError **error) + gint index, + GError **error) { dbus_int32_t d_index = index; dbus_int32_t retval = -1; @@ -211,7 +211,7 @@ atspi_table_get_row_at_index (AtspiTable *obj, g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_call (obj, atspi_interface_table, "GetRowAtIndex", error, "i=>i", d_index, &retval); - + return retval; } @@ -230,8 +230,8 @@ atspi_table_get_row_at_index (AtspiTable *obj, **/ gint atspi_table_get_column_at_index (AtspiTable *obj, - gint index, - GError **error) + gint index, + GError **error) { dbus_int32_t d_index = index; dbus_int32_t retval = -1; @@ -239,7 +239,7 @@ atspi_table_get_column_at_index (AtspiTable *obj, g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_call (obj, atspi_interface_table, "GetColumnAtIndex", error, "i=>i", d_index, &retval); - + return retval; } @@ -255,8 +255,8 @@ atspi_table_get_column_at_index (AtspiTable *obj, **/ gchar * atspi_table_get_row_description (AtspiTable *obj, - gint row, - GError **error) + gint row, + GError **error) { dbus_int32_t d_row = row; char *retval = NULL; @@ -264,7 +264,7 @@ atspi_table_get_row_description (AtspiTable *obj, g_return_val_if_fail (obj != NULL, NULL); _atspi_dbus_call (obj, atspi_interface_table, "GetRowDescription", error, "i=>s", d_row, &retval); - + return retval; } @@ -280,7 +280,8 @@ atspi_table_get_row_description (AtspiTable *obj, **/ gchar * atspi_table_get_column_description (AtspiTable *obj, - gint column, GError **error) + gint column, + GError **error) { dbus_int32_t d_column = column; char *retval = NULL; @@ -308,9 +309,9 @@ atspi_table_get_column_description (AtspiTable *obj, **/ gint atspi_table_get_row_extent_at (AtspiTable *obj, - gint row, - gint column, - GError **error) + gint row, + gint column, + GError **error) { dbus_int32_t d_row = row, d_column = column; dbus_int32_t retval = -1; @@ -318,7 +319,7 @@ atspi_table_get_row_extent_at (AtspiTable *obj, g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_call (obj, atspi_interface_table, "GetRowExtentAt", error, "ii=>i", d_row, d_column, &retval); - + return retval; } @@ -338,9 +339,9 @@ atspi_table_get_row_extent_at (AtspiTable *obj, **/ gint atspi_table_get_column_extent_at (AtspiTable *obj, - gint row, - gint column, - GError **error) + gint row, + gint column, + GError **error) { dbus_int32_t d_row = row, d_column = column; dbus_int32_t retval = -1; @@ -348,7 +349,7 @@ atspi_table_get_column_extent_at (AtspiTable *obj, g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_call (obj, atspi_interface_table, "GetColumnExtentAt", error, "ii=>i", d_row, d_column, &retval); - + return retval; } @@ -365,8 +366,8 @@ atspi_table_get_column_extent_at (AtspiTable *obj, **/ AtspiAccessible * atspi_table_get_row_header (AtspiTable *obj, - gint row, - GError **error) + gint row, + GError **error) { dbus_int32_t d_row = row; DBusMessage *reply; @@ -392,8 +393,8 @@ atspi_table_get_row_header (AtspiTable *obj, **/ AtspiAccessible * atspi_table_get_column_header (AtspiTable *obj, - gint column, - GError **error) + gint column, + GError **error) { dbus_int32_t d_column = column; DBusMessage *reply; @@ -409,7 +410,7 @@ atspi_table_get_column_header (AtspiTable *obj, * atspi_table_get_n_selected_rows: * @obj: a pointer to the #AtspiTable implementor on which to operate. * - * Query a table to find out how many rows are currently selected. + * Query a table to find out how many rows are currently selected. * Not all tables support row selection. * * Returns: a #gint indicating the number of rows currently selected. @@ -422,7 +423,7 @@ atspi_table_get_n_selected_rows (AtspiTable *obj, GError **error) g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_get_property (obj, atspi_interface_table, "NSelectedRows", error, "i", &retval); - + return retval; } @@ -437,7 +438,7 @@ atspi_table_get_n_selected_rows (AtspiTable *obj, GError **error) **/ GArray * atspi_table_get_selected_rows (AtspiTable *obj, - GError **error) + GError **error) { GArray *rows = NULL; @@ -460,7 +461,7 @@ atspi_table_get_selected_rows (AtspiTable *obj, **/ GArray * atspi_table_get_selected_columns (AtspiTable *obj, - GError **error) + GError **error) { GArray *columns = NULL; @@ -475,7 +476,7 @@ atspi_table_get_selected_columns (AtspiTable *obj, * atspi_table_get_n_selected_columns: * @obj: a pointer to the #AtspiTable implementor on which to operate. * - * Queries a table to find out how many columns are currently selected. + * Queries a table to find out how many columns are currently selected. * Not all tables support column selection. * * Returns: a #gint indicating the number of columns currently selected. @@ -488,7 +489,7 @@ atspi_table_get_n_selected_columns (AtspiTable *obj, GError **error) g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_get_property (obj, atspi_interface_table, "NSelectedColumns", error, "i", &retval); - + return retval; } @@ -497,15 +498,15 @@ atspi_table_get_n_selected_columns (AtspiTable *obj, GError **error) * @obj: a pointer to the #AtspiTable implementor on which to operate. * @row: the zero-indexed row number of the row being queried. * - * Determines whether a table row is selected. Not all tables support + * Determines whether a table row is selected. Not all tables support * row selection. * * Returns: #TRUE if the specified row is currently selected, #FALSE if not. **/ gboolean atspi_table_is_row_selected (AtspiTable *obj, - gint row, - GError **error) + gint row, + GError **error) { dbus_int32_t d_row = row; dbus_bool_t retval = FALSE; @@ -529,8 +530,8 @@ atspi_table_is_row_selected (AtspiTable *obj, **/ gboolean atspi_table_is_column_selected (AtspiTable *obj, - gint column, - GError **error) + gint column, + GError **error) { dbus_int32_t d_column = column; dbus_bool_t retval = FALSE; @@ -538,7 +539,7 @@ atspi_table_is_column_selected (AtspiTable *obj, g_return_val_if_fail (obj != NULL, FALSE); _atspi_dbus_call (obj, atspi_interface_table, "IsColumnSelected", error, "i=>b", d_column, &retval); - + return retval; } @@ -554,8 +555,8 @@ atspi_table_is_column_selected (AtspiTable *obj, **/ gboolean atspi_table_add_row_selection (AtspiTable *obj, - gint row, - GError **error) + gint row, + GError **error) { dbus_int32_t d_row = row; dbus_bool_t retval = FALSE; @@ -563,7 +564,7 @@ atspi_table_add_row_selection (AtspiTable *obj, g_return_val_if_fail (obj != NULL, FALSE); _atspi_dbus_call (obj, atspi_interface_table, "AddRowSelection", error, "i=>b", d_row, &retval); - + return retval; } @@ -579,8 +580,8 @@ atspi_table_add_row_selection (AtspiTable *obj, **/ gboolean atspi_table_add_column_selection (AtspiTable *obj, - gint column, - GError **error) + gint column, + GError **error) { dbus_int32_t d_column = column; dbus_bool_t retval = FALSE; @@ -588,7 +589,7 @@ atspi_table_add_column_selection (AtspiTable *obj, g_return_val_if_fail (obj != NULL, FALSE); _atspi_dbus_call (obj, atspi_interface_table, "AddColumnSelection", error, "i=>b", d_column, &retval); - + return retval; } @@ -605,8 +606,8 @@ atspi_table_add_column_selection (AtspiTable *obj, **/ gboolean atspi_table_remove_row_selection (AtspiTable *obj, - gint row, - GError **error) + gint row, + GError **error) { dbus_int32_t d_row = row; dbus_bool_t retval = FALSE; @@ -614,7 +615,7 @@ atspi_table_remove_row_selection (AtspiTable *obj, g_return_val_if_fail (obj != NULL, FALSE); _atspi_dbus_call (obj, atspi_interface_table, "RemoveRowSelection", error, "i=>b", d_row, &retval); - + return retval; } @@ -632,8 +633,8 @@ atspi_table_remove_row_selection (AtspiTable *obj, **/ gboolean atspi_table_remove_column_selection (AtspiTable *obj, - gint column, - GError **error) + gint column, + GError **error) { dbus_int32_t d_column = column; dbus_bool_t retval = FALSE; @@ -641,20 +642,20 @@ atspi_table_remove_column_selection (AtspiTable *obj, g_return_val_if_fail (obj != NULL, FALSE); _atspi_dbus_call (obj, atspi_interface_table, "RemoveColumnSelection", error, "i=>b", d_column, &retval); - + return retval; } /** * atspi_table_get_row_column_extents_at_index: * @obj: a pointer to the #AtspiTable implementor on which to operate. - * @index: the index of the #AtspiTable child whose row/column + * @index: the index of the #AtspiTable child whose row/column * extents are requested. * @row: (out): back-filled with the first table row associated with * the cell with child index. - * @col: (out): back-filled with the first table column associated + * @col: (out): back-filled with the first table column associated * with the cell with child index. - * @row_extents: (out): back-filled with the number of table rows + * @row_extents: (out): back-filled with the number of table rows * across which child i extends. * @col_extents: (out): back-filled with the number of table columns * across which child i extends. @@ -662,9 +663,9 @@ atspi_table_remove_column_selection (AtspiTable *obj, * if the child at index i corresponds to a selected table cell, * #FALSE otherwise. * - * Given a child index, determines the row and column indices and + * Given a child index, determines the row and column indices and * extents, and whether the cell is currently selected. If - * the child at index is not a cell (for instance, if it is + * the child at index is not a cell (for instance, if it is * a summary, caption, etc.), #FALSE is returned. * The returned values are meaningful only if the Table has both * STATE_VISIBLE and STATE_SHOWING. @@ -672,32 +673,36 @@ atspi_table_remove_column_selection (AtspiTable *obj, * Example: * If the #AtspiTable child at index '6' extends across columns 5 and 6 of * row 2 of an #AtspiTable instance, and is currently selected, then - * + * * retval = atspi_table_get_row_column_extents_at_index (table, 6, - * row, col, + * row, col, * row_extents, * col_extents, * is_selected); - * + * * will return #TRUE, and after the call * row, col, row_extents, col_extents, - * and is_selected will contain 2, 5, 1, 2, and + * and is_selected will contain 2, 5, 1, 2, and * #TRUE, respectively. * * Returns: #TRUE if the index is associated with a valid table - * cell, #FALSE if the index does not correspond to a cell. If - * #FALSE is returned, the values of the out parameters are + * cell, #FALSE if the index does not correspond to a cell. If + * #FALSE is returned, the values of the out parameters are * undefined. **/ gboolean atspi_table_get_row_column_extents_at_index (AtspiTable *obj, - gint index, gint *row, gint *col, - gint *row_extents, gint *col_extents, - gboolean *is_selected, GError **error) + gint index, + gint *row, + gint *col, + gint *row_extents, + gint *col_extents, + gboolean *is_selected, + GError **error) { dbus_int32_t d_index = index; dbus_bool_t retval = FALSE; - dbus_int32_t d_row = 0, d_col = 0, d_row_extents = 0, d_col_extents = 0; + dbus_int32_t d_row = 0, d_col = 0, d_row_extents = 0, d_col_extents = 0; dbus_bool_t d_is_selected = FALSE; g_return_val_if_fail (obj != NULL, FALSE); @@ -708,14 +713,15 @@ atspi_table_get_row_column_extents_at_index (AtspiTable *obj, *row = d_row; *col = d_col; - *row_extents = d_row_extents;; + *row_extents = d_row_extents; + ; *col_extents = d_col_extents; - *is_selected = d_is_selected;; - + *is_selected = d_is_selected; + ; + return retval; } - /** * atspi_table_is_selected: * @obj: a pointer to the #AtspiTable implementor on which to operate. @@ -728,9 +734,9 @@ atspi_table_get_row_column_extents_at_index (AtspiTable *obj, **/ gboolean atspi_table_is_selected (AtspiTable *obj, - gint row, - gint column, - GError **error) + gint row, + gint column, + GError **error) { dbus_int32_t d_row = row, d_column = column; dbus_bool_t retval = FALSE; @@ -738,7 +744,7 @@ atspi_table_is_selected (AtspiTable *obj, g_return_val_if_fail (obj != NULL, FALSE); _atspi_dbus_call (obj, atspi_interface_table, "IsSelected", error, "ii=>b", d_row, d_column, &retval); - + return retval; } @@ -752,16 +758,15 @@ atspi_table_get_type (void) { static GType type = 0; - if (!type) { - static const GTypeInfo tinfo = + if (!type) { - sizeof (AtspiTable), - (GBaseInitFunc) atspi_table_base_init, - (GBaseFinalizeFunc) NULL, - }; - - type = g_type_register_static (G_TYPE_INTERFACE, "AtspiTable", &tinfo, 0); - - } + static const GTypeInfo tinfo = { + sizeof (AtspiTable), + (GBaseInitFunc) atspi_table_base_init, + (GBaseFinalizeFunc) NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiTable", &tinfo, 0); + } return type; } diff --git a/atspi/atspi-table.h b/atspi/atspi-table.h index 942f2f6f..bbe5e83b 100644 --- a/atspi/atspi-table.h +++ b/atspi/atspi-table.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -34,10 +34,10 @@ G_BEGIN_DECLS -#define ATSPI_TYPE_TABLE (atspi_table_get_type ()) -#define ATSPI_IS_TABLE(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_TABLE) -#define ATSPI_TABLE(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_TABLE, AtspiTable) -#define ATSPI_TABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_TABLE, AtspiTable)) +#define ATSPI_TYPE_TABLE (atspi_table_get_type ()) +#define ATSPI_IS_TABLE(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_TABLE) +#define ATSPI_TABLE(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_TABLE, AtspiTable) +#define ATSPI_TABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_TABLE, AtspiTable)) GType atspi_table_get_type (); @@ -46,15 +46,15 @@ struct _AtspiTable GTypeInterface parent; }; -AtspiAccessible * atspi_table_get_caption (AtspiTable *obj, GError **error); +AtspiAccessible *atspi_table_get_caption (AtspiTable *obj, GError **error); -AtspiAccessible * atspi_table_get_summary (AtspiTable *obj, GError **error); +AtspiAccessible *atspi_table_get_summary (AtspiTable *obj, GError **error); gint atspi_table_get_n_rows (AtspiTable *obj, GError **error); gint atspi_table_get_n_columns (AtspiTable *obj, GError **error); -AtspiAccessible * atspi_table_get_accessible_at (AtspiTable *obj, gint row, gint column, GError **error); +AtspiAccessible *atspi_table_get_accessible_at (AtspiTable *obj, gint row, gint column, GError **error); gint atspi_table_get_index_at (AtspiTable *obj, gint row, gint column, GError **error); @@ -62,9 +62,9 @@ gint atspi_table_get_row_at_index (AtspiTable *obj, gint index, GError **error); gint atspi_table_get_column_at_index (AtspiTable *obj, gint index, GError **error); -gchar * atspi_table_get_row_description (AtspiTable *obj, gint row, GError **error); +gchar *atspi_table_get_row_description (AtspiTable *obj, gint row, GError **error); -gchar * atspi_table_get_column_description (AtspiTable *obj, gint column, GError **error); +gchar *atspi_table_get_column_description (AtspiTable *obj, gint column, GError **error); gint atspi_table_get_row_extent_at (AtspiTable *obj, gint row, gint column, GError **error); @@ -72,15 +72,15 @@ atspi_table_get_row_extent_at (AtspiTable *obj, gint row, gint column, GError ** gint atspi_table_get_column_extent_at (AtspiTable *obj, gint row, gint column, GError **error); -AtspiAccessible * atspi_table_get_row_header (AtspiTable *obj, gint row, GError **error); +AtspiAccessible *atspi_table_get_row_header (AtspiTable *obj, gint row, GError **error); -AtspiAccessible * atspi_table_get_column_header (AtspiTable *obj, gint column, GError **error); +AtspiAccessible *atspi_table_get_column_header (AtspiTable *obj, gint column, GError **error); gint atspi_table_get_n_selected_rows (AtspiTable *obj, GError **error); GArray *atspi_table_get_selected_rows (AtspiTable *obj, GError **error); -GArray * atspi_table_get_selected_columns (AtspiTable *obj, GError **error); +GArray *atspi_table_get_selected_columns (AtspiTable *obj, GError **error); gint atspi_table_get_n_selected_columns (AtspiTable *obj, GError **error); @@ -102,4 +102,4 @@ gboolean atspi_table_is_selected (AtspiTable *obj, gint row, gint column, GError G_END_DECLS -#endif /* _ATSPI_TABLE_H_ */ +#endif /* _ATSPI_TABLE_H_ */ diff --git a/atspi/atspi-text.c b/atspi/atspi-text.c index f85d3f3e..8ef77490 100644 --- a/atspi/atspi-text.c +++ b/atspi/atspi-text.c @@ -76,8 +76,7 @@ atspi_text_range_free (AtspiTextRange *range) g_free (range); } -G_DEFINE_BOXED_TYPE (AtspiTextRange, atspi_text_range, atspi_text_range_copy, - atspi_text_range_free) +G_DEFINE_BOXED_TYPE (AtspiTextRange, atspi_text_range, atspi_text_range_copy, atspi_text_range_free) /** * atspi_text_get_character_count: @@ -115,9 +114,9 @@ atspi_text_get_character_count (AtspiText *obj, GError **error) **/ gchar * atspi_text_get_text (AtspiText *obj, - gint start_offset, - gint end_offset, - GError **error) + gint start_offset, + gint end_offset, + GError **error) { gchar *retval = NULL; dbus_int32_t d_start_offset = start_offset, d_end_offset = end_offset; @@ -174,10 +173,10 @@ atspi_text_get_caret_offset (AtspiText *obj, GError **error) **/ GHashTable * atspi_text_get_attributes (AtspiText *obj, - gint offset, - gint *start_offset, - gint *end_offset, - GError **error) + gint offset, + gint *start_offset, + gint *end_offset, + GError **error) { return atspi_text_get_text_attributes (obj, offset, start_offset, end_offset, error); } @@ -202,10 +201,10 @@ atspi_text_get_attributes (AtspiText *obj, **/ GHashTable * atspi_text_get_text_attributes (AtspiText *obj, - gint offset, - gint *start_offset, - gint *end_offset, - GError **error) + gint offset, + gint *start_offset, + gint *end_offset, + GError **error) { dbus_int32_t d_offset = offset; dbus_int32_t d_start_offset, d_end_offset; @@ -214,7 +213,7 @@ atspi_text_get_text_attributes (AtspiText *obj, GHashTable *ret = NULL; if (obj == NULL) - return NULL; + return NULL; reply = _atspi_dbus_call_partial (obj, atspi_interface_text, "GetAttributes", error, "i", d_offset); _ATSPI_DBUS_CHECK_SIG (reply, "a{ss}ii", error, ret) @@ -242,7 +241,7 @@ atspi_text_get_text_attributes (AtspiText *obj, * search is based. * @include_defaults: a #bool that, when set as #FALSE, indicates the call * should only return those attributes which are explicitly set on the current - * attribute run, omitting any attributes which are inherited from the + * attribute run, omitting any attributes which are inherited from the * default values. * @start_offset: (out): a #gint pointer indicating the start of the desired text * range. @@ -257,11 +256,11 @@ atspi_text_get_text_attributes (AtspiText *obj, **/ GHashTable * atspi_text_get_attribute_run (AtspiText *obj, - gint offset, - gboolean include_defaults, - gint *start_offset, - gint *end_offset, - GError **error) + gint offset, + gboolean include_defaults, + gint *start_offset, + gint *end_offset, + GError **error) { dbus_int32_t d_offset = offset; dbus_int32_t d_start_offset, d_end_offset; @@ -270,7 +269,7 @@ atspi_text_get_attribute_run (AtspiText *obj, GHashTable *ret = NULL; if (obj == NULL) - return NULL; + return NULL; reply = _atspi_dbus_call_partial (obj, atspi_interface_text, "GetAttributeRun", error, "ib", d_offset, @@ -338,7 +337,7 @@ atspi_text_get_text_attribute_value (AtspiText *obj, g_return_val_if_fail (obj != NULL, NULL); - _atspi_dbus_call (obj, atspi_interface_text, "GetAttributeValue", error, "is=>s", d_i, (const gchar *)attribute_value, &retval); + _atspi_dbus_call (obj, atspi_interface_text, "GetAttributeValue", error, "is=>s", d_i, (const gchar *) attribute_value, &retval); if (!retval) retval = g_strdup (""); @@ -351,7 +350,7 @@ atspi_text_get_text_attribute_value (AtspiText *obj, * @obj: a pointer to the #AtspiText object to query. * * Gets the default attributes applied to an #AtspiText - * object. The text attributes correspond to CSS attributes + * object. The text attributes correspond to CSS attributes * where possible. The combination of this attribute set and * the attributes reported by #atspi_text_get_attributes * describes the entire set of text attributes over a range. @@ -365,13 +364,12 @@ atspi_text_get_default_attributes (AtspiText *obj, GError **error) { DBusMessage *reply; - g_return_val_if_fail (obj != NULL, NULL); + g_return_val_if_fail (obj != NULL, NULL); reply = _atspi_dbus_call_partial (obj, atspi_interface_text, "GetDefaultAttributes", error, ""); return _atspi_dbus_return_hash_from_message (reply); } - /** * atspi_text_set_caret_offset: * @obj: a pointer to the #AtspiText object on which to operate. @@ -383,8 +381,8 @@ atspi_text_get_default_attributes (AtspiText *obj, GError **error) **/ gboolean atspi_text_set_caret_offset (AtspiText *obj, - gint new_offset, - GError **error) + gint new_offset, + GError **error) { dbus_int32_t d_new_offset = new_offset; dbus_bool_t retval = FALSE; @@ -413,9 +411,9 @@ atspi_text_set_caret_offset (AtspiText *obj, **/ AtspiTextRange * atspi_text_get_text_before_offset (AtspiText *obj, - gint offset, - AtspiTextBoundaryType type, - GError **error) + gint offset, + AtspiTextBoundaryType type, + GError **error) { dbus_int32_t d_offset = offset; dbus_uint32_t d_type = type; @@ -527,9 +525,9 @@ atspi_text_get_string_at_offset (AtspiText *obj, **/ AtspiTextRange * atspi_text_get_text_at_offset (AtspiText *obj, - gint offset, - AtspiTextBoundaryType type, - GError **error) + gint offset, + AtspiTextBoundaryType type, + GError **error) { dbus_int32_t d_offset = offset; dbus_uint32_t d_type = type; @@ -570,9 +568,9 @@ atspi_text_get_text_at_offset (AtspiText *obj, **/ AtspiTextRange * atspi_text_get_text_after_offset (AtspiText *obj, - gint offset, - AtspiTextBoundaryType type, - GError **error) + gint offset, + AtspiTextBoundaryType type, + GError **error) { dbus_int32_t d_offset = offset; dbus_uint32_t d_type = type; @@ -610,8 +608,8 @@ atspi_text_get_text_after_offset (AtspiText *obj, **/ guint atspi_text_get_character_at_offset (AtspiText *obj, - gint offset, - GError **error) + gint offset, + GError **error) { dbus_int32_t d_offset = offset; dbus_int32_t retval = -1; @@ -641,9 +639,9 @@ atspi_text_get_character_at_offset (AtspiText *obj, **/ AtspiRect * atspi_text_get_character_extents (AtspiText *obj, - gint offset, - AtspiCoordType type, - GError **error) + gint offset, + AtspiCoordType type, + GError **error) { dbus_int32_t d_offset = offset; dbus_uint32_t d_type = type; @@ -680,10 +678,10 @@ atspi_text_get_character_extents (AtspiText *obj, **/ gint atspi_text_get_offset_at_point (AtspiText *obj, - gint x, - gint y, - AtspiCoordType type, - GError **error) + gint x, + gint y, + AtspiCoordType type, + GError **error) { dbus_int32_t d_x = x, d_y = y; dbus_uint32_t d_type = type; @@ -716,10 +714,10 @@ atspi_text_get_offset_at_point (AtspiText *obj, **/ AtspiRect * atspi_text_get_range_extents (AtspiText *obj, - gint start_offset, - gint end_offset, - AtspiCoordType type, - GError **error) + gint start_offset, + gint end_offset, + AtspiCoordType type, + GError **error) { dbus_int32_t d_start_offset = start_offset, d_end_offset = end_offset; dbus_uint32_t d_type = type; @@ -762,14 +760,14 @@ atspi_text_get_range_extents (AtspiText *obj, **/ GArray * atspi_text_get_bounded_ranges (AtspiText *obj, - gint x, - gint y, - gint width, - gint height, - AtspiCoordType type, - AtspiTextClipType clipTypeX, - AtspiTextClipType clipTypeY, - GError **error) + gint x, + gint y, + gint width, + gint height, + AtspiCoordType type, + AtspiTextClipType clipTypeX, + AtspiTextClipType clipTypeY, + GError **error) { dbus_int32_t d_x = x, d_y = y, d_width = width, d_height = height; dbus_uint32_t d_type = type; @@ -816,8 +814,8 @@ atspi_text_get_n_selections (AtspiText *obj, GError **error) **/ AtspiRange * atspi_text_get_selection (AtspiText *obj, - gint selection_num, - GError **error) + gint selection_num, + GError **error) { dbus_int32_t d_selection_num = selection_num; dbus_int32_t d_start_offset, d_end_offset; @@ -847,8 +845,9 @@ atspi_text_get_selection (AtspiText *obj, **/ gboolean atspi_text_add_selection (AtspiText *obj, - gint start_offset, gint end_offset, - GError **error) + gint start_offset, + gint end_offset, + GError **error) { dbus_int32_t d_start_offset = start_offset, d_end_offset = end_offset; dbus_bool_t retval = FALSE; @@ -869,8 +868,8 @@ atspi_text_add_selection (AtspiText *obj, **/ gboolean atspi_text_remove_selection (AtspiText *obj, - gint selection_num, - GError **error) + gint selection_num, + GError **error) { dbus_int32_t d_selection_num = selection_num; dbus_bool_t retval = FALSE; @@ -896,10 +895,10 @@ atspi_text_remove_selection (AtspiText *obj, **/ gboolean atspi_text_set_selection (AtspiText *obj, - gint selection_num, - gint start_offset, - gint end_offset, - GError **error) + gint selection_num, + gint start_offset, + gint end_offset, + GError **error) { dbus_int32_t d_selection_num = selection_num, d_start_offset = start_offset, d_end_offset = end_offset; dbus_bool_t retval = FALSE; @@ -926,10 +925,10 @@ atspi_text_set_selection (AtspiText *obj, **/ gboolean atspi_text_scroll_substring_to (AtspiText *obj, - gint start_offset, - gint end_offset, - AtspiScrollType type, - GError **error) + gint start_offset, + gint end_offset, + AtspiScrollType type, + GError **error) { dbus_bool_t retval = FALSE; @@ -959,12 +958,12 @@ atspi_text_scroll_substring_to (AtspiText *obj, **/ gboolean atspi_text_scroll_substring_to_point (AtspiText *obj, - gint start_offset, - gint end_offset, - AtspiCoordType coords, - gint x, - gint y, - GError **error) + gint start_offset, + gint end_offset, + AtspiCoordType coords, + gint x, + gint y, + GError **error) { dbus_bool_t retval = FALSE; @@ -987,16 +986,15 @@ atspi_text_get_type (void) { static GType type = 0; - if (!type) { - static const GTypeInfo tinfo = + if (!type) { - sizeof (AtspiText), - (GBaseInitFunc) atspi_text_base_init, - (GBaseFinalizeFunc) NULL, - }; - - type = g_type_register_static (G_TYPE_INTERFACE, "AtspiText", &tinfo, 0); - - } + static const GTypeInfo tinfo = { + sizeof (AtspiText), + (GBaseInitFunc) atspi_text_base_init, + (GBaseFinalizeFunc) NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiText", &tinfo, 0); + } return type; } diff --git a/atspi/atspi-text.h b/atspi/atspi-text.h index 994d12b2..61375b18 100644 --- a/atspi/atspi-text.h +++ b/atspi/atspi-text.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -43,10 +43,10 @@ struct _AtspiRange /** * ATSPI_TYPE_RANGE: - * + * * The #GType for a boxed type holding a range within a text bock. */ -#define ATSPI_TYPE_RANGE atspi_range_get_type () +#define ATSPI_TYPE_RANGE atspi_range_get_type () GType atspi_range_get_type (); @@ -63,15 +63,15 @@ struct _AtspiTextRange /** * ATSPI_TYPE_TEXT_RANGE: - * + * * The #GType for a boxed type holding a range within a text bock. */ -#define ATSPI_TYPE_TEXT_RANGE atspi_text_range_get_type () +#define ATSPI_TYPE_TEXT_RANGE atspi_text_range_get_type () -#define ATSPI_TYPE_TEXT (atspi_text_get_type ()) -#define ATSPI_IS_TEXT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_TEXT) -#define ATSPI_TEXT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_TEXT, AtspiText) -#define ATSPI_TEXT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_TEXT, AtspiText)) +#define ATSPI_TYPE_TEXT (atspi_text_get_type ()) +#define ATSPI_IS_TEXT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_TEXT) +#define ATSPI_TEXT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_TEXT, AtspiText) +#define ATSPI_TEXT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_TEXT, AtspiText)) GType atspi_text_get_type (); @@ -80,12 +80,11 @@ struct _AtspiText GTypeInterface parent; }; - GType atspi_text_range_get_type (); gint atspi_text_get_character_count (AtspiText *obj, GError **error); -gchar * atspi_text_get_text (AtspiText *obj, gint start_offset, gint end_offset, GError **error); +gchar *atspi_text_get_text (AtspiText *obj, gint start_offset, gint end_offset, GError **error); gint atspi_text_get_caret_offset (AtspiText *obj, GError **error); @@ -98,38 +97,38 @@ GHashTable *atspi_text_get_text_attributes (AtspiText *obj, gint offset, gint *s GHashTable *atspi_text_get_attribute_run (AtspiText *obj, gint offset, gboolean include_defaults, gint *start_offset, gint *end_offset, GError **error); #ifndef ATSPI_DISABLE_DEPRECATED -gchar * atspi_text_get_attribute_value (AtspiText *obj, gint offset, gchar *attribute_name, GError **error); +gchar *atspi_text_get_attribute_value (AtspiText *obj, gint offset, gchar *attribute_name, GError **error); #endif -gchar * atspi_text_get_text_attribute_value (AtspiText *obj, gint offset, gchar *attribute_name, GError **error); +gchar *atspi_text_get_text_attribute_value (AtspiText *obj, gint offset, gchar *attribute_name, GError **error); -GHashTable * atspi_text_get_default_attributes (AtspiText *obj, GError **error); +GHashTable *atspi_text_get_default_attributes (AtspiText *obj, GError **error); gboolean atspi_text_set_caret_offset (AtspiText *obj, gint new_offset, GError **error); #ifndef ATSPI_DISABLE_DEPRECATED -AtspiTextRange * atspi_text_get_text_before_offset (AtspiText *obj, gint offset, AtspiTextBoundaryType type, GError **error); +AtspiTextRange *atspi_text_get_text_before_offset (AtspiText *obj, gint offset, AtspiTextBoundaryType type, GError **error); -AtspiTextRange * atspi_text_get_text_at_offset (AtspiText *obj, gint offset, AtspiTextBoundaryType type, GError **error); +AtspiTextRange *atspi_text_get_text_at_offset (AtspiText *obj, gint offset, AtspiTextBoundaryType type, GError **error); -AtspiTextRange * atspi_text_get_text_after_offset (AtspiText *obj, gint offset, AtspiTextBoundaryType type, GError **error); +AtspiTextRange *atspi_text_get_text_after_offset (AtspiText *obj, gint offset, AtspiTextBoundaryType type, GError **error); #endif -AtspiTextRange * atspi_text_get_string_at_offset (AtspiText *obj, gint offset, AtspiTextGranularity granularity, GError **error); +AtspiTextRange *atspi_text_get_string_at_offset (AtspiText *obj, gint offset, AtspiTextGranularity granularity, GError **error); guint atspi_text_get_character_at_offset (AtspiText *obj, gint offset, GError **error); -AtspiRect * atspi_text_get_character_extents (AtspiText *obj, gint offset, AtspiCoordType type, GError **error); +AtspiRect *atspi_text_get_character_extents (AtspiText *obj, gint offset, AtspiCoordType type, GError **error); gint atspi_text_get_offset_at_point (AtspiText *obj, gint x, gint y, AtspiCoordType type, GError **error); -AtspiRect * atspi_text_get_range_extents (AtspiText *obj, gint start_offset, gint end_offset, AtspiCoordType type, GError **error); +AtspiRect *atspi_text_get_range_extents (AtspiText *obj, gint start_offset, gint end_offset, AtspiCoordType type, GError **error); -GArray * atspi_text_get_bounded_ranges (AtspiText *obj, gint x, gint y, gint width, gint height, AtspiCoordType type, AtspiTextClipType clipTypeX, AtspiTextClipType clipTypeY, GError **error); +GArray *atspi_text_get_bounded_ranges (AtspiText *obj, gint x, gint y, gint width, gint height, AtspiCoordType type, AtspiTextClipType clipTypeX, AtspiTextClipType clipTypeY, GError **error); gint atspi_text_get_n_selections (AtspiText *obj, GError **error); -AtspiRange * atspi_text_get_selection (AtspiText *obj, gint selection_num, GError **error); +AtspiRange *atspi_text_get_selection (AtspiText *obj, gint selection_num, GError **error); gboolean atspi_text_add_selection (AtspiText *obj, gint start_offset, gint end_offset, GError **error); @@ -142,4 +141,4 @@ gboolean atspi_text_scroll_substring_to (AtspiText *obj, gint start_offset, gint gboolean atspi_text_scroll_substring_to_point (AtspiText *obj, gint start_offset, gint end_offset, AtspiCoordType coords, gint x, gint y, GError **error); G_END_DECLS -#endif /* _ATSPI_TEXT_H_ */ +#endif /* _ATSPI_TEXT_H_ */ diff --git a/atspi/atspi-types.h b/atspi/atspi-types.h index 8eca6dd5..b6c28b49 100644 --- a/atspi/atspi-types.h +++ b/atspi/atspi-types.h @@ -4,7 +4,7 @@ * * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -66,7 +66,7 @@ struct _AtspiDeviceEvent gushort hw_code; gushort modifiers; guint timestamp; - gchar * event_string; + gchar *event_string; gboolean is_text; }; @@ -89,35 +89,35 @@ struct _AtspiKeyDefinition /** * ATSPI_TYPE_KEY_DEFINITION: - * + * * The #GType for a boxed type holding a #AtspiKeyDefinition. */ -#define ATSPI_TYPE_KEY_DEFINITION (atspi_key_definition_get_type ()) +#define ATSPI_TYPE_KEY_DEFINITION (atspi_key_definition_get_type ()) typedef struct _AtspiEvent AtspiEvent; struct _AtspiEvent { - gchar *type; - AtspiAccessible *source; - gint detail1; - gint detail2; + gchar *type; + AtspiAccessible *source; + gint detail1; + gint detail2; GValue any_data; AtspiAccessible *sender; }; /** * ATSPI_TYPE_DEVICE_EVENT: - * + * * The #GType for a boxed type holding a #AtspiDeviceEvent. */ -#define ATSPI_TYPE_DEVICE_EVENT (atspi_device_event_get_type ()) +#define ATSPI_TYPE_DEVICE_EVENT (atspi_device_event_get_type ()) /** * ATSPI_TYPE_EVENT: - * + * * The #GType for a boxed type holding a #AtspiEvent. */ -#define ATSPI_TYPE_EVENT (atspi_event_get_type ()) +#define ATSPI_TYPE_EVENT (atspi_event_get_type ()) typedef void AtspiKeystrokeListener; @@ -134,22 +134,22 @@ typedef struct _AtspiKeySet { guint *keysyms; gushort *keycodes; - gchar **keystrings; - gshort len; + gchar **keystrings; + gshort len; } AtspiKeySet; /** * AtspiKeyListenerSyncType: * * @ATSPI_KEYLISTENER_NOSYNC: Events may be delivered asynchronously, - * which means in some cases they may already have been delivered to the - * application before the AT client receives the notification. - * @ATSPI_KEYLISTENER_SYNCHRONOUS: Events are delivered synchronously, before the - * currently focussed application sees them. + * which means in some cases they may already have been delivered to the + * application before the AT client receives the notification. + * @ATSPI_KEYLISTENER_SYNCHRONOUS: Events are delivered synchronously, before the + * currently focussed application sees them. * @ATSPI_KEYLISTENER_CANCONSUME: Events may be consumed by the AT client. Presumes and * requires #ATSPI_KEYLISTENER_SYNCHRONOUS, incompatible with #ATSPI_KEYLISTENER_NOSYNC. * @ATSPI_KEYLISTENER_ALL_WINDOWS: Events are received not from the application toolkit layer, but - * from the device driver or windowing system subsystem; such notifications are 'global' in the + * from the device driver or windowing system subsystem; such notifications are 'global' in the * sense that they are not broken or defeated by applications that participate poorly * in the accessibility APIs, or not at all; however because of the intrusive nature of * such snooping, it can have side-effects on certain older platforms. If unconditional @@ -161,13 +161,14 @@ typedef struct _AtspiKeySet * together, observing the compatibility limitations specified in the description of * each value. For instance, #ATSPI_KEYLISTENER_ALL_WINDOWS | #ATSPI_KEYLISTENER_CANCONSUME is * a commonly used combination which gives the AT complete control over the delivery of matching - * events. However, such filters should be used sparingly as they may have a negative impact on + * events. However, such filters should be used sparingly as they may have a negative impact on * system performance. **/ -typedef enum { +typedef enum +{ ATSPI_KEYLISTENER_NOSYNC = 0, ATSPI_KEYLISTENER_SYNCHRONOUS = 1 << 0, ATSPI_KEYLISTENER_CANCONSUME = 1 << 1, ATSPI_KEYLISTENER_ALL_WINDOWS = 1 << 2 } AtspiKeyListenerSyncType; -#endif /* _ATSPI_TYPES_H_ */ +#endif /* _ATSPI_TYPES_H_ */ diff --git a/atspi/atspi-value.c b/atspi/atspi-value.c index 54300319..ac2d3da3 100644 --- a/atspi/atspi-value.c +++ b/atspi/atspi-value.c @@ -38,7 +38,7 @@ /** * atspi_value_get_minimum_value: - * @obj: a pointer to the #AtspiValue implementor on which to operate. + * @obj: a pointer to the #AtspiValue implementor on which to operate. * * Gets the minimum allowed value for an #AtspiValue. * @@ -52,13 +52,13 @@ atspi_value_get_minimum_value (AtspiValue *obj, GError **error) g_return_val_if_fail (obj != NULL, 0.0); _atspi_dbus_get_property (obj, atspi_interface_value, "MinimumValue", error, "d", &retval); - + return retval; } /** * atspi_value_get_current_value: - * @obj: a pointer to the #AtspiValue implementor on which to operate. + * @obj: a pointer to the #AtspiValue implementor on which to operate. * * Gets the current value for an #AtspiValue. * @@ -78,7 +78,7 @@ atspi_value_get_current_value (AtspiValue *obj, GError **error) /** * atspi_value_get_maximum_value: - * @obj: a pointer to the #AtspiValue implementor on which to operate. + * @obj: a pointer to the #AtspiValue implementor on which to operate. * * Gets the maximum allowed value for an #AtspiValue. * @@ -87,7 +87,7 @@ atspi_value_get_current_value (AtspiValue *obj, GError **error) gdouble atspi_value_get_maximum_value (AtspiValue *obj, GError **error) { - double retval; + double retval; g_return_val_if_fail (obj != NULL, 0.0); @@ -118,25 +118,25 @@ atspi_value_set_current_value (AtspiValue *obj, gdouble new_value, GError **erro g_return_val_if_fail (accessible != NULL, FALSE); if (!accessible->parent.app || !accessible->parent.app->bus_name) -{ - g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_APPLICATION_GONE, - _("The application no longer exists")); - return FALSE; - } - - message = dbus_message_new_method_call (accessible->parent.app->bus_name, - accessible->parent.path, - DBUS_INTERFACE_PROPERTIES, "Set"); - if (!message) + { + g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_APPLICATION_GONE, + _ ("The application no longer exists")); return FALSE; - dbus_message_append_args (message, DBUS_TYPE_STRING, &atspi_interface_value, - DBUS_TYPE_STRING, &str_curval, - DBUS_TYPE_INVALID); + } + + message = dbus_message_new_method_call (accessible->parent.app->bus_name, + accessible->parent.path, + DBUS_INTERFACE_PROPERTIES, "Set"); + if (!message) + return FALSE; + dbus_message_append_args (message, DBUS_TYPE_STRING, &atspi_interface_value, + DBUS_TYPE_STRING, &str_curval, + DBUS_TYPE_INVALID); dbus_message_iter_init_append (message, &iter); dbus_message_iter_open_container (&iter, DBUS_TYPE_VARIANT, "d", &iter_variant); dbus_message_iter_append_basic (&iter_variant, DBUS_TYPE_DOUBLE, &d_new_value); dbus_message_iter_close_container (&iter, &iter_variant); - reply = _atspi_dbus_send_with_reply_and_block (message, error); + reply = _atspi_dbus_send_with_reply_and_block (message, error); dbus_message_unref (reply); return TRUE; @@ -144,7 +144,7 @@ atspi_value_set_current_value (AtspiValue *obj, gdouble new_value, GError **erro /** * atspi_value_get_minimum_increment: - * @obj: a pointer to the #AtspiValue implementor on which to operate. + * @obj: a pointer to the #AtspiValue implementor on which to operate. * * Gets the minimum increment by which an #AtspiValue can be adjusted. * @@ -160,13 +160,13 @@ atspi_value_get_minimum_increment (AtspiValue *obj, GError **error) g_return_val_if_fail (obj != NULL, 0.0); _atspi_dbus_get_property (obj, atspi_interface_value, "MinimumIncrement", error, "d", &retval); - + return retval; } /** * atspi_value_get_text: - * @obj: a pointer to the #AtspiValue implementor on which to operate. + * @obj: a pointer to the #AtspiValue implementor on which to operate. * * Gets the human readable text alternative associated with the value. * @text is a newly created string, that must be freed by the @@ -182,7 +182,7 @@ atspi_value_get_text (AtspiValue *obj, GError **error) g_return_val_if_fail (obj != NULL, NULL); _atspi_dbus_get_property (obj, atspi_interface_value, "Text", error, "s", &retval); - + return retval; } @@ -196,17 +196,15 @@ atspi_value_get_type (void) { static GType type = 0; - if (!type) { - static const GTypeInfo tinfo = + if (!type) { - sizeof (AtspiValue), - (GBaseInitFunc) atspi_value_base_init, - (GBaseFinalizeFunc) NULL, - }; - - type = g_type_register_static (G_TYPE_INTERFACE, "AtspiValue", &tinfo, 0); - - } + static const GTypeInfo tinfo = { + sizeof (AtspiValue), + (GBaseInitFunc) atspi_value_base_init, + (GBaseFinalizeFunc) NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiValue", &tinfo, 0); + } return type; } - diff --git a/atspi/atspi-value.h b/atspi/atspi-value.h index 478ea951..ba04ff0f 100644 --- a/atspi/atspi-value.h +++ b/atspi/atspi-value.h @@ -5,7 +5,7 @@ * Copyright 2002 Ximian, Inc. * 2002 Sun Microsystems Inc. * Copyright 2010, 2011 Novell, Inc. - * + * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -34,10 +34,10 @@ G_BEGIN_DECLS -#define ATSPI_TYPE_VALUE (atspi_value_get_type ()) -#define ATSPI_IS_VALUE(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_VALUE) -#define ATSPI_VALUE(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_VALUE, AtspiValue) -#define ATSPI_VALUE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_VALUE, AtspiValue)) +#define ATSPI_TYPE_VALUE (atspi_value_get_type ()) +#define ATSPI_IS_VALUE(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_VALUE) +#define ATSPI_VALUE(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_VALUE, AtspiValue) +#define ATSPI_VALUE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_VALUE, AtspiValue)) GType atspi_value_get_type (); @@ -59,4 +59,4 @@ gdouble atspi_value_get_minimum_increment (AtspiValue *obj, GError **error); gchar *atspi_value_get_text (AtspiValue *obj, GError **error); G_END_DECLS -#endif /* _ATSPI_VALUE_H_ */ +#endif /* _ATSPI_VALUE_H_ */ diff --git a/atspi/atspi.h b/atspi/atspi.h index 89ff20f0..f036d86d 100644 --- a/atspi/atspi.h +++ b/atspi/atspi.h @@ -26,12 +26,11 @@ #include "glib.h" -#include "atspi-constants.h" -#include "atspi-types.h" #include "atspi-accessible.h" #include "atspi-action.h" #include "atspi-collection.h" #include "atspi-component.h" +#include "atspi-constants.h" #include "atspi-device-listener.h" #include "atspi-document.h" #include "atspi-editabletext.h" @@ -45,9 +44,10 @@ #include "atspi-relation.h" #include "atspi-selection.h" #include "atspi-stateset.h" -#include "atspi-table.h" #include "atspi-table-cell.h" +#include "atspi-table.h" #include "atspi-text.h" +#include "atspi-types.h" #include "atspi-value.h" #include "atspi-gmain.h" |
