e_policy: added code to send stack change event 70/89770/1
authorDoyoun Kang <doyoun.kang@samsung.com>
Tue, 27 Sep 2016 02:44:35 +0000 (11:44 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Tue, 27 Sep 2016 02:44:35 +0000 (11:44 +0900)
Change-Id: Iba8810530120200d5329ee7ceb8b74e75aa012fb

src/bin/e_policy.c

index fb923a8..b9d92b9 100644 (file)
@@ -1059,6 +1059,58 @@ _e_policy_cb_client_resize(void *data EINA_UNUSED, int type EINA_UNUSED, void *e
    return ECORE_CALLBACK_PASS_ON;
 }
 
+static void
+_e_policy_client_stack_change_send(E_Client *ec)
+{
+   E_Client *above = NULL;
+   E_Client *below = NULL;
+   int above_pid = -1;
+   int below_pid = -1;
+   char above_pid_s[4096] = {0,};
+   char below_pid_s[4096] = {0,};
+
+   above = e_client_above_get(ec);
+   while (above)
+     {
+        if ((!e_object_is_del(E_OBJECT(above))) &&
+            (!e_client_util_ignored_get(above)) &&
+            (above->visible) &&
+            (above->frame))
+          break;
+
+        above = e_client_above_get(above);
+     }
+
+   below = e_client_below_get(ec);
+   while (below)
+     {
+        if ((!e_object_is_del(E_OBJECT(below))) &&
+            (!e_client_util_ignored_get(below)) &&
+            (below->visible) &&
+            (below->frame))
+          break;
+
+        below = e_client_below_get(below);
+     }
+
+   if (above) above_pid = above->netwm.pid;
+   if (below) below_pid = below->netwm.pid;
+
+   eina_convert_itoa(above_pid, above_pid_s);
+   eina_convert_itoa(below_pid, below_pid_s);
+   ELOGF("TZPOL", "Send stack change.  above(win:%x, pid:%s), below(win:%x, pid:%s)",
+         ec->pixmap, ec, e_client_util_win_get(above), above_pid_s, e_client_util_win_get(below), below_pid_s);
+
+   Eina_List *options = NULL;
+
+   options = eina_list_append(options, above_pid_s);
+   options = eina_list_append(options, below_pid_s);
+
+   e_policy_aux_message_send(ec, "stack_changed", "pid", options);
+
+   eina_list_free(options);
+}
+
 static Eina_Bool
 _e_policy_cb_client_stack(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
 {
@@ -1069,6 +1121,9 @@ _e_policy_cb_client_stack(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev
    /* calculate e_client visibility */
    e_client_visibility_calculate();
 
+   // send stack change event
+   _e_policy_client_stack_change_send(ev->ec);
+
    return ECORE_CALLBACK_PASS_ON;
 }