summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJee-Yong Um <jc9.um@samsung.com>2016-01-04 15:17:23 -0800
committerCedric BAIL <cedric@osg.samsung.com>2016-01-04 15:17:26 -0800
commitbc78159ff362e6867abc2a6451af9eb84b093245 (patch)
tree88811fe4f0a21522c6b8e1654fc4559d0001af4e
parentd19f943d8dc94584c529d7b9423de5ee3eb3a211 (diff)
downloadelementary-bc78159ff362e6867abc2a6451af9eb84b093245.tar.gz
hoversel: auto update hoversel after dismiss animation finished.
Summary: If auto_update feature changes hoversel width, dismiss animation seems awful because hoversel contents move to changed position in an instant. This patch makes hoversel update its content with clicked item after dismiss animation finished. Test Plan: elementary_test hoversel Reviewers: raster, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3519 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/bin/test_hoversel.c3
-rw-r--r--src/lib/elc_hoversel.c27
2 files changed, 21 insertions, 9 deletions
diff --git a/src/bin/test_hoversel.c b/src/bin/test_hoversel.c
index 15d420382..9dceb3f3a 100644
--- a/src/bin/test_hoversel.c
+++ b/src/bin/test_hoversel.c
@@ -107,7 +107,6 @@ _hoversel_selected_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
const char *txt = elm_object_item_text_get(event_info);
printf("'selected' callback is called. (selected item : %s)\n", txt);
- elm_object_text_set(obj, txt);
}
static void
@@ -165,6 +164,7 @@ test_hoversel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
hoversel = elm_hoversel_add(win);
// FIXME: need to add horizontal hoversel theme to default some day
// elm_hoversel_horizontal_set(bt, EINA_TRUE);
+ elm_hoversel_auto_update_set(hoversel, EINA_TRUE);
elm_hoversel_hover_parent_set(hoversel, win);
elm_object_text_set(hoversel, "Labels");
elm_hoversel_item_add(hoversel, "Item 1", NULL, ELM_ICON_NONE, NULL, NULL);
@@ -265,6 +265,7 @@ test_hoversel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
evas_object_show(hoversel);
hoversel = elm_hoversel_add(win);
+ elm_hoversel_auto_update_set(hoversel, EINA_TRUE);
elm_hoversel_hover_parent_set(hoversel, win);
elm_object_text_set(hoversel, "Custom Item Style");
elm_hoversel_item_add(hoversel, "Item 1", NULL, ELM_ICON_NONE, NULL, NULL);
diff --git a/src/lib/elc_hoversel.c b/src/lib/elc_hoversel.c
index 20285c432..51625da76 100644
--- a/src/lib/elc_hoversel.c
+++ b/src/lib/elc_hoversel.c
@@ -121,20 +121,14 @@ _on_hover_clicked(void *data EINA_UNUSED,
return EINA_TRUE;
}
-static Eina_Bool
-_on_item_clicked(void *data EINA_UNUSED,
- Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
- void *event_info EINA_UNUSED)
+static void
+_auto_update(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Elm_Hoversel_Item_Data *item = data;
Evas_Object *obj2 = WIDGET(item);
- Elm_Object_Item *eo_it = EO_OBJ(item);
ELM_HOVERSEL_DATA_GET(obj2, sd);
- if (item->func) item->func((void *)WIDGET_ITEM_DATA_GET(eo_it), obj2, eo_it);
- eo_do(obj2, eo_event_callback_call(EVAS_SELECTABLE_INTERFACE_EVENT_SELECTED, eo_it));
-
if (sd->auto_update)
{
Evas_Object *ic;
@@ -156,6 +150,23 @@ _on_item_clicked(void *data EINA_UNUSED,
if(item->label)
elm_object_text_set(obj2, item->label);
}
+}
+
+static Eina_Bool
+_on_item_clicked(void *data EINA_UNUSED,
+ Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Elm_Hoversel_Item_Data *item = data;
+ Evas_Object *obj2 = WIDGET(item);
+ Elm_Object_Item *eo_it = EO_OBJ(item);
+
+ ELM_HOVERSEL_DATA_GET(obj2, sd);
+
+ if (item->func) item->func((void *)WIDGET_ITEM_DATA_GET(eo_it), obj2, eo_it);
+ eo_do(obj2, eo_event_callback_call(EVAS_SELECTABLE_INTERFACE_EVENT_SELECTED, eo_it));
+
+ evas_object_event_callback_add(sd->hover, EVAS_CALLBACK_DEL, _auto_update, item);
elm_hoversel_hover_end(obj2);