[Screen Reader] base_root's type is changed GList 09/79109/3
authorJunsuChoi <jsuya.choi@samsung.com>
Fri, 8 Jul 2016 07:39:55 +0000 (16:39 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Wed, 13 Jul 2016 06:09:15 +0000 (15:09 +0900)
   When view is changed, base_root is managed by GList.
   This commit make things running even if there are more than 2 views.

Change-Id: I0268f33ab59cfdde15ddbbbb0a72532497d5dae5

src/app_tracker.c
src/navigator.c

index af879f0e80ea62fc6fa35c6bde7adf4c358999cf..af8eafa45cc2b63efea285793b4543f63ae7e375 100644 (file)
@@ -23,8 +23,8 @@
 #endif
 
 typedef struct {
-       AtspiAccessible *base_root;
        AtspiAccessible *root;
+       GList *base_roots;
        GList *callbacks;
        guint timer;
 } SubTreeRootData;
@@ -294,27 +294,27 @@ static void _on_atspi_event_cb(const AtspiEvent * event)
                g_object_unref(new_highlighted_obj);
                new_highlighted_obj = NULL;
        }
-
        if (!strcmp("object:state-changed:showing", event->type) ||
                !strcmp("object:state-changed:visible", event->type) ||
                !strcmp("object:state-changed:defunct", event->type)) {
                for (l = _roots; l != NULL; l = l->next) {
                        std = l->data;
+                       GList *l_base_root = g_list_last(std->base_roots);
 
-                       if (!_object_has_showing_state(std->root) && std->base_root) {
-                               std->root = std->base_root;
-                               std->base_root = NULL;
+                       if (!_object_has_showing_state(std->root) && l_base_root->data != NULL ) {
+                               std->root = l_base_root->data;
+                               std->base_roots = g_list_remove(std->base_roots, std->root);
                        }
 
                        if (_is_descendant(std->root, event->source)) {
                                if (std->timer)
                                        g_source_remove(std->timer);
-                                       DEBUG("Before Checking if modal is showing");
-                                       if (_object_has_modal_state(event->source)) {
-                                               DEBUG("Object is modal");
-                                               std->base_root = std->root;
-                                               std->root = event->source;
-                                       }
+                               DEBUG("Before Checking if modal is showing");
+                               if (_object_has_modal_state(event->source)) {
+                                       DEBUG("Object is modal");
+                                       std->base_roots = g_list_append(std->base_roots, std->root);
+                                       std->root = event->source;
+                               }
                                std->timer = g_timeout_add(APP_TRACKER_INVACTIVITY_TIMEOUT, _on_timeout_cb, std);
                        }
                }
@@ -416,10 +416,12 @@ void app_tracker_callback_register(AtspiAccessible * app, AppTrackerEventCB cb,
        if (!rd) {
                rd = g_new(SubTreeRootData, 1);
                rd->root = app;
-               rd->base_root = NULL;
                rd->callbacks = NULL;
                rd->timer = 0;
                _roots = g_list_append(_roots, rd);
+               rd->base_roots = NULL;
+               AtspiAccessible *t = NULL;
+               rd->base_roots = g_list_append(rd->base_roots, t);
        }
 
        cd = g_new(EventCallbackData, 1);
@@ -443,7 +445,7 @@ void app_tracker_callback_unregister(AtspiAccessible * app, AppTrackerEventCB cb
        SubTreeRootData *std = NULL;
 
        for (l = _roots; l != NULL; l = l->next) {
-               if (((SubTreeRootData *) l->data)->root == app || ((SubTreeRootData *) l->data)->base_root == app) {
+               if (((SubTreeRootData *) l->data)->root == app || ((SubTreeRootData *) l->data)->base_roots->data == app) {
                        std = l->data;
                        break;
                }
index 73740c5e451ee75172734ab2f14945aca4919282..9990ee20bfecebc12e2a5a30476776dfa6e22b1b 100755 (executable)
@@ -2372,12 +2372,12 @@ static void on_window_activate(void *data, AtspiAccessible * window)
                AtspiAccessible *modal_descendant = _get_modal_descendant(window);
                app_tracker_callback_register(modal_descendant ? modal_descendant : window, _view_content_changed, NULL);
                _view_content_changed(modal_descendant ? modal_descendant : window, NULL);
+               top_window = modal_descendant ? modal_descendant : window;
                g_object_unref(modal_descendant);
        } else {
                flat_navi_context_free(context);
                ERROR("No top window found!");
        }
-       top_window = window;
        DEBUG("END");
 }