Previously, caching was always disabled unless atspi_event_main() was
called to start a main loop, since we need to handle the case of a
simple application/script that performs an action and then sleeps rather
than entering a main loop. In such a case, libatspi will not be able to
detect that an event has been fired to update the cache, so caching
should be disabled. However, an application may want to start a main
loop through some other mechanism than by calling atspi-event_main(),
and caching should be done in such a case. So we'll assume that, if
atspi_accessible_set_cache_mask is called, then the application expects
caching to work and will run a main loop one way or another. Note that
it is possible for a script to run a main loop in some instances but not
others, and, in such a case, if it is not using atspi_event_main(), then
it should set caching to ATSPI_CACHE_NONE when not in a main loop and
back to ATSPI_CACHE_DEFAULT when running a main loop.
#include "atspi-private.h"
#include <string.h>
#include "atspi-private.h"
#include <string.h>
+static gboolean enable_caching = FALSE;
+
static void
atspi_action_interface_init (AtspiAction *action)
{
static void
atspi_action_interface_init (AtspiAction *action)
{
g_return_if_fail (accessible->parent.app != NULL);
g_return_if_fail (accessible == accessible->parent.app->root);
accessible->parent.app->cache = mask;
g_return_if_fail (accessible->parent.app != NULL);
g_return_if_fail (accessible == accessible->parent.app->root);
accessible->parent.app->cache = mask;
AtspiCache result = accessible->cached_properties & mask & flag;
if (accessible->states && atspi_state_set_contains (accessible->states, ATSPI_STATE_TRANSIENT))
return FALSE;
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 && !atspi_no_cache);
+ return (result != 0 && (atspi_main_loop || enable_caching) &&
+ !atspi_no_cache);