cedric pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=6286345fe353828d344fabc08fded81dd9752f74

commit 6286345fe353828d344fabc08fded81dd9752f74
Author: Jee-Yong Um <jc9...@samsung.com>
Date:   Mon Oct 12 13:22:26 2015 -0700

    elm_hoversel: fix to show dismiss animation
    
    Summary:
    In hover.edc, hoversel dismiss animations are defined,
    but it doesn't work at all. (Hover is removed before animation)
    This patch makes hoversel remove its hover after dismiss animation.
    
    @fix
    
    Test Plan: elementary_test hoversel
    
    Reviewers: Hermet, cedric
    
    Reviewed By: cedric
    
    Subscribers: woohyun
    
    Differential Revision: https://phab.enlightenment.org/D3070
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/lib/elc_hoversel.c | 73 +++++++++++++++++++++++++++++++++++++++++++-------
 src/lib/elm_hover.c    |  7 ++++-
 2 files changed, 69 insertions(+), 11 deletions(-)

diff --git a/src/lib/elc_hoversel.c b/src/lib/elc_hoversel.c
index 266dc00..2079e99 100644
--- a/src/lib/elc_hoversel.c
+++ b/src/lib/elc_hoversel.c
@@ -93,10 +93,15 @@ _elm_hoversel_elm_widget_theme_apply(Eo *obj, 
Elm_Hoversel_Data *sd)
 
 static Eina_Bool
 _on_hover_clicked(void *data EINA_UNUSED,
-                     Eo *obj EINA_UNUSED, const Eo_Event_Description *desc 
EINA_UNUSED,
+                     Eo *obj, const Eo_Event_Description *desc EINA_UNUSED,
                      void *event_info EINA_UNUSED)
 {
-   elm_hoversel_hover_end(data);
+   const char *dismissstr;
+
+   dismissstr = edje_object_data_get(elm_layout_edje_get(obj), "dismiss");
+
+   if (!dismissstr || strcmp(dismissstr, "on"))
+     elm_hoversel_hover_end(data); // for backward compatibility
 
    return EINA_TRUE;
 }
@@ -323,6 +328,37 @@ _resizing_eval(Evas_Object *obj, Elm_Hoversel_Data *sd)
 }
 
 static void
+_hover_end_finished(void *data,
+                    Evas_Object *obj EINA_UNUSED,
+                    const char *emission EINA_UNUSED,
+                    const char *source EINA_UNUSED)
+{
+   Elm_Object_Item *eo_item;
+   Eina_List *l;
+   const char *dismissstr;
+
+   ELM_HOVERSEL_DATA_GET(data, sd);
+
+   dismissstr = edje_object_data_get(elm_layout_edje_get(sd->hover), 
"dismiss");
+
+   if (dismissstr && !strcmp(dismissstr, "on"))
+     {
+        sd->expanded = EINA_FALSE;
+
+        EINA_LIST_FOREACH(sd->items, l, eo_item)
+          {
+             ELM_HOVERSEL_ITEM_DATA_GET(eo_item, it);
+             VIEW(it) = NULL;
+          }
+        ELM_SAFE_FREE(sd->hover, evas_object_del);
+        sd->scr = NULL;
+        sd->last_location = NULL;
+
+        eo_do(obj, eo_event_callback_call(ELM_HOVERSEL_EVENT_DISMISSED, NULL));
+     }
+}
+
+static void
 _activate(Evas_Object *obj)
 {
    Elm_Object_Item *eo_item;
@@ -355,6 +391,8 @@ _activate(Evas_Object *obj)
 
    eo_do(sd->hover, eo_event_callback_add
      (EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, _on_hover_clicked, obj));
+   elm_layout_signal_callback_add
+     (sd->hover, "elm,action,hide,finished", "elm", _hover_end_finished, obj);
    elm_hover_target_set(sd->hover, obj);
 
    /* hover's content */
@@ -695,23 +733,38 @@ _elm_hoversel_hover_begin(Eo *obj, Elm_Hoversel_Data *sd)
 EOLIAN static void
 _elm_hoversel_hover_end(Eo *obj, Elm_Hoversel_Data *sd)
 {
+
    Elm_Object_Item *eo_item;
    Eina_List *l;
+   const char *dismissstr;
 
    if (!sd->hover) return;
 
-   sd->expanded = EINA_FALSE;
+   dismissstr = edje_object_data_get(elm_layout_edje_get(sd->hover), 
"dismiss");
 
-   EINA_LIST_FOREACH(sd->items, l, eo_item)
+   if (dismissstr && !strcmp(dismissstr, "on"))
      {
-        ELM_HOVERSEL_ITEM_DATA_GET(eo_item, it);
-        VIEW(it) = NULL;
+        elm_hover_dismiss(sd->hover);
+
+
+
      }
-   ELM_SAFE_FREE(sd->hover, evas_object_del);
-   sd->scr = NULL;
-   sd->last_location = NULL;
+   else
+
+     {
+        sd->expanded = EINA_FALSE;
+
+        EINA_LIST_FOREACH(sd->items, l, eo_item)
+          {
+             ELM_HOVERSEL_ITEM_DATA_GET(eo_item, it);
+             VIEW(it) = NULL;
+          }
+        ELM_SAFE_FREE(sd->hover, evas_object_del);
+        sd->scr = NULL;
+        sd->last_location = NULL;
 
-   eo_do(obj, eo_event_callback_call(ELM_HOVERSEL_EVENT_DISMISSED, NULL));
+        eo_do(obj, eo_event_callback_call(ELM_HOVERSEL_EVENT_DISMISSED, NULL));
+     } // for backward compatibility
 }
 
 EOLIAN static Eina_Bool
diff --git a/src/lib/elm_hover.c b/src/lib/elm_hover.c
index 7bfc6db..2ca235a 100644
--- a/src/lib/elm_hover.c
+++ b/src/lib/elm_hover.c
@@ -808,7 +808,12 @@ _elm_hover_best_content_location_get(const Eo *obj 
EINA_UNUSED, Elm_Hover_Data *
 EOLIAN static void
 _elm_hover_dismiss(Eo *obj, Elm_Hover_Data *_pd EINA_UNUSED)
 {
-   elm_layout_signal_emit(obj, "elm,action,dismiss", ""); // XXX: for compat
+   const char *dismissstr;
+
+   dismissstr = edje_object_data_get(elm_layout_edje_get(obj), "dismiss");
+
+   if (!dismissstr || strcmp(dismissstr, "on"))
+     elm_layout_signal_emit(obj, "elm,action,dismiss", ""); // XXX: for compat
    elm_layout_signal_emit(obj, "elm,action,dismiss", "elm");
 }
 

-- 


Reply via email to