return ret;
}
+static bool _return_to_old_root(AtspiAccessible *old_root)
+{
+ AtspiRole role = atspi_accessible_get_role(old_root, NULL);
+
+ // TODO: check attributes?
+ return (role == ATSPI_ROLE_COMBO_BOX);
+}
+
int flat_navi_context_setup(FlatNaviContext *ctx, AtspiAccessible *root)
{
+ AtspiAccessible *old_root;
+
DEBUG("START");
if (!ctx) {
DEBUG("END -- no context");
g_free(id);
g_free(root_name);
- g_object_unref(ctx->root);
+ old_root = ctx->root;
ctx->root = root;
g_object_ref(ctx->root);
g_object_unref(ctx->current);
- ctx->current = _first(ctx);
+ if (_return_to_old_root(old_root)) {
+ DEBUG("Will return to old root");
+ ctx->current = old_root;
+ } else {
+ g_object_unref(old_root);
+ ctx->current = _first(ctx);
+ }
ctx->last_entry = LAST_ENTRY_NONE;
DEBUG("END");