rotation: add code to check whether ec can be visible while setting rotation fg_ec 73/119373/4
authorDoyoun Kang <doyoun.kang@samsung.com>
Thu, 16 Mar 2017 13:31:14 +0000 (22:31 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Fri, 17 Mar 2017 04:34:12 +0000 (21:34 -0700)
There was a bug that the fg_ec is always set to preparing foreground (aka uniconifying) window.
So we added code to check if it can be shown or not.

Change-Id: Ia8fc202aa1bfab4808dcd0f48da2bfd65fc0d11d

src/rotation/e_mod_rotation_wl.c

index c7ee70b..4ff3e44 100644 (file)
@@ -244,6 +244,38 @@ _no_active_lockscreen_check(E_Client *ec)
    return EINA_TRUE;
 }
 
+static Eina_Bool
+_rot_client_check_will_visible(E_Client *ec)
+{
+   E_Client *above = NULL;
+   Eina_Bool will_visible = EINA_TRUE;
+
+   for (above = e_client_above_get(ec); above; above = e_client_above_get(above))
+     {
+        if (e_client_util_ignored_get(above)) continue;
+        if (!E_CONTAINS(above->x, above->y, above->w, above->h, ec->x, ec->y, ec->w, ec->h)) continue;
+
+        if (above->visibility.obscured == E_VISIBILITY_UNOBSCURED)
+          {
+             if (!above->argb)
+               {
+                  will_visible = EINA_FALSE;
+                  break;
+               }
+             else
+               {
+                  if (above->visibility.opaque > 0)
+                    {
+                       will_visible = EINA_FALSE;
+                       break;
+                    }
+               }
+          }
+     }
+
+   return will_visible;
+}
+
 static void
 _rot_client_cb_vis_prepare_foreground(void *data, Evas_Object *obj, void *event_info)
 {
@@ -259,8 +291,19 @@ _rot_client_cb_vis_prepare_foreground(void *data, Evas_Object *obj, void *event_
         EDBG(ec, "Check ec %x to set fg_ec", e_client_util_win_get(ec));
         if (_no_active_lockscreen_check(ec))
           {
-             EDBG(ec, "Set the fg_ec to %x", e_client_util_win_get(ec));
-             fg_ec = ec;
+             if (ec->exp_iconify.not_raise)
+               {
+                  if (_rot_client_check_will_visible(ec))
+                    {
+                       EDBG(ec, "Set the fg_ec to %x", e_client_util_win_get(ec));
+                       fg_ec = ec;
+                    }
+               }
+             else
+               {
+                  EDBG(ec, "Set the fg_ec to %x", e_client_util_win_get(ec));
+                  fg_ec = ec;
+               }
 
              if (_camera_check(ec))
                _unlock_rot_for_fg_app(ec->zone);
@@ -413,6 +456,7 @@ _e_tizen_rotation_set_preferred_angle_cb(struct wl_client *client,
    if (!ec)
      return;
 
+   ELOGF("ROTATION", "Request to set Preferred angle:%d", ec->pixmap, ec, TIZEN_ROTATION_ANGLE_TO_INT(angle));
    if ((angle != TIZEN_ROTATION_ANGLE_NONE) &&
        (!e_mod_pol_conf_rot_enable_get(TIZEN_ROTATION_ANGLE_TO_INT(angle))))
      {
@@ -426,7 +470,7 @@ _e_tizen_rotation_set_preferred_angle_cb(struct wl_client *client,
    if (TIZEN_ROTATION_ANGLE_TO_INT(angle) == e_client_rotation_curr_angle_get(ec))
      {
         ec->e.state.rot.preferred_rot = TIZEN_ROTATION_ANGLE_TO_INT(angle);
-        EDBG(ec, "preferred angle is same as current angle. don't need to fetch.");
+        EDBG(ec, "preferred angle is same as current angle (%d). don't need to fetch.", ec->e.state.rot.preferred_rot);
         return;
      }
 
@@ -964,9 +1008,9 @@ _e_client_rotation_zone_set(E_Zone *zone, E_Client *include_ec, E_Client *exclud
           }
         else
           {
-             ELOGF("ROTATION", "   bg_ec:%p CHECK %s(%p) parent:%p vis:%d",
-                   NULL, NULL, bg_ec, ec->icccm.name, ec, ec->parent,
-                   ec->visibility.obscured);
+             ELOGF("ROTATION", "   fg_ec:%x, bg_ec:%p CHECK %s(%p) parent:%p vis:%d argb:%d opaque:%d",
+                   ec->pixmap, ec, e_client_util_win_get(fg_ec), bg_ec, ec->icccm.name, ec, ec->parent,
+                   ec->visibility.obscured, ec->argb, ec->visibility.opaque);
              /* if already found background client,
               * that means this client is placed under background client */
              if (bg_ec)