summaryrefslogtreecommitdiff
path: root/atk-adaptor/accessible-register.c
diff options
context:
space:
mode:
authorMark Doffman <mark.doffman@codethink.co.uk>2010-01-02 07:54:20 -0800
committerMark Doffman <mark.doffman@codethink.co.uk>2010-01-05 02:18:57 -0800
commite9d9fedb0c914825a3ccd8b390deb52a93800415 (patch)
treefe1f6f7a83f5469ef2992f6dc929c170ee35d4f7 /atk-adaptor/accessible-register.c
parent01fb83c0ba436a54fd5450c04b8511b2409b90e2 (diff)
downloadat-spi2-atk-e9d9fedb0c914825a3ccd8b390deb52a93800415.tar.gz
Code style enforcement.
All files in atk-adaptor now use gnu style indentation. 'indent --no-tabs'
Diffstat (limited to 'atk-adaptor/accessible-register.c')
-rw-r--r--atk-adaptor/accessible-register.c544
1 files changed, 279 insertions, 265 deletions
diff --git a/atk-adaptor/accessible-register.c b/atk-adaptor/accessible-register.c
index d4a1d6c..f0963af 100644
--- a/atk-adaptor/accessible-register.c
+++ b/atk-adaptor/accessible-register.c
@@ -76,7 +76,7 @@
#define SPI_ATK_OBJECT_REFERENCE_TEMPLATE SPI_ATK_OBJECT_PATH_PREFIX "/%d"
-static GHashTable *ref2ptr = NULL; /* Used for converting a D-Bus path (Reference) to the object pointer */
+static GHashTable *ref2ptr = NULL; /* Used for converting a D-Bus path (Reference) to the object pointer */
static GHashTable *objects_with_subrefs = NULL;
static GHashTable *leased_refs = NULL;
static int leased_refs_count;
@@ -87,19 +87,21 @@ static GStaticRecMutex registration_mutex = G_STATIC_REC_MUTEX_INIT;
/*---------------------------------------------------------------------------*/
-static GStaticMutex recursion_check_guard = G_STATIC_MUTEX_INIT;
-static gboolean recursion_check = FALSE;
+static GStaticMutex recursion_check_guard = G_STATIC_MUTEX_INIT;
+static gboolean recursion_check = FALSE;
static int last_gc_time;
-static void deregister_sub_accessible (gpointer key, gpointer obj_data, gpointer iter);
+static void deregister_sub_accessible (gpointer key, gpointer obj_data,
+ gpointer iter);
-static void deregister_sub_hyperlink (gpointer key, gpointer obj_data, gpointer iter);
+static void deregister_sub_hyperlink (gpointer key, gpointer obj_data,
+ gpointer iter);
static gboolean
recursion_check_and_set ()
{
gboolean ret;
- g_static_mutex_lock (&recursion_check_guard);
+ g_static_mutex_lock (&recursion_check_guard);
ret = recursion_check;
recursion_check = TRUE;
g_static_mutex_unlock (&recursion_check_guard);
@@ -109,7 +111,7 @@ recursion_check_and_set ()
static void
recursion_check_unset ()
{
- g_static_mutex_lock (&recursion_check_guard);
+ g_static_mutex_lock (&recursion_check_guard);
recursion_check = FALSE;
g_static_mutex_unlock (&recursion_check_guard);
}
@@ -123,7 +125,7 @@ recursion_check_unset ()
* AtkObject.
*/
static guint
-assign_reference(void)
+assign_reference (void)
{
reference_counter++;
/* Reference of 0 not allowed as used as direct key in hash table */
@@ -137,19 +139,19 @@ assign_reference(void)
* Returns the reference of the object, or 0 if it is not registered.
*/
static guint
-gobject_to_ref (GObject *gobj)
+gobject_to_ref (GObject * gobj)
{
- return GPOINTER_TO_INT(g_object_get_data (gobj, "dbus-id"));
+ return GPOINTER_TO_INT (g_object_get_data (gobj, "dbus-id"));
}
static guint
-object_to_ref (AtkObject *accessible)
+object_to_ref (AtkObject * accessible)
{
return gobject_to_ref (G_OBJECT (accessible));
}
static guint
-hyperlink_to_ref (AtkHyperlink *link)
+hyperlink_to_ref (AtkHyperlink * link)
{
return gobject_to_ref (G_OBJECT (link));
}
@@ -160,7 +162,7 @@ hyperlink_to_ref (AtkHyperlink *link)
gchar *
atk_dbus_ref_to_path (guint ref)
{
- return g_strdup_printf(SPI_ATK_OBJECT_REFERENCE_TEMPLATE, ref);
+ return g_strdup_printf (SPI_ATK_OBJECT_REFERENCE_TEMPLATE, ref);
}
/*---------------------------------------------------------------------------*/
@@ -172,7 +174,7 @@ atk_dbus_ref_to_path (guint ref)
* it is no longer exposed over D-Bus.
*/
static void
-deregister_object (gpointer data, GObject *gobj)
+deregister_object (gpointer data, GObject * gobj)
{
guint ref;
GHashTable *subrefs_atk;
@@ -180,33 +182,35 @@ deregister_object (gpointer data, GObject *gobj)
g_return_if_fail (ATK_IS_OBJECT (gobj) || ATK_IS_HYPERLINK (gobj));
subrefs_atk = (GHashTable *) g_object_get_data (gobj, "dbus-subrefs-atk");
- subrefs_hyperlink = (GHashTable *) g_object_get_data (gobj, "dbus-subrefs-hyperlink");
+ subrefs_hyperlink =
+ (GHashTable *) g_object_get_data (gobj, "dbus-subrefs-hyperlink");
if (subrefs_atk)
- {
- g_hash_table_foreach (subrefs_atk, deregister_sub_accessible, data);
- g_hash_table_unref (subrefs_atk);
- }
-
+ {
+ g_hash_table_foreach (subrefs_atk, deregister_sub_accessible, data);
+ g_hash_table_unref (subrefs_atk);
+ }
+
if (subrefs_hyperlink)
- {
- g_hash_table_foreach (subrefs_hyperlink, deregister_sub_hyperlink, data);
- g_hash_table_unref (subrefs_hyperlink);
- }
-
+ {
+ g_hash_table_foreach (subrefs_hyperlink, deregister_sub_hyperlink,
+ data);
+ g_hash_table_unref (subrefs_hyperlink);
+ }
+
if (subrefs_atk || subrefs_hyperlink)
g_hash_table_remove (objects_with_subrefs, gobj);
if (ATK_IS_OBJECT (gobj))
- {
- ref = object_to_ref (ATK_OBJECT (gobj));
- if (ref != 0)
- {
- spi_emit_cache_removal (ref, atk_adaptor_app_data->bus);
- g_hash_table_remove(ref2ptr, GINT_TO_POINTER(ref));
- }
+ {
+ ref = object_to_ref (ATK_OBJECT (gobj));
+ if (ref != 0)
+ {
+ spi_emit_cache_removal (ref, atk_adaptor_app_data->bus);
+ g_hash_table_remove (ref2ptr, GINT_TO_POINTER (ref));
+ }
}
- }
+}
static void
deregister_sub_accessible (gpointer key, gpointer obj_data, gpointer iter)
@@ -228,82 +232,88 @@ deregister_sub_hyperlink (gpointer key, gpointer obj_data, gpointer iter)
ref = gobject_to_ref (ghyperlink);
if (ref != 0)
{
- g_hash_table_remove(ref2ptr, GINT_TO_POINTER(ref));
+ g_hash_table_remove (ref2ptr, GINT_TO_POINTER (ref));
}
g_object_unref (ghyperlink);
}
static void
-register_gobject (GObject *gobj, GObject *container)
+register_gobject (GObject * gobj, GObject * container)
{
guint ref;
- g_return_if_fail (G_IS_OBJECT(gobj));
+ g_return_if_fail (G_IS_OBJECT (gobj));
- ref = assign_reference();
+ ref = assign_reference ();
- g_hash_table_insert (ref2ptr, GINT_TO_POINTER(ref), gobj);
- g_object_set_data (G_OBJECT(gobj), "dbus-id", GINT_TO_POINTER(ref));
- g_object_weak_ref(G_OBJECT(gobj), deregister_object, NULL);
+ g_hash_table_insert (ref2ptr, GINT_TO_POINTER (ref), gobj);
+ g_object_set_data (G_OBJECT (gobj), "dbus-id", GINT_TO_POINTER (ref));
+ g_object_weak_ref (G_OBJECT (gobj), deregister_object, NULL);
if (container)
- {
- GHashTable *subrefs = (GHashTable *) g_object_get_data (G_OBJECT (container), "dbus-subrefs-atk");
- if (!subrefs)
{
- subrefs = g_hash_table_new(g_direct_hash, g_direct_equal);
- g_object_set_data (G_OBJECT (container), "dbus-subrefs-atk", subrefs);
+ GHashTable *subrefs =
+ (GHashTable *) g_object_get_data (G_OBJECT (container),
+ "dbus-subrefs-atk");
+ if (!subrefs)
+ {
+ subrefs = g_hash_table_new (g_direct_hash, g_direct_equal);
+ g_object_set_data (G_OBJECT (container), "dbus-subrefs-atk",
+ subrefs);
+ }
+ g_hash_table_insert (subrefs, GINT_TO_POINTER (ref), gobj);
+ g_hash_table_insert (objects_with_subrefs, gobj, subrefs);
}
- g_hash_table_insert (subrefs, GINT_TO_POINTER(ref), gobj);
- g_hash_table_insert (objects_with_subrefs, gobj, subrefs);
- }
if (ATK_IS_HYPERLINK (gobj))
g_object_ref (gobj);
else if (ATK_IS_OBJECT (gobj))
- {
- AtkObject *accessible = ATK_OBJECT (gobj);
- AtkStateSet *state = atk_object_ref_state_set (accessible);
- if (atk_state_set_contains_state (state, ATK_STATE_TRANSIENT))
{
- g_object_ref (gobj);
- /* We should only get here as the result of a query other than GetTree */
- spi_emit_cache_update (accessible, atk_adaptor_app_data->bus);
+ AtkObject *accessible = ATK_OBJECT (gobj);
+ AtkStateSet *state = atk_object_ref_state_set (accessible);
+ if (atk_state_set_contains_state (state, ATK_STATE_TRANSIENT))
+ {
+ g_object_ref (gobj);
+ /* We should only get here as the result of a query other than GetTree */
+ spi_emit_cache_update (accessible, atk_adaptor_app_data->bus);
+ }
+ g_object_unref (state);
}
- g_object_unref (state);
- }
}
/*
* Called to register an AtkObject with AT-SPI and expose it over D-Bus.
*/
static void
-register_accessible (AtkObject *accessible, AtkObject *container)
+register_accessible (AtkObject * accessible, AtkObject * container)
{
- g_return_if_fail (ATK_IS_OBJECT(accessible));
+ g_return_if_fail (ATK_IS_OBJECT (accessible));
register_gobject (G_OBJECT (accessible), G_OBJECT (container));
}
static void
-register_hyperlink (AtkHyperlink *hyperlink, AtkObject *container)
+register_hyperlink (AtkHyperlink * hyperlink, AtkObject * container)
{
guint ref;
g_return_if_fail (ATK_IS_HYPERLINK (hyperlink));
g_return_if_fail (container);
- ref = assign_reference();
+ ref = assign_reference ();
- g_hash_table_insert (ref2ptr, GINT_TO_POINTER(ref), hyperlink);
- g_object_set_data (G_OBJECT(hyperlink), "dbus-id", GINT_TO_POINTER(ref));
+ g_hash_table_insert (ref2ptr, GINT_TO_POINTER (ref), hyperlink);
+ g_object_set_data (G_OBJECT (hyperlink), "dbus-id", GINT_TO_POINTER (ref));
g_object_ref (G_OBJECT (hyperlink));
- GHashTable *subrefs = (GHashTable *) g_object_get_data (G_OBJECT (container), "dbus-subrefs-hyperlink");
+ GHashTable *subrefs =
+ (GHashTable *) g_object_get_data (G_OBJECT (container),
+ "dbus-subrefs-hyperlink");
if (!subrefs)
- {
- subrefs = g_hash_table_new(g_direct_hash, g_direct_equal);
- g_object_set_data (G_OBJECT (container), "dbus-subrefs-hyperlink", GINT_TO_POINTER(ref));
- }
- g_hash_table_insert (subrefs, GINT_TO_POINTER(ref), hyperlink);
+ {
+ subrefs = g_hash_table_new (g_direct_hash, g_direct_equal);
+ g_object_set_data (G_OBJECT (container), "dbus-subrefs-hyperlink",
+ GINT_TO_POINTER (ref));
+ }
+ g_hash_table_insert (subrefs, GINT_TO_POINTER (ref), hyperlink);
}
/*---------------------------------------------------------------------------*/
@@ -320,17 +330,17 @@ register_hyperlink (AtkHyperlink *hyperlink, AtkObject *container)
* TODO Add debug wrapper
*/
static gboolean
-non_owned_accessible (AtkObject *accessible)
-{
- if ((G_OBJECT (accessible))->ref_count <= 1)
- {
- g_warning ("AT-SPI: Child referenced that is not owned by its parent");
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+non_owned_accessible (AtkObject * accessible)
+{
+ if ((G_OBJECT (accessible))->ref_count <= 1)
+ {
+ g_warning ("AT-SPI: Child referenced that is not owned by its parent");
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
}
#endif /* SPI_ATK_DEBUG */
@@ -340,35 +350,36 @@ non_owned_accessible (AtkObject *accessible)
* Currently true if TRANSIENT and not SHOWING
*/
static gboolean
-object_is_moot (AtkObject *accessible)
+object_is_moot (AtkObject * accessible)
{
- AtkStateSet *state;
- gboolean result = FALSE;
+ AtkStateSet *state;
+ gboolean result = FALSE;
- /* This is dangerous, refing the state set
- * seems to do wierd things to the tree & cause recursion
- * by modifying the tree alot.
- */
- state = atk_object_ref_state_set (accessible);
- if ( atk_state_set_contains_state (state, ATK_STATE_TRANSIENT) &&
- !atk_state_set_contains_state (state, ATK_STATE_SHOWING))
- {
- result = TRUE;
- }
- g_object_unref (state);
+ /* This is dangerous, refing the state set
+ * seems to do wierd things to the tree & cause recursion
+ * by modifying the tree alot.
+ */
+ state = atk_object_ref_state_set (accessible);
+ if (atk_state_set_contains_state (state, ATK_STATE_TRANSIENT) &&
+ !atk_state_set_contains_state (state, ATK_STATE_SHOWING))
+ {
+ result = TRUE;
+ }
+ g_object_unref (state);
- return result;
+ return result;
}
static void
-append_children (AtkObject *accessible, GQueue *traversal)
+append_children (AtkObject * accessible, GQueue * traversal)
{
AtkObject *current;
guint i;
gint count = atk_object_get_n_accessible_children (accessible);
- if (count < 0) count = 0;
- for (i =0; i < count; i++)
+ if (count < 0)
+ count = 0;
+ for (i = 0; i < count; i++)
{
current = atk_object_ref_accessible_child (accessible, i);
if (current)
@@ -391,11 +402,11 @@ append_children (AtkObject *accessible, GQueue *traversal)
* or if it has already been registered.
*/
void
-register_subtree (AtkObject *accessible)
+register_subtree (AtkObject * accessible)
{
AtkObject *current;
- GQueue *traversal;
- GQueue *emit_update;
+ GQueue *traversal;
+ GQueue *emit_update;
g_return_if_fail (ATK_IS_OBJECT (accessible));
@@ -413,9 +424,9 @@ register_subtree (AtkObject *accessible)
{
register_accessible (current, NULL);
#ifdef SPI_ATK_DEBUG
- g_debug ("REG - %s - %d - %s", atk_object_get_name (current),
- atk_object_get_role (current),
- atk_dbus_object_to_path (current));
+ g_debug ("REG - %s - %d - %s", atk_object_get_name (current),
+ atk_object_get_role (current),
+ atk_dbus_object_to_path (current));
#endif
append_children (current, traversal);
}
@@ -439,10 +450,10 @@ register_subtree (AtkObject *accessible)
* way that client side cache needs to be updated.
*/
static void
-update_accessible (AtkObject *accessible)
+update_accessible (AtkObject * accessible)
{
- guint ref = 0;
- g_return_if_fail (ATK_IS_OBJECT(accessible));
+ guint ref = 0;
+ g_return_if_fail (ATK_IS_OBJECT (accessible));
ref = object_to_ref (accessible);
if (ref)
@@ -454,9 +465,9 @@ update_accessible (AtkObject *accessible)
/*---------------------------------------------------------------------------*/
void
-atk_dbus_foreach_registered(GHFunc func, gpointer data)
+atk_dbus_foreach_registered (GHFunc func, gpointer data)
{
- g_hash_table_foreach(ref2ptr, func, data);
+ g_hash_table_foreach (ref2ptr, func, data);
}
/*
@@ -470,25 +481,26 @@ atk_dbus_path_to_gobject (const char *path)
g_return_val_if_fail (path, NULL);
- if (strncmp(path, SPI_ATK_OBJECT_PATH_PREFIX, SPI_ATK_PATH_PREFIX_LENGTH) != 0)
+ if (strncmp (path, SPI_ATK_OBJECT_PATH_PREFIX, SPI_ATK_PATH_PREFIX_LENGTH)
+ != 0)
return NULL;
- path += SPI_ATK_PATH_PREFIX_LENGTH; /* Skip over the prefix */
+ path += SPI_ATK_PATH_PREFIX_LENGTH; /* Skip over the prefix */
if (!g_strcmp0 (SPI_ATK_OBJECT_PATH_DESKTOP, path))
- return G_OBJECT (atk_get_root());
+ return G_OBJECT (atk_get_root ());
if (path[0] != '/')
- return NULL;
+ return NULL;
path++;
index = atoi (path);
- data = g_hash_table_lookup (ref2ptr, GINT_TO_POINTER(index));
+ data = g_hash_table_lookup (ref2ptr, GINT_TO_POINTER (index));
if (data)
- {
- GObject *gobj = G_OBJECT (data);
- g_object_set_data (gobj, "last-ref-time", (gpointer) time (NULL));
- return gobj;
- }
+ {
+ GObject *gobj = G_OBJECT (data);
+ g_object_set_data (gobj, "last-ref-time", (gpointer) time (NULL));
+ return gobj;
+ }
else
return NULL;
}
@@ -505,7 +517,7 @@ atk_dbus_path_to_object (const char *path)
* object that has not already been registered.
*/
gchar *
-atk_dbus_object_attempt_registration (AtkObject *accessible)
+atk_dbus_object_attempt_registration (AtkObject * accessible)
{
guint ref;
@@ -520,13 +532,13 @@ atk_dbus_object_attempt_registration (AtkObject *accessible)
prev = accessible;
current = atk_object_get_parent (accessible);
if (current)
- cref = object_to_ref (current);
+ cref = object_to_ref (current);
while (current && !cref)
{
prev = current;
current = atk_object_get_parent (current);
if (current)
- cref = object_to_ref (current);
+ cref = object_to_ref (current);
}
/* A registered parent, with non-registered child, has been found */
@@ -544,7 +556,8 @@ atk_dbus_object_attempt_registration (AtkObject *accessible)
else
{
#ifdef SPI_ATK_DEBUG
- g_debug ("AT-SPI: Could not register a non-attached accessible object");
+ g_debug
+ ("AT-SPI: Could not register a non-attached accessible object");
#endif
return NULL;
}
@@ -560,52 +573,57 @@ atk_dbus_object_attempt_registration (AtkObject *accessible)
* Used to lookup a D-Bus path from the AtkObject.
*/
static gchar *
-atk_dbus_gobject_to_path_internal (GObject *gobj, gboolean do_register, GObject *container)
+atk_dbus_gobject_to_path_internal (GObject * gobj, gboolean do_register,
+ GObject * container)
{
guint ref;
ref = gobject_to_ref (gobj);
if (!ref && do_register)
- {
- register_gobject (gobj, container);
- ref = gobject_to_ref (gobj);
- }
+ {
+ register_gobject (gobj, container);
+ ref = gobject_to_ref (gobj);
+ }
if (!ref)
- return NULL;
+ return NULL;
else
- return atk_dbus_ref_to_path (ref);
+ return atk_dbus_ref_to_path (ref);
}
gchar *
-atk_dbus_object_to_path (AtkObject *accessible, gboolean do_register)
+atk_dbus_object_to_path (AtkObject * accessible, gboolean do_register)
{
- AtkObject *container = (accessible && do_register? atk_object_get_parent (accessible): NULL);
- return atk_dbus_gobject_to_path_internal (G_OBJECT (accessible), do_register, G_OBJECT (container));
+ AtkObject *container = (accessible
+ && do_register ? atk_object_get_parent (accessible)
+ : NULL);
+ return atk_dbus_gobject_to_path_internal (G_OBJECT (accessible),
+ do_register,
+ G_OBJECT (container));
}
gchar *
-atk_dbus_sub_object_to_path (GObject *gobj, GObject *container)
+atk_dbus_sub_object_to_path (GObject * gobj, GObject * container)
{
return atk_dbus_gobject_to_path_internal (gobj, TRUE, container);
}
gchar *
-atk_dbus_hyperlink_to_path (AtkHyperlink *hyperlink, AtkObject *container)
+atk_dbus_hyperlink_to_path (AtkHyperlink * hyperlink, AtkObject * container)
{
guint ref;
ref = gobject_to_ref (G_OBJECT (hyperlink));
if (!ref && container)
- {
- register_hyperlink (hyperlink, container);
- ref = hyperlink_to_ref (hyperlink);
- }
+ {
+ register_hyperlink (hyperlink, container);
+ ref = hyperlink_to_ref (hyperlink);
+ }
if (!ref)
- return NULL;
+ return NULL;
else
- return atk_dbus_ref_to_path (ref);
+ return atk_dbus_ref_to_path (ref);
}
gchar *
@@ -616,11 +634,10 @@ atk_dbus_desktop_object_path ()
/*---------------------------------------------------------------------------*/
-typedef gboolean (*TreeUpdateAction) (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data,
- AtkObject *accessible);
+typedef gboolean (*TreeUpdateAction) (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values,
+ gpointer data, AtkObject * accessible);
/*
* Events are not evaluated for non-registered accessibles.
@@ -633,11 +650,10 @@ typedef gboolean (*TreeUpdateAction) (GSignalInvocationHint *signal_hint,
*/
/* TODO Turn this function into a macro? */
static gboolean
-tree_update_wrapper (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data,
- TreeUpdateAction action)
+tree_update_wrapper (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values,
+ gpointer data, TreeUpdateAction action)
{
AtkObject *accessible;
@@ -646,14 +662,14 @@ tree_update_wrapper (GSignalInvocationHint *signal_hint,
/* Ensure that only registered accessibles
* have their signals processed.
*/
- accessible = ATK_OBJECT(g_value_get_object (&param_values[0]));
+ accessible = ATK_OBJECT (g_value_get_object (&param_values[0]));
g_return_val_if_fail (ATK_IS_OBJECT (accessible), TRUE);
if (object_to_ref (accessible))
{
#ifdef SPI_ATK_DEBUG
if (recursion_check_and_set ())
- g_warning ("AT-SPI: Recursive use of registration module");
+ g_warning ("AT-SPI: Recursive use of registration module");
g_debug ("AT-SPI: Tree update listener");
#endif
@@ -670,7 +686,7 @@ tree_update_wrapper (GSignalInvocationHint *signal_hint,
static gboolean
maybe_expire_lease (gpointer key, gpointer obj_data, gpointer iter)
{
- time_t secs = time (NULL) - (time_t)obj_data;
+ time_t secs = time (NULL) - (time_t) obj_data;
if (secs < 30)
return FALSE;
@@ -681,7 +697,8 @@ maybe_expire_lease (gpointer key, gpointer obj_data, gpointer iter)
static void
expire_old_leases_in (gpointer key, gpointer obj_data, gpointer iter)
{
- g_hash_table_foreach_remove ((GHashTable *)obj_data, maybe_expire_lease, NULL);
+ g_hash_table_foreach_remove ((GHashTable *) obj_data, maybe_expire_lease,
+ NULL);
}
static void
@@ -691,144 +708,141 @@ expire_old_leases ()
}
static gboolean
-tree_update_state_action (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data,
- AtkObject *accessible)
+tree_update_state_action (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values,
+ gpointer data, AtkObject * accessible)
{
const gchar *name;
gboolean state;
if (n_param_values < 3)
- {
- g_warning ("at-spi: Not enough params in state-changed signal");
- return TRUE;
- }
+ {
+ g_warning ("at-spi: Not enough params in state-changed signal");
+ return TRUE;
+ }
name = g_value_get_string (param_values + 1);
state = g_value_get_boolean (param_values + 2);
if (!strcmp (name, "visible"))
- {
- AtkStateSet *set = atk_object_ref_state_set (accessible);
- if (atk_state_set_contains_state (set, ATK_STATE_TRANSIENT))
{
- if (state == 0)
- {
- g_hash_table_insert (leased_refs, accessible, (gpointer) time (NULL));
- leased_refs_count++;
- /* todo: Set to a high number: 5 for dbg. */
- if (leased_refs_count > 5)
- expire_old_leases ();
- }
- else
- {
- g_hash_table_remove (leased_refs, accessible);
- leased_refs_count--;
- }
+ AtkStateSet *set = atk_object_ref_state_set (accessible);
+ if (atk_state_set_contains_state (set, ATK_STATE_TRANSIENT))
+ {
+ if (state == 0)
+ {
+ g_hash_table_insert (leased_refs, accessible,
+ (gpointer) time (NULL));
+ leased_refs_count++;
+ /* todo: Set to a high number: 5 for dbg. */
+ if (leased_refs_count > 5)
+ expire_old_leases ();
+ }
+ else
+ {
+ g_hash_table_remove (leased_refs, accessible);
+ leased_refs_count--;
+ }
+ }
+ g_object_unref (set);
}
- g_object_unref (set);
- }
- update_accessible (accessible);
+ update_accessible (accessible);
return TRUE;
}
static gboolean
-tree_update_state_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
+tree_update_state_listener (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values, gpointer data)
{
- tree_update_wrapper (signal_hint, n_param_values, param_values, data, tree_update_state_action);
+ tree_update_wrapper (signal_hint, n_param_values, param_values, data,
+ tree_update_state_action);
return TRUE;
}
static gboolean
-tree_update_property_action (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data,
- AtkObject *accessible)
-{
- AtkPropertyValues *values;
- const gchar *pname = NULL;
-
- values = (AtkPropertyValues*) g_value_get_pointer (&param_values[1]);
- pname = values[0].property_name;
- if (strcmp (pname, "accessible-name") == 0 ||
- strcmp (pname, "accessible-description") == 0 ||
- strcmp (pname, "accessible-parent") == 0 ||
- strcmp (pname, "accessible-role") == 0)
- {
- update_accessible (accessible);
- }
- /* Parent value us updated by child-add signal of parent object */
- return TRUE;
+tree_update_property_action (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values,
+ gpointer data, AtkObject * accessible)
+{
+ AtkPropertyValues *values;
+ const gchar *pname = NULL;
+
+ values = (AtkPropertyValues *) g_value_get_pointer (&param_values[1]);
+ pname = values[0].property_name;
+ if (strcmp (pname, "accessible-name") == 0 ||
+ strcmp (pname, "accessible-description") == 0 ||
+ strcmp (pname, "accessible-parent") == 0 ||
+ strcmp (pname, "accessible-role") == 0)
+ {
+ update_accessible (accessible);
+ }
+ /* Parent value us updated by child-add signal of parent object */
+ return TRUE;
}
static gboolean
-tree_update_property_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
+tree_update_property_listener (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values, gpointer data)
{
- tree_update_wrapper (signal_hint, n_param_values, param_values, data, tree_update_property_action);
+ tree_update_wrapper (signal_hint, n_param_values, param_values, data,
+ tree_update_property_action);
return TRUE;
}
static gboolean
-tree_update_children_action (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data,
- AtkObject *accessible)
+tree_update_children_action (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values,
+ gpointer data, AtkObject * accessible)
{
- const gchar *detail = NULL;
- AtkObject *child;
+ const gchar *detail = NULL;
+ AtkObject *child;
- if (signal_hint->detail)
- detail = g_quark_to_string (signal_hint->detail);
+ if (signal_hint->detail)
+ detail = g_quark_to_string (signal_hint->detail);
- if (!strcmp (detail, "add"))
- {
- gpointer child;
- int index = g_value_get_uint (param_values + 1);
- child = g_value_get_pointer (param_values + 2);
+ if (!strcmp (detail, "add"))
+ {
+ gpointer child;
+ int index = g_value_get_uint (param_values + 1);
+ child = g_value_get_pointer (param_values + 2);
- if (!ATK_IS_OBJECT (child))
- {
- child = atk_object_ref_accessible_child (accessible, index);
+ if (!ATK_IS_OBJECT (child))
+ {
+ child = atk_object_ref_accessible_child (accessible, index);
#ifdef SPI_ATK_DEBUG
- non_owned_accessible (child);
+ non_owned_accessible (child);
#endif
- }
- register_subtree (child);
- update_accessible (accessible);
}
- else if (!strcmp (detail, "remove"))
- {
- update_accessible (accessible);
- }
- return TRUE;
+ register_subtree (child);
+ update_accessible (accessible);
+ }
+ else if (!strcmp (detail, "remove"))
+ {
+ update_accessible (accessible);
+ }
+ return TRUE;
}
static gboolean
-tree_update_children_listener (GSignalInvocationHint *signal_hint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
+tree_update_children_listener (GSignalInvocationHint * signal_hint,
+ guint n_param_values,
+ const GValue * param_values, gpointer data)
{
- tree_update_wrapper (signal_hint, n_param_values, param_values, data, tree_update_children_action);
- return TRUE;
+ tree_update_wrapper (signal_hint, n_param_values, param_values, data,
+ tree_update_children_action);
+ return TRUE;
}
/*---------------------------------------------------------------------------*/
static void
-spi_atk_register_toplevel_added (AtkObject *accessible,
- guint index,
- AtkObject *child)
+spi_atk_register_toplevel_added (AtkObject * accessible,
+ guint index, AtkObject * child)
{
g_static_rec_mutex_lock (&registration_mutex);
@@ -838,7 +852,7 @@ spi_atk_register_toplevel_added (AtkObject *accessible,
{
#ifdef SPI_ATK_DEBUG
if (recursion_check_and_set ())
- g_warning ("AT-SPI: Recursive use of registration module");
+ g_warning ("AT-SPI: Recursive use of registration module");
g_debug ("AT-SPI: Toplevel added listener");
#endif
@@ -859,9 +873,8 @@ spi_atk_register_toplevel_added (AtkObject *accessible,
}
static void
-spi_atk_register_toplevel_removed (AtkObject *accessible,
- guint index,
- AtkObject *child)
+spi_atk_register_toplevel_removed (AtkObject * accessible,
+ guint index, AtkObject * child)
{
g_static_rec_mutex_lock (&registration_mutex);
@@ -871,7 +884,7 @@ spi_atk_register_toplevel_removed (AtkObject *accessible,
{
#ifdef SPI_ATK_DEBUG
if (recursion_check_and_set ())
- g_warning ("AT-SPI: Recursive use of registration module");
+ g_warning ("AT-SPI: Recursive use of registration module");
g_debug ("AT-SPI: Toplevel removed listener");
#endif
@@ -889,38 +902,39 @@ spi_atk_register_toplevel_removed (AtkObject *accessible,
* Initializes all of the required D-Bus interfaces.
*/
void
-atk_dbus_initialize (AtkObject *root)
+atk_dbus_initialize (AtkObject * root)
{
if (!ref2ptr)
- ref2ptr = g_hash_table_new(g_direct_hash, g_direct_equal);
+ ref2ptr = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!objects_with_subrefs)
- objects_with_subrefs = g_hash_table_new(g_direct_hash, g_direct_equal);
+ objects_with_subrefs = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!leased_refs)
- leased_refs = g_hash_table_new(g_direct_hash, g_direct_equal);
+ leased_refs = g_hash_table_new (g_direct_hash, g_direct_equal);
#ifdef SPI_ATK_DEBUG
if (g_thread_supported ())
- g_message ("AT-SPI: Threads enabled");
+ g_message ("AT-SPI: Threads enabled");
g_debug ("AT-SPI: Initial Atk tree regisration");
#endif
register_subtree (root);
- atk_add_global_event_listener (tree_update_property_listener, "Gtk:AtkObject:property-change");
- atk_add_global_event_listener (tree_update_children_listener, "Gtk:AtkObject:children-changed");
- atk_add_global_event_listener (tree_update_state_listener, "Gtk:AtkObject:state-change");
+ atk_add_global_event_listener (tree_update_property_listener,
+ "Gtk:AtkObject:property-change");
+ atk_add_global_event_listener (tree_update_children_listener,
+ "Gtk:AtkObject:children-changed");
+ atk_add_global_event_listener (tree_update_state_listener,
+ "Gtk:AtkObject:state-change");
g_signal_connect (root,
"children-changed::add",
- (GCallback) spi_atk_register_toplevel_added,
- NULL);
+ (GCallback) spi_atk_register_toplevel_added, NULL);
g_signal_connect (root,
"children-changed::remove",
- (GCallback) spi_atk_register_toplevel_removed,
- NULL);
+ (GCallback) spi_atk_register_toplevel_removed, NULL);
}
/*END------------------------------------------------------------------------*/