diff options
author | divyesh purohit <div.purohit@samsung.com> | 2016-02-05 07:18:04 +0100 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2016-02-05 08:45:19 +0100 |
commit | b57a785f02b43e86faf9012e4410e07046173703 (patch) | |
tree | 44e4935d14c77fb237e46aafc8180b278bee3316 | |
parent | ee0a65deccaf14da3c058f971ba8f1502baeae75 (diff) | |
download | elementary-b57a785f02b43e86faf9012e4410e07046173703.tar.gz |
combobox: prevent empty swallow to be shown on hover_dismiss animation
Summary:
Hover dismiss animation takes 0.5 sec to complete. if the genlist item_count
becomes zero, empty swallow is shown in dismiss animation.
@fix T3124
Signed-off-by: divyesh purohit <div.purohit@samsung.com>
Test Plan:
please run combobox example from elementary_test.
Open hover by pressing on left side button of combobox or pressing "enter/space" key in entry
contained in combobox.
Type a char which is not in any genlist item , for example "a' is not presented in any genlist
item.
empty swallow shouldn't seen in dismiss animation.
Reviewers: shilpasingh, cedric, raster
Subscribers: rajeshps, govi
Maniphest Tasks: T3124
Differential Revision: https://phab.enlightenment.org/D3630
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r-- | data/themes/edc/elm/hover.edc | 6 | ||||
-rw-r--r-- | src/lib/elc_combobox.c | 26 | ||||
-rw-r--r-- | src/lib/elm_widget_combobox.h | 1 |
3 files changed, 26 insertions, 7 deletions
diff --git a/data/themes/edc/elm/hover.edc b/data/themes/edc/elm/hover.edc index 2cd7c0a82..8bed195ee 100644 --- a/data/themes/edc/elm/hover.edc +++ b/data/themes/edc/elm/hover.edc @@ -692,6 +692,12 @@ group { name: "elm/hover/base/hoversel_vertical/default"; target: "base"; after: "hidefinished"; } + program { name: "hide_no_animate"; + signal: "elm,action,hide,no_animate"; source: "elm"; + action: STATE_SET "default" 0.0; + target: "base"; + after: "hidefinished"; + } program { name: "hidefinished"; script { set_int(on_dismiss, 0); diff --git a/src/lib/elc_combobox.c b/src/lib/elc_combobox.c index 9ad0dbe37..f950f5826 100644 --- a/src/lib/elc_combobox.c +++ b/src/lib/elc_combobox.c @@ -147,7 +147,6 @@ _table_resize(void *data) { int hover_parent_w, hover_parent_h, obj_h, obj_w, obj_y, win_y_offset; int current_height, h; - const char *best_location; sd->item = elm_genlist_first_item_get(sd->genlist); //FIXME:- the height of item is zero, sometimes. evas_object_geometry_get(elm_object_item_track(sd->item), NULL, NULL, @@ -158,9 +157,9 @@ _table_resize(void *data) evas_object_geometry_get(sd->hover_parent, NULL, NULL, &hover_parent_w, &hover_parent_h); current_height = sd->item_height * sd->count; - best_location = elm_hover_best_content_location_get(sd->hover, + sd->best_location = elm_hover_best_content_location_get(sd->hover, ELM_HOVER_AXIS_VERTICAL); - if (best_location && !strcmp(best_location , "bottom")) + if (sd->best_location && !strcmp(sd->best_location , "bottom")) win_y_offset = hover_parent_h - obj_y - obj_h; else win_y_offset = obj_y; @@ -177,15 +176,19 @@ _activate(Evas_Object *obj) { ELM_COMBOBOX_DATA_GET(obj, sd); if (elm_widget_disabled_get(obj)) return; + if (sd->expanded) { elm_combobox_hover_end(obj); return; } + sd->expanded = EINA_TRUE; + + if (sd->count <= 0) return; + _table_resize(obj); - elm_object_part_content_set(sd->hover, elm_hover_best_content_location_get - (sd->hover, ELM_HOVER_AXIS_VERTICAL), sd->tbl); + elm_object_part_content_set(sd->hover, sd->best_location, sd->tbl); evas_object_show(sd->genlist); elm_genlist_item_selected_set(sd->item, EINA_TRUE); evas_object_show(sd->hover); @@ -210,6 +213,7 @@ static Eina_Bool _gl_filter_finished_cb(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event) { + char buf[1024]; ELM_COMBOBOX_DATA_GET(data, sd); count_items_genlist(data); @@ -226,9 +230,17 @@ _gl_filter_finished_cb(void *data, Eo *obj EINA_UNUSED, { if (!sd->expanded) _activate(data); else _table_resize(data); + elm_genlist_item_selected_set(sd->item, EINA_TRUE); } - else elm_combobox_hover_end(data); - elm_genlist_item_selected_set(sd->item, EINA_TRUE); + else + { + sd->expanded = EINA_FALSE; + elm_layout_signal_emit(sd->hover, "elm,action,hide,no_animate", "elm"); + snprintf(buf, sizeof(buf), "elm,action,slot,%s,hide", sd->best_location); + elm_layout_signal_emit(sd->hover, buf, "elm"); + edje_object_message_signal_process(elm_layout_edje_get(sd->hover)); + } + return EINA_TRUE; } diff --git a/src/lib/elm_widget_combobox.h b/src/lib/elm_widget_combobox.h index f3ec5bfe0..205096a4c 100644 --- a/src/lib/elm_widget_combobox.h +++ b/src/lib/elm_widget_combobox.h @@ -35,6 +35,7 @@ struct _Elm_Combobox_Data Evas_Object *spacer; Elm_Object_Item *item; const char *style; + const char *best_location; int count; int item_height; Eina_Bool expanded:1; |