libatspiincludedir = $(includedir)/at-spi-2.0/atspi
-libatspiinclude_HEADERS = \
+libatspiinclude_HEADERS = \
atspi.h \
atspi-accessible.h \
atspi-action.h \
if (!_atspi_dbus_get_property (obj, atspi_interface_accessible, "Name", error,
"s", &obj->name))
return g_strdup ("");
- obj->cached_properties |= ATSPI_CACHE_NAME;
+ _atspi_accessible_add_cache (obj, ATSPI_CACHE_NAME);
}
return g_strdup (obj->name);
}
"Description", error, "s",
&obj->description))
return g_strdup ("");
- obj->cached_properties |= ATSPI_CACHE_DESCRIPTION;
+ _atspi_accessible_add_cache (obj, ATSPI_CACHE_DESCRIPTION);
}
return g_strdup (obj->description);
}
dbus_message_iter_recurse (&iter, &iter_variant);
obj->accessible_parent = _atspi_dbus_return_accessible_from_iter (&iter_variant);
dbus_message_unref (reply);
- obj->cached_properties |= ATSPI_CACHE_PARENT;
+ _atspi_accessible_add_cache (obj, ATSPI_CACHE_PARENT);
}
if (!obj->accessible_parent)
return NULL;
/* TODO: Make this a property */
if (_atspi_dbus_call (obj, atspi_interface_accessible, "GetRole", error, "=>u", &role))
{
- obj->cached_properties |= ATSPI_CACHE_ROLE;
obj->role = role;
+ _atspi_accessible_add_cache (obj, ATSPI_CACHE_ROLE);
}
}
return obj->role;
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);
dbus_message_iter_init (reply, &iter);
_atspi_dbus_set_interfaces (accessible, &iter);
dbus_message_unref (reply);
+ _atspi_accessible_add_cache (accessible, ATSPI_CACHE_INTERFACES);
}
n = _atspi_get_iface_num (interface_name);
return accessible;
}
+
+/**
+ * atspi_accessible_set_cache_mask:
+ *
+ * @accessible: The #AtspiAccessible to operate on. Must be the desktop or
+ * the root of an application.
+ * @mask: An #AtspiCache specifying a bit mask of the types of data to cache.
+ *
+ * Sets the type of data to cache for accessibles.
+ * If this is not set for an application or is reset to ATSPI_CACHE_UNDEFINED,
+ * then the desktop's cache flag will be used.
+ * If the desktop's cache flag is also undefined, then all possible data will
+ * be cached.
+ * This function is intended to work around bugs in toolkits where the proper
+ * events are not raised / to aid in testing for such bugs.
+ *
+ * Note: This function has no effect on data that has already been cached.
+ **/
+void
+atspi_accessible_set_cache_mask (AtspiAccessible *accessible, AtspiCache mask)
+{
+ g_return_if_fail (accessible != NULL);
+ g_return_if_fail (accessible->parent.app != NULL);
+ g_return_if_fail (accessible == accessible->parent.app->root);
+ accessible->parent.app->cache = mask;
+}
+
+void
+_atspi_accessible_add_cache (AtspiAccessible *accessible, AtspiCache flag)
+{
+ AtspiCache mask = accessible->parent.app->cache;
+
+ if (mask == ATSPI_CACHE_UNDEFINED &&
+ accessible->parent.app->root->accessible_parent)
+ {
+ AtspiAccessible *desktop = atspi_get_desktop (0);
+ mask = desktop->parent.app->cache;
+ g_object_unref (desktop);
+ }
+
+ if (mask == ATSPI_CACHE_UNDEFINED)
+ mask = ATSPI_CACHE_ALL;
+
+ accessible->cached_properties |= flag & mask;
+}
AtspiValue * atspi_accessible_get_value (AtspiAccessible *obj);
GArray * atspi_accessible_get_interfaces (AtspiAccessible *obj);
+
+void atspi_accessible_set_cache_mask (AtspiAccessible *accessible, AtspiCache mask);
+
+/* private */
+void _atspi_accessible_add_cache (AtspiAccessible *accessible, AtspiCache flag);
#endif /* _ATSPI_ACCESSIBLE_H_ */
char *bus_name;
DBusConnection *bus;
struct _AtspiAccessible *root;
+ AtspiCache cache;
};
typedef struct _AtspiApplicationClass AtspiApplicationClass;
*/
#define ATSPI_ROLE_COUNT (90+1)
+typedef enum
+{
+ ATSPI_CACHE_PARENT = 0x0001,
+ ATSPI_CACHE_CHILDREN = 0x0002,
+ ATSPI_CACHE_NAME = 0x0004,
+ ATSPI_CACHE_DESCRIPTION = 0x0008,
+ ATSPI_CACHE_STATES = 0x0010,
+ ATSPI_CACHE_ROLE = 0x0020,
+ ATSPI_CACHE_INTERFACES = 0x0040,
+ ATSPI_CACHE_ALL = 0x7fffffff,
+ ATSPI_CACHE_UNDEFINED = 0x80000000
+} AtspiCache;
#ifdef __cplusplus
}
if (G_VALUE_HOLDS (&event->any_data, ATSPI_TYPE_ACCESSIBLE))
{
event->source->accessible_parent = g_value_dup_object (&event->any_data);
- event->source->cached_properties |= ATSPI_CACHE_PARENT;
+ _atspi_accessible_add_cache (event->source, ATSPI_CACHE_PARENT);
}
else
{
if (G_VALUE_HOLDS_STRING (&event->any_data))
{
event->source->name = g_value_dup_string (&event->any_data);
- event->source->cached_properties |= ATSPI_CACHE_NAME;
+ _atspi_accessible_add_cache (event->source, ATSPI_CACHE_NAME);
}
else
{
if (G_VALUE_HOLDS_STRING (&event->any_data))
{
event->source->description = g_value_dup_string (&event->any_data);
- event->source->cached_properties |= ATSPI_CACHE_DESCRIPTION;
+ _atspi_accessible_add_cache (event->source, ATSPI_CACHE_DESCRIPTION);
}
else
{
#include "dbind/dbind.h"
-#define ATSPI_CACHE_PARENT 0x0001
-#define ATSPI_CACHE_CHILDREN 0x0002
-#define ATSPI_CACHE_NAME 0x0004
-#define ATSPI_CACHE_DESCRIPTION 0x0008
-#define ATSPI_CACHE_STATES 0x0010
-#define ATSPI_CACHE_ROLE 0x0020
-#define ATSPI_CACHE_INTERFACES 0x0040
-
typedef struct _AtspiReference AtspiReference;
struct _AtspiReference
{
app->bus_name = bus_name_dup;
app->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
app->bus = dbus_connection_ref (_atspi_bus ());
+ app->cache = ATSPI_CACHE_UNDEFINED;
g_hash_table_insert (app_hash, bus_name_dup, app);
dbus_error_init (&error);
message = dbus_message_new_method_call (bus_name, atspi_path_root,
_atspi_dbus_set_state (accessible, &iter_struct);
dbus_message_iter_next (&iter_struct);
- accessible->cached_properties |= ATSPI_CACHE_NAME | ATSPI_CACHE_ROLE | ATSPI_CACHE_PARENT;
+ _atspi_accessible_add_cache (accessible, ATSPI_CACHE_NAME | ATSPI_CACHE_ROLE |
+ ATSPI_CACHE_PARENT | ATSPI_CACHE_DESCRIPTION);
if (!atspi_state_set_contains (accessible->states,
ATSPI_STATE_MANAGES_DESCENDANTS))
- accessible->cached_properties |= ATSPI_CACHE_CHILDREN;
+ _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
* the one provided for us anymore */
accessible->interfaces |= (1 << n);
dbus_message_iter_next (&iter_array);
}
- accessible->cached_properties |= ATSPI_CACHE_INTERFACES;
+ _atspi_accessible_add_cache (accessible, ATSPI_CACHE_INTERFACES);
}
void
else
accessible->states->states = val;
}
- accessible->cached_properties |= ATSPI_CACHE_STATES;
+ _atspi_accessible_add_cache (accessible, ATSPI_CACHE_STATES);
}
GQuark