rotation: change code to use e_client_geometry_get not ec's x,y,w,h directly 26/248426/1
authorDoyoun Kang <doyoun.kang@samsung.com>
Thu, 26 Nov 2020 10:07:52 +0000 (19:07 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Thu, 26 Nov 2020 10:07:52 +0000 (19:07 +0900)
Change-Id: Id54888b1760c2d0cd20bf4c5b9169cc528c693bd

src/rotation/e_mod_rotation_wl.c

index 51444e5..3d5d2d0 100644 (file)
@@ -151,10 +151,10 @@ static void      _e_zone_event_rotation_change_end_free(void *data, void *ev);
 static void      _e_zone_event_rotation_change_cancel_free(void *data, void *ev);
 
 /* e_client_roation functions */
-static Eina_Bool  e_client_rotation_is_progress(const E_Client *ec);
-static int        e_client_rotation_curr_angle_get(const E_Client *ec);
-static int        e_client_rotation_next_angle_get(const E_Client *ec);
-static Eina_Bool  e_client_rotation_is_available(const E_Client *ec, int ang);
+static Eina_Bool  e_client_rotation_is_progress(E_Client *ec);
+static int        e_client_rotation_curr_angle_get(E_Client *ec);
+static int        e_client_rotation_next_angle_get(E_Client *ec);
+static Eina_Bool  e_client_rotation_is_available(E_Client *ec, int ang);
 static Eina_Bool  e_client_rotation_set(E_Client *ec, int rotation);
 static void       e_client_rotation_change_request(E_Client *ec, int rotation);
 
@@ -257,10 +257,25 @@ _rot_client_check_will_visible(E_Client *ec)
    E_Client *above = NULL;
    Eina_Bool will_visible = EINA_TRUE;
 
+   int ec_x, ec_y, ec_w, ec_h;
+   int above_x, above_y, above_w, above_h;
+
+   ec_x = ec->x;
+   ec_y = ec->y;
+   ec_w = ec->w;
+   ec_h = ec->h;
+   e_client_geometry_get(ec, &ec_x, &ec_y, &ec_w, &ec_h);
+
    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;
+
+        above_x = above->x;
+        above_y = above->y;
+        above_w = above->w;
+        above_h = above->h;
+        e_client_geometry_get(above, &above_x, &above_y, &above_w, &above_h);
+        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)
           {
@@ -1026,11 +1041,20 @@ _e_client_rotation_angle_is_allowed(E_Client *ec, int angle)
 static Eina_Bool
 _e_client_rotation_check_ec_size_and_type(E_Zone *zone, E_Client *ec)
 {
+   int ec_x, ec_y, ec_w, ec_h;
+
    if (!zone) return EINA_FALSE;
    if (!ec) return EINA_FALSE;
 
-   if ((ec->x == zone->x) && (ec->y == zone->y) &&
-       (ec->w == zone->w) && (ec->h == zone->h) &&
+   ec_x = ec->x;
+   ec_y = ec->y;
+   ec_w = ec->w;
+   ec_h = ec->h;
+
+   e_client_geometry_get(ec, &ec_x, &ec_y, &ec_w, &ec_h);
+
+   if ((ec_x == zone->x) && (ec_y == zone->y) &&
+       (ec_w == zone->w) && (ec_h == zone->h) &&
        (ec->e.state.rot.type == E_CLIENT_ROTATION_TYPE_NORMAL))
      {
         return EINA_TRUE;
@@ -1573,7 +1597,7 @@ _e_zone_event_rotation_change_cancel_free(void *data __UNUSED__,
  *             EINA_TRUE      the state that rotating.
  */
 static Eina_Bool
-e_client_rotation_is_progress(const E_Client *ec)
+e_client_rotation_is_progress(E_Client *ec)
 {
    if (!ec) return EINA_FALSE;
 
@@ -1590,7 +1614,7 @@ e_client_rotation_is_progress(const E_Client *ec)
  * @return     int            current angle
  */
 static int
-e_client_rotation_curr_angle_get(const E_Client *ec)
+e_client_rotation_curr_angle_get(E_Client *ec)
 {
    E_OBJECT_CHECK_RETURN(ec, -1);
    E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, -1);
@@ -1605,7 +1629,7 @@ e_client_rotation_curr_angle_get(const E_Client *ec)
  * @return     int            be replaced angle.
  */
 static int
-e_client_rotation_next_angle_get(const E_Client *ec)
+e_client_rotation_next_angle_get(E_Client *ec)
 {
    E_OBJECT_CHECK_RETURN(ec, -1);
    E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, -1);
@@ -1614,7 +1638,7 @@ e_client_rotation_next_angle_get(const E_Client *ec)
 }
 
 static E_Client *
-e_client_rotation_find_below(const E_Client *ec)
+e_client_rotation_find_below(E_Client *ec)
 {
    unsigned int x;
    E_Client *ec2;
@@ -1673,12 +1697,13 @@ e_client_rotation_find_below(const E_Client *ec)
  *             EINA_TRUE      can be rotated.
  */
 static Eina_Bool
-e_client_rotation_is_available(const E_Client *ec, int ang)
+e_client_rotation_is_available(E_Client *ec, int ang)
 {
    Eina_Bool ret = EINA_FALSE;
    unsigned int i;
    E_Client *below = NULL;
    Eina_Bool below_rot = EINA_TRUE;
+   int ec_x, ec_y, ec_w, ec_h;
 
    if (ang < 0) return EINA_FALSE;
    if (!ec->e.state.rot.support)
@@ -1687,8 +1712,14 @@ e_client_rotation_is_available(const E_Client *ec, int ang)
    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))
+        ec_x = ec->x;
+        ec_y = ec->y;
+        ec_w = ec->w;
+        ec_h = ec->h;
+        e_client_geometry_get(ec, &ec_x, &ec_y, &ec_w, &ec_h);
+
+        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)
@@ -2458,12 +2489,19 @@ _rot_hook_eval_end(void *d EINA_UNUSED, E_Client *ec)
    if (ec->changes.rotation)
      {
         E_Zone *zone = ec->zone;
+        int ec_x, ec_y, ec_w, ec_h;
 
         if (ec->moving) e_client_act_move_end(ec, NULL);
 
+        ec_x = ec->x;
+        ec_y = ec->y;
+        ec_w = ec->w;
+        ec_h = ec->h;
+        e_client_geometry_get(ec, &ec_x, &ec_y, &ec_w, &ec_h);
+
         if ((!zone->rot.block.mod_count) &&
             ((!evas_object_visible_get(ec->frame)) ||
-             (!E_INTERSECTS(ec->x, ec->y, ec->w, ec->h, zone->x, zone->y, zone->w, zone->h))))
+             (!E_INTERSECTS(ec_x, ec_y, ec_w, ec_h, zone->x, zone->y, zone->w, zone->h))))
           {
              // async list add
              rot.async_list = eina_list_append(rot.async_list, ec);