rotation: clear pending flag even if don't need to change rotation. 17/103017/1
authorSeunghun Lee <shiin.lee@samsung.com>
Wed, 7 Dec 2016 04:32:53 +0000 (13:32 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Wed, 7 Dec 2016 04:32:53 +0000 (13:32 +0900)
this patch fixes a follows bug.
first, the flag indicated pending rotation was set by un-blocking rotation,
as calling e_zone_rotation_block_set(false). at this moment, if values of curr
and next(e.g. 0) if same, event of zone rotation would not be raised, and
pending flag remains true. in this state, if rotation is changed to different
angle(e.g. 90) by sensord, finally event of zone rotation was raised again with
wrong value(0), because pended rotation was handled again after rotation done

Change-Id: I6579574ec3cf2af00c651999041af4133244e04a

src/rotation/e_mod_rotation_wl.c

index 5dae0a0..46d97f7 100644 (file)
@@ -1334,24 +1334,27 @@ e_zone_rotation_block_set(E_Zone *zone, const char *name_hint, Eina_Bool set)
      {
         zone->rot.block_count = 0;
 
-        if ((zone->rot.pending) &&
-            (zone->rot.curr != zone->rot.next))
+        if (zone->rot.pending)
           {
-             zone->rot.prev = zone->rot.curr;
-             zone->rot.curr = zone->rot.next;
-             zone->rot.wait_for_done = EINA_TRUE;
              zone->rot.pending = EINA_FALSE;
-
-             ev = E_NEW(E_Event_Zone_Rotation_Change_Begin, 1);
-             if (ev)
+             if (zone->rot.curr != zone->rot.next)
                {
-                  ev->zone = zone;
-                  e_object_ref(E_OBJECT(ev->zone));
-                  ecore_event_add(E_EVENT_ZONE_ROTATION_CHANGE_BEGIN,
-                                  ev, _e_zone_event_rotation_change_begin_free, NULL);
+                  zone->rot.prev = zone->rot.curr;
+                  zone->rot.curr = zone->rot.next;
+                  zone->rot.wait_for_done = EINA_TRUE;
+                  zone->rot.pending = EINA_FALSE;
 
-                  ELOGF("ROTATION", "ROT_SET(P|zone:%d|rot:%d",
-                        NULL, NULL, zone->num, zone->rot.curr);
+                  ev = E_NEW(E_Event_Zone_Rotation_Change_Begin, 1);
+                  if (ev)
+                    {
+                       ev->zone = zone;
+                       e_object_ref(E_OBJECT(ev->zone));
+                       ecore_event_add(E_EVENT_ZONE_ROTATION_CHANGE_BEGIN,
+                                       ev, _e_zone_event_rotation_change_begin_free, NULL);
+
+                       ELOGF("ROTATION", "ROT_SET(P|zone:%d|rot:%d",
+                             NULL, NULL, zone->num, zone->rot.curr);
+                    }
                }
           }
      }
@@ -1380,26 +1383,29 @@ e_zone_rotation_update_done(E_Zone *zone)
      }
 
    zone->rot.wait_for_done = EINA_FALSE;
-   if ((zone->rot.pending) &&
-       (zone->rot.block_count == 0) &&
-       (zone->rot.curr != zone->rot.next))
+   if ((zone->rot.block_count == 0) && (zone->rot.pending))
      {
-        zone->rot.prev = zone->rot.curr;
-        zone->rot.curr = zone->rot.next;
-        zone->rot.wait_for_done = EINA_TRUE;
         zone->rot.pending = EINA_FALSE;
-
-        E_Event_Zone_Rotation_Change_Begin *ev2;
-        ev2 = E_NEW(E_Event_Zone_Rotation_Change_Begin, 1);
-        if (ev2)
+        if (zone->rot.curr != zone->rot.next)
           {
-             ev2->zone = zone;
-             e_object_ref(E_OBJECT(ev2->zone));
-             ecore_event_add(E_EVENT_ZONE_ROTATION_CHANGE_BEGIN,
-                             ev2, _e_zone_event_rotation_change_begin_free, NULL);
+             zone->rot.prev = zone->rot.curr;
+             zone->rot.curr = zone->rot.next;
+             zone->rot.wait_for_done = EINA_TRUE;
+             zone->rot.pending = EINA_FALSE;
+
+             E_Event_Zone_Rotation_Change_Begin *ev2;
+             ev2 = E_NEW(E_Event_Zone_Rotation_Change_Begin, 1);
+             if (ev2)
+               {
+                  ev2->zone = zone;
+                  e_object_ref(E_OBJECT(ev2->zone));
+                  ecore_event_add(E_EVENT_ZONE_ROTATION_CHANGE_BEGIN,
+                                  ev2, _e_zone_event_rotation_change_begin_free, NULL);
+
+                  ELOGF("ROTATION", "ROT_SET(P|zone:%d|rot:%d",
+                        NULL, NULL, zone->num, zone->rot.curr);
 
-             ELOGF("ROTATION", "ROT_SET(P|zone:%d|rot:%d",
-                   NULL, NULL, zone->num, zone->rot.curr);
+               }
           }
      }
 }