fire app_tracker event only when specific object event occurs
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Tue, 8 Sep 2015 13:59:16 +0000 (15:59 +0200)
committerTomasz Olszak <t.olszak@samsung.com>
Wed, 9 Sep 2015 09:49:59 +0000 (18:49 +0900)
This patch fixes triggering additional app tracker events when
two "object:state-changed:highlighted" occured.

Change-Id: Iaf32f6a35146f972048a1297504bcfda52729a5d

src/app_tracker.c

index 3a94a29..8d3c557 100644 (file)
@@ -133,7 +133,6 @@ static void _print_event_object_info(const AtspiEvent * event)
 
 static void _on_atspi_event_cb(const AtspiEvent * event)
 {
-       DEBUG("START");
        GList *l;
        SubTreeRootData *std;
 
@@ -171,32 +170,28 @@ static void _on_atspi_event_cb(const AtspiEvent * event)
                new_highlighted_obj = NULL;
        }
 
-       for (l = _roots; l != NULL; l = l->next) {
-               std = l->data;
-
-               if (!_object_has_showing_state(std->root) && std->base_root) {
-                       std->root = std->base_root;
-                       std->base_root = NULL;
-               }
-
-               if (_is_descendant(std->root, event->source)) {
-                       if (std->timer)
-                               g_source_remove(std->timer);
-
-                       DEBUG("Before Checking if modal is showing");
-
-                       if (!strcmp("object:state-changed:showing", event->type)) {
-
-                               DEBUG("Object is showing");
+       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;
 
-                               if (_object_has_modal_state(event->source)) {
-                                       DEBUG("Object is modal");
+                       if (!_object_has_showing_state(std->root) && std->base_root) {
+                               std->root = std->base_root;
+                               std->base_root = NULL;
+                       }
 
-                                       std->base_root = std->root;
-                                       std->root = event->source;
-                               }
+                       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;
+                                       }
+                               std->timer = g_timeout_add(APP_TRACKER_INVACTIVITY_TIMEOUT, _on_timeout_cb, std);
                        }
-                       std->timer = g_timeout_add(APP_TRACKER_INVACTIVITY_TIMEOUT, _on_timeout_cb, std);
                }
        }
 }