Added a API named "e_zone_rotation_block_set" to block the rotation.
authorSeunghun Lee <shiin.lee@samsung.com>
Fri, 26 Apr 2013 05:59:43 +0000 (14:59 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Fri, 26 Apr 2013 10:03:45 +0000 (19:03 +0900)
Change-Id: I0611027cee659c0c725bb539d0721fb4ae2fc54e

src/bin/e_zone.c
src/bin/e_zone.h

index be5fbc1..3768f45 100644 (file)
@@ -1427,7 +1427,8 @@ e_zone_rotation_set(E_Zone *zone,
 
    ELBF(ELBT_ROT, 0, zone->num, "SET ROT a%d", rot);
 
-   if (zone->rot.wait_for_done)
+   if ((zone->rot.wait_for_done) ||
+       (zone->rot.block_count > 0))
      {
         zone->rot.next = rot;
         zone->rot.pending = EINA_TRUE;
@@ -1455,6 +1456,41 @@ e_zone_rotation_get(E_Zone *zone)
    return zone->rot.curr;
 }
 
+EAPI Eina_Bool
+e_zone_rotation_block_set(E_Zone *zone, const char *name_hint, Eina_Bool set)
+{
+   E_Event_Zone_Rotation_Change *ev;
+
+   E_OBJECT_CHECK_RETURN(zone, EINA_FALSE);
+   E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, EINA_FALSE);
+
+   if (set) zone->rot.block_count++;
+   else     zone->rot.block_count--;
+
+   ELBF(ELBT_ROT, 0, zone->num, "[%s ROT] count: %d, from %s",
+        set ? "PAUSE" : "RESUME", zone->rot.block_count, name_hint);
+
+   if (zone->rot.block_count <= 0)
+     {
+        zone->rot.block_count = 0;
+        if (zone->rot.pending)
+          {
+             zone->rot.prev = zone->rot.curr;
+             zone->rot.curr = zone->rot.next;
+             zone->rot.pending = EINA_FALSE;
+
+             ev = E_NEW(E_Event_Zone_Rotation_Change, 1);
+             ev->zone = zone;
+             e_object_ref(E_OBJECT(ev->zone));
+             ecore_event_add(E_EVENT_ZONE_ROTATION_CHANGE, ev, _e_zone_event_rotation_change_free, NULL);
+
+             ELBF(ELBT_ROT, 0, zone->num, "CHANGE ROT(pending) a%d", zone->rot.curr);
+          }
+     }
+
+   return EINA_TRUE;
+}
+
 EAPI void
 e_zone_rotation_update_done(E_Zone *zone)
 {
@@ -1467,7 +1503,8 @@ e_zone_rotation_update_done(E_Zone *zone)
    ELBF(ELBT_ROT, 0, zone->num, "DONE ROT a%d", zone->rot.curr);
 
    zone->rot.wait_for_done = EINA_FALSE;
-   if (zone->rot.pending)
+   if ((zone->rot.pending) &&
+       (zone->rot.block_count == 0))
      {
         zone->rot.prev = zone->rot.curr;
         zone->rot.curr = zone->rot.next;
index de53fbf..494745d 100644 (file)
@@ -92,6 +92,7 @@ struct _E_Zone
    struct
    {
       int       prev, curr, next;
+      int       block_count;
       Eina_Bool wait_for_done : 1;
       Eina_Bool pending : 1;
    } rot;
@@ -178,6 +179,7 @@ EAPI void      e_zone_useful_geometry_get(E_Zone *zone, int *x, int *y, int *w,
 #ifdef _F_ZONE_WINDOW_ROTATION_
 EAPI void      e_zone_rotation_set(E_Zone *zone, int rot);
 EAPI int       e_zone_rotation_get(E_Zone *zone);
+EAPI Eina_Bool e_zone_rotation_block_set(E_Zone *zone, const char *name_hint, Eina_Bool set);
 EAPI void      e_zone_rotation_update_done(E_Zone *zone);
 EAPI void      e_zone_rotation_update_cancel(E_Zone *zone);
 #endif