rotation: add code to handle active angle of zone 53/114253/1 accepted/tizen/3.0/common/20170214.180232 accepted/tizen/3.0/ivi/20170213.224942 accepted/tizen/3.0/mobile/20170213.224833 accepted/tizen/3.0/tv/20170213.224901 accepted/tizen/3.0/wearable/20170213.224920 accepted/tizen/common/20170213.174356 accepted/tizen/ivi/20170214.010722 accepted/tizen/mobile/20170214.010506 accepted/tizen/tv/20170214.010608 accepted/tizen/wearable/20170214.010646 submit/tizen/20170212.133232 submit/tizen_3.0/20170212.133523
authorDoyoun Kang <doyoun.kang@samsung.com>
Sat, 11 Feb 2017 07:24:38 +0000 (16:24 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Sat, 11 Feb 2017 07:24:38 +0000 (16:24 +0900)
The rot.act value of E_Zone means an angle of shown window on the screen.
FYI, rot.curr value of E_Zone means an angle of sersor device.

Change-Id: I1529ba241dd67c1a0e5cc7b5a36fda8de71cff73

src/rotation/e_mod_rotation_wl.c

index 4db2fc1..41327e2 100644 (file)
@@ -699,11 +699,18 @@ _e_client_rotation_zone_set(E_Zone *zone, E_Client *include_ec, E_Client *exclud
    E_Client *ec, *bg_ec = NULL;
    Eina_List *target_list = NULL, *l;
    int i, angle;
+   int cur_angle;
    Eina_Bool can_rotate = EINA_TRUE, ret = EINA_FALSE;
 
    TRACE_DS_BEGIN(CLIENT ROTATION ZONE SET);
 
    DBG("<<< Try to set zone rotation");
+
+   if (zone->rot.unknown_state)
+     cur_angle = zone->rot.act;
+   else
+     cur_angle = zone->rot.curr;
+
    E_CLIENT_REVERSE_FOREACH(ec)
      {
         if (ec->zone != zone) continue;
@@ -713,7 +720,7 @@ _e_client_rotation_zone_set(E_Zone *zone, E_Client *include_ec, E_Client *exclud
         if ((ec->comp_data) && (ec->comp_data->sub.data)) continue;
         if (!e_util_strcmp("wl_pointer-cursor", ec->icccm.window_role))
           {
-             e_client_cursor_map_apply(ec, zone->rot.curr, ec->x, ec->y);
+             e_client_cursor_map_apply(ec, cur_angle, ec->x, ec->y);
              continue;
           }
 
@@ -728,7 +735,7 @@ _e_client_rotation_zone_set(E_Zone *zone, E_Client *include_ec, E_Client *exclud
                }
              else
                {
-                  e_client_rotation_set(ec, zone->rot.curr);
+                  e_client_rotation_set(ec, cur_angle);
                   continue;
                }
 
@@ -771,8 +778,8 @@ _e_client_rotation_zone_set(E_Zone *zone, E_Client *include_ec, E_Client *exclud
                         * rotation is enabled.
                         */
                        if ((!zone->rot.block.sys_auto_rot) &&
-                           (e_mod_pol_conf_rot_enable_get(zone->rot.curr)))
-                         e_client_rotation_set(ec, zone->rot.curr);
+                           (e_mod_pol_conf_rot_enable_get(cur_angle)))
+                         e_client_rotation_set(ec, cur_angle);
                     }
                   continue;
                }
@@ -798,7 +805,7 @@ _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(zone->rot.curr)))
+                 (!e_mod_pol_conf_rot_enable_get(cur_angle)))
                continue;
 
              EDBG(ec, "Append Rotation List '%s'(%p)", ec->icccm.name, ec);
@@ -808,7 +815,7 @@ _e_client_rotation_zone_set(E_Zone *zone, E_Client *include_ec, E_Client *exclud
           }
      }
 
-   angle = zone->rot.curr;
+   angle = cur_angle;
    EINA_LIST_FOREACH(target_list, l, ec)
      {
         if (!e_client_rotation_is_available(ec, angle))
@@ -843,7 +850,7 @@ _e_client_rotation_zone_set(E_Zone *zone, E_Client *include_ec, E_Client *exclud
      {
         for (i = 0; i < 360; i += 90)
           {
-             if ((i == zone->rot.curr) || (i == angle))
+             if ((i == cur_angle) || (i == angle))
                continue;
 
              can_rotate = EINA_TRUE;
@@ -893,8 +900,11 @@ end:
    if (target_list)
      eina_list_free(target_list);
 
+   zone->rot.act = angle;
+
    TRACE_DS_END();
 
+   ELOGF("ROTATION", "zone active angle %d", NULL, NULL, zone->rot.act);
    DBG("End to set zone rotation: %s >>>", ret ? "Change" : "Stay");
    return ret;
 }
@@ -1397,12 +1407,14 @@ _e_zone_rotation_set_internal(E_Zone *zone, int rot)
 
    if (!e_config->wm_win_rotation) return;
 
-   ELOGF("ROTATION", "ZONE_ROT |zone:%d|rot curr:%d, rot:%d",
-         NULL, NULL, zone->num, zone->rot.curr, rot);
+   ELOGF("ROTATION", "ZONE_ROT |zone:%d|rot curr:%d, active:%d, rot:%d",
+          NULL, NULL, zone->num, zone->rot.curr, zone->rot.act, rot);
 
-   if (zone->rot.curr == rot) return;
+   if ((zone->rot.curr == rot) &&
+       (zone->rot.act == rot))
+     return;
 
-   zone->rot.prev = zone->rot.curr;
+   zone->rot.prev = zone->rot.act;
    zone->rot.curr = rot;
    zone->rot.wait_for_done = EINA_TRUE;