rotation: send rotation effect events 20/94320/3
authorMinJeong Kim <minjjj.kim@samsung.com>
Thu, 20 Oct 2016 10:54:09 +0000 (19:54 +0900)
committerMinJeong Kim <minjjj.kim@samsung.com>
Tue, 1 Nov 2016 01:32:44 +0000 (10:32 +0900)
send E_EVENT_ZONE_ROTATION_EFFECT_READY/CANCEL/DONE event

Change-Id: I0efd45ee9ea0a9adccddcc3e7f09f6beae3a3b49
Signed-off-by: MinJeong Kim <minjjj.kim@samsung.com>
src/e_mod_effect_rotation.c

index 0df0f4efd9debe5f262204b85a5b940d1376d0f6..341be53f191b87571190c94c3ef7e4a67b079c31 100644 (file)
@@ -67,6 +67,48 @@ typedef struct _Rotation_Zone
 
 static Rotation_Zone *_rotation_zone = NULL;
 
+static void
+_rotation_effect_ready_send(E_Zone *zone)
+{
+   E_Event_Zone_Rotation_Effect_Ready *ev;
+
+   ev = E_NEW(E_Event_Zone_Rotation_Effect_Ready, 1);
+   if (!ev) return;
+
+   ev->zone = zone;
+   ecore_event_add(E_EVENT_ZONE_ROTATION_EFFECT_READY, ev, NULL, NULL);
+
+   EFFINF("Rotation Effect Event Ready", NULL, NULL);
+}
+
+static void
+_rotation_effect_cancel_send(E_Zone *zone)
+{
+   E_Event_Zone_Rotation_Effect_Cancel *ev;
+
+   ev = E_NEW(E_Event_Zone_Rotation_Effect_Cancel, 1);
+   if (!ev) return;
+
+   ev->zone = zone;
+   ecore_event_add(E_EVENT_ZONE_ROTATION_EFFECT_CANCEL, ev, NULL, NULL);
+
+   EFFINF("Rotation Effect Event Cancel", NULL, NULL);
+}
+
+static void
+_rotation_effect_done_send(E_Zone *zone)
+{
+   E_Event_Zone_Rotation_Effect_Done *ev;
+
+   ev = E_NEW(E_Event_Zone_Rotation_Effect_Done, 1);
+   if (!ev) return;
+
+   ev->zone = zone;
+   ecore_event_add(E_EVENT_ZONE_ROTATION_EFFECT_DONE, ev, NULL, NULL);
+
+   EFFINF("Rotation Effect Event Done", NULL, NULL);
+}
+
 static Eina_Bool
 _rotation_effect_available(const E_Client *ec, int ang)
 {
@@ -537,7 +579,10 @@ _rotation_effect_clear(Rotation_Effect *effect)
      }
 
    if (effect->ctx_end)
-     _rotation_effect_animator_end_context_free(effect->ctx_end);
+     {
+        _rotation_effect_animator_end_context_free(effect->ctx_end);
+        _rotation_effect_done_send(effect->zone);
+     }
 
    effect->running = EINA_FALSE;
    effect->wait_for_buffer = EINA_FALSE;
@@ -576,6 +621,7 @@ _rotation_effect_animator_cb_update(void *data, double pos)
         evas_object_hide(effect->bg);
 
         e_comp_override_del();
+        _rotation_effect_done_send(effect->zone);
 
         return ECORE_CALLBACK_CANCEL;
      }
@@ -705,6 +751,9 @@ _rotation_effect_cb_zone_rotation_begin(void *data, int type, void *event)
 
    _rotation_effect_animator_begin_prepare(effect);
 
+   if (effect->targets)
+     _rotation_effect_ready_send(zone);
+
    return ECORE_CALLBACK_PASS_ON;
 }
 
@@ -740,14 +789,20 @@ _rotation_effect_cb_zone_rotation_end(void *data, int type, void *event)
 static Eina_Bool
 _rotation_effect_cb_zone_rotation_cancel(void *data, int type, void *event)
 {
+   E_Event_Zone_Rotation_Change_Cancel *ev = event;
    Rotation_Effect *effect;
+   E_Zone *zone;
 
-   EFFINF("Zone Rotation Canceld", NULL, NULL);
+   zone = ev->zone;
+   if (!zone) return ECORE_CALLBACK_PASS_ON;
 
    effect = (Rotation_Effect *)data;
    if (!effect) return ECORE_CALLBACK_PASS_ON;
-   if (effect->running) return ECORE_CALLBACK_PASS_ON;
 
+   EFFINF("Zone Rotation Cancelled", NULL, NULL);
+
+   if (effect->running) return ECORE_CALLBACK_PASS_ON;
+   if (effect->targets) _rotation_effect_cancel_send(zone);
    _rotation_effect_clear(effect);
 
    return ECORE_CALLBACK_PASS_ON;