rotation: added code to handle dependent rotation 40/101240/1 accepted/tizen/3.0/common/20161201.135238 accepted/tizen/3.0/ivi/20161201.032244 accepted/tizen/3.0/mobile/20161201.032141 accepted/tizen/3.0/tv/20161201.032207 accepted/tizen/3.0/wearable/20161201.032225 accepted/tizen/common/20161201.135803 accepted/tizen/ivi/20161130.233648 accepted/tizen/mobile/20161130.233526 accepted/tizen/tv/20161130.233610 accepted/tizen/wearable/20161130.233631 submit/tizen/20161130.140306 submit/tizen_3.0/20161130.140438
authorDoyoun Kang <doyoun.kang@samsung.com>
Wed, 30 Nov 2016 12:24:52 +0000 (21:24 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Wed, 30 Nov 2016 12:24:52 +0000 (21:24 +0900)
Change-Id: I694179ff3787bf152bd251a37e37508914f3e855

src/rotation/e_mod_rotation_wl.c

index f25ef6b..8171dce 100644 (file)
@@ -162,7 +162,10 @@ _rot_client_cb_vis_prepare_foreground(void *data, Evas_Object *obj, void *event_
 
    EDBG(ec, "Update Foreground Client '%s'(%p)", ec->icccm.name, ec);
    if (e_policy_visibility_client_is_activity(ec))
-     fg_ec = ec;
+     {
+        EDBG(ec, "Set the fg_ec to %x", e_client_util_win_get(ec));
+        fg_ec = ec;
+     }
 
    _e_client_rotation_zone_set(ec->zone, ec, NULL);
    if (ec->changes.rotation)
@@ -942,6 +945,52 @@ e_client_rotation_next_angle_get(const E_Client *ec)
    return ec->e.state.rot.ang.next;
 }
 
+static E_Client *
+e_client_rotation_find_below(const E_Client *ec)
+{
+   unsigned int x;
+   E_Client *ec2;
+   Eina_Inlist *l;
+
+   E_OBJECT_CHECK_RETURN(ec, NULL);
+   E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
+   if (EINA_INLIST_GET(ec)->prev) //check current layer
+     {
+        for (l = EINA_INLIST_GET(ec)->prev; l; l = l->prev)
+          {
+             ec2 = EINA_INLIST_CONTAINER_GET(l, E_Client);
+
+             if ((ec2->comp_data && ec2->comp_data->mapped) &&
+                 (!e_object_is_del(E_OBJECT(ec2))) &&
+                 (!e_client_util_ignored_get(ec2)) &&
+                 (!ec2->exp_iconify.by_client))
+               return ec2;
+          }
+     }
+
+   /* go down the layers until we find one */
+   if (e_comp_canvas_layer_map(ec->layer) > e_comp_canvas_layer_map(E_LAYER_MAX)) return NULL;
+   x = e_comp_canvas_layer_map(ec->layer);
+   if (x > 0) x--;
+
+   for (; x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
+     {
+        if (!e_comp->layers[x].clients) continue;
+        EINA_INLIST_REVERSE_FOREACH(e_comp->layers[x].clients, ec2)
+          {
+             if (ec2 == ec) continue;
+             if ((ec2->comp_data && ec2->comp_data->mapped) &&
+                 (!e_object_is_del(E_OBJECT(ec2))) &&
+                 (!e_client_util_ignored_get(ec2)) &&
+                 (!ec2->exp_iconify.by_client))
+               return ec2;
+          }
+     }
+   return NULL;
+}
+
 /**
  * @describe
  *  Check if this e_client is rotatable to given angle.
@@ -955,11 +1004,32 @@ e_client_rotation_is_available(const E_Client *ec, int ang)
 {
    Eina_Bool ret = EINA_FALSE;
    unsigned int i;
+   E_Client *below = NULL;
+   Eina_Bool below_rot = EINA_TRUE;
 
    if (ang < 0) return EINA_FALSE;
    if (!ec->e.state.rot.support)
      goto no_hint;
 
+   if (ec->e.state.rot.type == E_CLIENT_ROTATION_TYPE_DEPENDENT)
+     {
+        // check below fullsize window's angle
+        if ((ec->x == ec->zone->x) && (ec->y == ec->zone->y) &&
+            (ec->w == ec->zone->w) && (ec->h == ec->zone->h))
+          {
+             below = e_client_rotation_find_below(ec);
+             if (below)
+               {
+                  below_rot = e_client_rotation_is_available(below, ang);
+                  if (!below_rot)
+                    {
+                       EDBG(ec, "ec's below(ec:%p, win:%x) can not rotate to angle [%d]", below, e_client_util_win_get(below), ang);
+                       goto no_hint;
+                    }
+               }
+          }
+     }
+
    if (ec->e.state.rot.preferred_rot == -1)
      {
         if (ec->e.state.rot.available_rots &&
@@ -1449,7 +1519,10 @@ _rot_hook_client_del(void *d EINA_UNUSED, E_Client *ec)
      }
 
    if (fg_ec == ec)
-     fg_ec = NULL;
+     {
+        EDBG(ec, "Set the fg_ec to NULL");
+        fg_ec = NULL;
+     }
 }
 
 static void
@@ -1679,7 +1752,10 @@ _rot_intercept_hook_show_helper(void *d EINA_UNUSED, E_Client *ec)
      return EINA_FALSE;
 
    if (e_policy_visibility_client_is_activity(ec))
-     fg_ec = ec;
+     {
+        EDBG(ec, "Set the fg_ec to %x", e_client_util_win_get(ec));
+        fg_ec = ec;
+     }
 
    _e_client_rotation_zone_set(ec->zone, ec, NULL);
    if (ec->changes.rotation)
@@ -1703,7 +1779,10 @@ _rot_intercept_hook_hide(void *d EINA_UNUSED, E_Client *ec)
    ec->e.state.rot.pending_show = 0;
 
    if (fg_ec == ec)
-     fg_ec = NULL;
+     {
+        EDBG(ec, "Set the fg_ec to NULL");
+        fg_ec = NULL;
+     }
 
    // for rotating ec in the force_update_list
    _e_client_rotation_zone_set(ec->zone, fg_ec, ec);