rotation: if there is no clients to rotate, we set angle to fg_ec's angle 66/117266/1
authorDuna Oh <duna.oh@samsung.com>
Fri, 3 Mar 2017 12:18:56 +0000 (21:18 +0900)
committerDuna Oh <duna.oh@samsung.com>
Fri, 3 Mar 2017 12:19:20 +0000 (21:19 +0900)
Signed-off-by: Duna Oh <duna.oh@samsung.com>
Change-Id: I96ff418ac8de6dbd02cd82f10cf7152298aa1e7e

src/rotation/e_mod_rotation_wl.c

index 6748a5e..e1ebabd 100644 (file)
@@ -858,6 +858,27 @@ _e_client_rotation_list_remove(E_Client *ec)
    ec->changes.rotation = 0;
 }
 
+static Eina_Bool
+_e_client_rotation_angle_is_allowed(E_Client *ec, int angle)
+{
+   if ((!_camera_check(ec)) &&
+       (!e_mod_pol_conf_rot_enable_get(angle)))
+     {
+        EDBG(ec, "CHECK dependent '%s'(%p) ang:%d rot.type:%d dependent:%d",
+             ec->icccm.name, ec, angle,
+             ec->e.state.rot.type,
+             E_CLIENT_ROTATION_TYPE_DEPENDENT);
+
+        /* check whether the window is 32bit and has the dependent rotation type.
+        * if true, then it can be rotated according to below normal window
+        * even if current zone angle is not allowed by configuration value.
+        */
+        if (!((ec->argb) && (e_client_rotation_is_available(ec, angle))))
+          return EINA_FALSE;
+     }
+   return EINA_TRUE;
+}
+
 /* TODO need to optimize */
 static Eina_Bool
 _e_client_rotation_zone_set(E_Zone *zone, E_Client *include_ec, E_Client *exclude_ec)
@@ -896,8 +917,11 @@ _e_client_rotation_zone_set(E_Zone *zone, E_Client *include_ec, E_Client *exclud
                  ((include_ec == ec) &&
                   (evas_object_layer_get(ec->frame) >= evas_object_layer_get(bg_ec->frame))))
                {
-                  EDBG(ec, "Append to rotation target list");
-                  target_list = eina_list_append(target_list, ec);
+                  if (_e_client_rotation_angle_is_allowed(ec, cur_angle))
+                    {
+                       EDBG(ec, "Append to rotation target list");
+                       target_list = eina_list_append(target_list, ec);
+                    }
                }
              else
                {
@@ -990,31 +1014,26 @@ _e_client_rotation_zone_set(E_Zone *zone, E_Client *include_ec, E_Client *exclud
                     }
                }
 
-             /* TODO: Fix me. To prevent rotation of 180 degrees for normal app */
-             if ((!_camera_check(ec)) &&
-                 (!e_mod_pol_conf_rot_enable_get(cur_angle)))
+             if (_e_client_rotation_angle_is_allowed(ec, cur_angle))
                {
-                  EDBG(ec, "CHECK dependent '%s'(%p) ang:%d rot.type:%d dependent:%d",
-                       ec->icccm.name, ec, cur_angle,
-                       ec->e.state.rot.type,
-                       E_CLIENT_ROTATION_TYPE_DEPENDENT);
-
-                  /* check whether the window is 32bit and has the dependent rotation type.
-                   * if true, then it can be rotated according to below normal window
-                   * even if current zone angle is not allowed by configuration value.
-                   */
-                  if (!((ec->argb) && (e_client_rotation_is_available(ec, cur_angle))))
-                    continue;
+                  EDBG(ec, "Append Rotation List '%s'(%p)", ec->icccm.name, ec);
+                  target_list = eina_list_append(target_list, ec);
                }
-
-             EDBG(ec, "Append Rotation List '%s'(%p)", ec->icccm.name, ec);
-             target_list = eina_list_append(target_list, ec);
              if (ec == fg_ec)
                bg_ec = ec;
           }
      }
 
    angle = cur_angle;
+
+   if (!target_list || (target_list && eina_list_count(target_list) == 0))
+     {
+        DBG("Duna Failed to set rotation with zone: target_list is empty. angle: %d", angle);
+        if (fg_ec)
+          angle = _e_client_rotation_curr_next_get(fg_ec);
+        can_rotate = EINA_FALSE;
+     }
+
    EINA_LIST_FOREACH(target_list, l, ec)
      {
         if (!e_client_rotation_is_available(ec, angle))
@@ -1471,6 +1490,7 @@ e_client_rotation_set(E_Client *ec, int rotation)
 
    // in case same with current angle.
    curr_rot = e_client_rotation_curr_angle_get(ec);
+   EDBG(ec, "Client Rotation name:%s, curr_rot:%d, rotation:%d", ec->icccm.name?:"NULL", curr_rot, rotation);
    if (curr_rot == rotation)
      {
         if (e_client_rotation_is_progress(ec))