summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordivyesh purohit <div.purohit@samsung.com>2016-02-05 07:18:04 +0100
committerCedric BAIL <cedric@osg.samsung.com>2016-02-05 08:45:19 +0100
commitb57a785f02b43e86faf9012e4410e07046173703 (patch)
tree44e4935d14c77fb237e46aafc8180b278bee3316
parentee0a65deccaf14da3c058f971ba8f1502baeae75 (diff)
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.edc6
-rw-r--r--src/lib/elc_combobox.c26
-rw-r--r--src/lib/elm_widget_combobox.h1
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";
692 target: "base"; 692 target: "base";
693 after: "hidefinished"; 693 after: "hidefinished";
694 } 694 }
695 program { name: "hide_no_animate";
696 signal: "elm,action,hide,no_animate"; source: "elm";
697 action: STATE_SET "default" 0.0;
698 target: "base";
699 after: "hidefinished";
700 }
695 program { name: "hidefinished"; 701 program { name: "hidefinished";
696 script { 702 script {
697 set_int(on_dismiss, 0); 703 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)
147 { 147 {
148 int hover_parent_w, hover_parent_h, obj_h, obj_w, obj_y, win_y_offset; 148 int hover_parent_w, hover_parent_h, obj_h, obj_w, obj_y, win_y_offset;
149 int current_height, h; 149 int current_height, h;
150 const char *best_location;
151 sd->item = elm_genlist_first_item_get(sd->genlist); 150 sd->item = elm_genlist_first_item_get(sd->genlist);
152 //FIXME:- the height of item is zero, sometimes. 151 //FIXME:- the height of item is zero, sometimes.
153 evas_object_geometry_get(elm_object_item_track(sd->item), NULL, NULL, 152 evas_object_geometry_get(elm_object_item_track(sd->item), NULL, NULL,
@@ -158,9 +157,9 @@ _table_resize(void *data)
158 evas_object_geometry_get(sd->hover_parent, NULL, NULL, &hover_parent_w, 157 evas_object_geometry_get(sd->hover_parent, NULL, NULL, &hover_parent_w,
159 &hover_parent_h); 158 &hover_parent_h);
160 current_height = sd->item_height * sd->count; 159 current_height = sd->item_height * sd->count;
161 best_location = elm_hover_best_content_location_get(sd->hover, 160 sd->best_location = elm_hover_best_content_location_get(sd->hover,
162 ELM_HOVER_AXIS_VERTICAL); 161 ELM_HOVER_AXIS_VERTICAL);
163 if (best_location && !strcmp(best_location , "bottom")) 162 if (sd->best_location && !strcmp(sd->best_location , "bottom"))
164 win_y_offset = hover_parent_h - obj_y - obj_h; 163 win_y_offset = hover_parent_h - obj_y - obj_h;
165 else win_y_offset = obj_y; 164 else win_y_offset = obj_y;
166 165
@@ -177,15 +176,19 @@ _activate(Evas_Object *obj)
177{ 176{
178 ELM_COMBOBOX_DATA_GET(obj, sd); 177 ELM_COMBOBOX_DATA_GET(obj, sd);
179 if (elm_widget_disabled_get(obj)) return; 178 if (elm_widget_disabled_get(obj)) return;
179
180 if (sd->expanded) 180 if (sd->expanded)
181 { 181 {
182 elm_combobox_hover_end(obj); 182 elm_combobox_hover_end(obj);
183 return; 183 return;
184 } 184 }
185
185 sd->expanded = EINA_TRUE; 186 sd->expanded = EINA_TRUE;
187
188 if (sd->count <= 0) return;
189
186 _table_resize(obj); 190 _table_resize(obj);
187 elm_object_part_content_set(sd->hover, elm_hover_best_content_location_get 191 elm_object_part_content_set(sd->hover, sd->best_location, sd->tbl);
188 (sd->hover, ELM_HOVER_AXIS_VERTICAL), sd->tbl);
189 evas_object_show(sd->genlist); 192 evas_object_show(sd->genlist);
190 elm_genlist_item_selected_set(sd->item, EINA_TRUE); 193 elm_genlist_item_selected_set(sd->item, EINA_TRUE);
191 evas_object_show(sd->hover); 194 evas_object_show(sd->hover);
@@ -210,6 +213,7 @@ static Eina_Bool
210_gl_filter_finished_cb(void *data, Eo *obj EINA_UNUSED, 213_gl_filter_finished_cb(void *data, Eo *obj EINA_UNUSED,
211 const Eo_Event_Description *desc EINA_UNUSED, void *event) 214 const Eo_Event_Description *desc EINA_UNUSED, void *event)
212{ 215{
216 char buf[1024];
213 ELM_COMBOBOX_DATA_GET(data, sd); 217 ELM_COMBOBOX_DATA_GET(data, sd);
214 218
215 count_items_genlist(data); 219 count_items_genlist(data);
@@ -226,9 +230,17 @@ _gl_filter_finished_cb(void *data, Eo *obj EINA_UNUSED,
226 { 230 {
227 if (!sd->expanded) _activate(data); 231 if (!sd->expanded) _activate(data);
228 else _table_resize(data); 232 else _table_resize(data);
233 elm_genlist_item_selected_set(sd->item, EINA_TRUE);
229 } 234 }
230 else elm_combobox_hover_end(data); 235 else
231 elm_genlist_item_selected_set(sd->item, EINA_TRUE); 236 {
237 sd->expanded = EINA_FALSE;
238 elm_layout_signal_emit(sd->hover, "elm,action,hide,no_animate", "elm");
239 snprintf(buf, sizeof(buf), "elm,action,slot,%s,hide", sd->best_location);
240 elm_layout_signal_emit(sd->hover, buf, "elm");
241 edje_object_message_signal_process(elm_layout_edje_get(sd->hover));
242 }
243
232 return EINA_TRUE; 244 return EINA_TRUE;
233} 245}
234 246
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
35 Evas_Object *spacer; 35 Evas_Object *spacer;
36 Elm_Object_Item *item; 36 Elm_Object_Item *item;
37 const char *style; 37 const char *style;
38 const char *best_location;
38 int count; 39 int count;
39 int item_height; 40 int item_height;
40 Eina_Bool expanded:1; 41 Eina_Bool expanded:1;