summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordivyesh purohit <div.purohit@samsung.com>2016-01-09 00:27:09 +0100
committerCedric BAIL <cedric@osg.samsung.com>2016-01-09 00:27:14 +0100
commit331bcf7abc1d2fed22f50541ca31c304d7a6abbd (patch)
tree01e54c575d039d1410745d80a8dba9dc490865ee
parent740dfd950954f73c0cd461d339a88bdee2bc0400 (diff)
combobox: fix recalc and hover's best_location error
Summary: 1) Recalc error occurs if combobox_hover_begin() was called by the app, it can be reproduced by keeping elm_combobox_hover_begin() in the test_combobox.c 2) Content_set in hover always considered "bottom" as it's best_location as it done during the constructor. @fix Signed-off-by: divyesh purohit <div.purohit@samsung.com> Test Plan: It can be reproduced by keeping elm_combobox_hover_begin() in the test_combobox.c. Also the changing the position of combobox in the window would give top/bottom as it's best location. Reviewers: cedric, shilpasingh Reviewed By: shilpasingh Subscribers: rajeshps, govi Differential Revision: https://phab.enlightenment.org/D3544 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/lib/elc_combobox.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/lib/elc_combobox.c b/src/lib/elc_combobox.c
index 7e5487ffc..9e11a2f96 100644
--- a/src/lib/elc_combobox.c
+++ b/src/lib/elc_combobox.c
@@ -120,6 +120,7 @@ _table_resize(void *data)
120 { 120 {
121 int hover_parent_w, hover_parent_h, obj_h, obj_w, obj_y, win_y_offset; 121 int hover_parent_w, hover_parent_h, obj_h, obj_w, obj_y, win_y_offset;
122 int current_height, h; 122 int current_height, h;
123 const char *best_location;
123 sd->item = elm_genlist_first_item_get(sd->genlist); 124 sd->item = elm_genlist_first_item_get(sd->genlist);
124 elm_genlist_item_selected_set(sd->item, EINA_TRUE); 125 elm_genlist_item_selected_set(sd->item, EINA_TRUE);
125 //FIXME:- the height of item is zero, sometimes. 126 //FIXME:- the height of item is zero, sometimes.
@@ -131,11 +132,12 @@ _table_resize(void *data)
131 evas_object_geometry_get(sd->hover_parent, NULL, NULL, &hover_parent_w, 132 evas_object_geometry_get(sd->hover_parent, NULL, NULL, &hover_parent_w,
132 &hover_parent_h); 133 &hover_parent_h);
133 current_height = sd->item_height * sd->count; 134 current_height = sd->item_height * sd->count;
134 if (!strcmp(elm_hover_best_content_location_get(sd->hover, 135 best_location = elm_hover_best_content_location_get(sd->hover,
135 ELM_HOVER_AXIS_VERTICAL), 136 ELM_HOVER_AXIS_VERTICAL);
136 "bottom")) 137 if (best_location && !strcmp(best_location , "bottom"))
137 win_y_offset = hover_parent_h - obj_y - obj_h; 138 win_y_offset = hover_parent_h - obj_y - obj_h;
138 else win_y_offset = obj_y; 139 else win_y_offset = obj_y;
140
139 if (current_height < win_y_offset) 141 if (current_height < win_y_offset)
140 evas_object_size_hint_min_set(sd->spacer, obj_w * elm_config_scale_get(), 142 evas_object_size_hint_min_set(sd->spacer, obj_w * elm_config_scale_get(),
141 current_height + (2 * elm_config_scale_get())); 143 current_height + (2 * elm_config_scale_get()));
@@ -152,6 +154,9 @@ _activate(Evas_Object *obj)
152 sd->expanded = EINA_TRUE; 154 sd->expanded = EINA_TRUE;
153 eo_do(obj, eo_event_callback_call(ELM_COMBOBOX_EVENT_EXPANDED, NULL)); 155 eo_do(obj, eo_event_callback_call(ELM_COMBOBOX_EVENT_EXPANDED, NULL));
154 _table_resize(obj); 156 _table_resize(obj);
157 elm_object_part_content_set(sd->hover, elm_hover_best_content_location_get
158 (sd->hover, ELM_HOVER_AXIS_VERTICAL), sd->tbl);
159 evas_object_show(sd->genlist);
155 evas_object_show(sd->hover); 160 evas_object_show(sd->hover);
156} 161}
157 162
@@ -294,7 +299,6 @@ _elm_combobox_eo_base_constructor(Eo *obj, Elm_Combobox_Data *sd)
294 evas_object_size_hint_align_set(sd->spacer, EVAS_HINT_FILL, EVAS_HINT_FILL); 299 evas_object_size_hint_align_set(sd->spacer, EVAS_HINT_FILL, EVAS_HINT_FILL);
295 evas_object_color_set(sd->spacer, 0, 0, 0, 0); 300 evas_object_color_set(sd->spacer, 0, 0, 0, 0);
296 elm_table_pack(sd->tbl, sd->spacer, 0, 0, 1, 1); 301 elm_table_pack(sd->tbl, sd->spacer, 0, 0, 1, 1);
297 evas_object_show(sd->tbl);
298 302
299 // This is the genlist object that will take over the genlist call 303 // This is the genlist object that will take over the genlist call
300 sd->genlist = gl = eo_add(ELM_GENLIST_CLASS, obj); 304 sd->genlist = gl = eo_add(ELM_GENLIST_CLASS, obj);
@@ -307,8 +311,8 @@ _elm_combobox_eo_base_constructor(Eo *obj, Elm_Combobox_Data *sd)
307 eo_do(gl, eo_event_callback_add(ELM_GENLIST_EVENT_FILTER_DONE, 311 eo_do(gl, eo_event_callback_add(ELM_GENLIST_EVENT_FILTER_DONE,
308 _gl_filter_finished_cb, obj)); 312 _gl_filter_finished_cb, obj));
309 elm_genlist_homogeneous_set(gl, EINA_TRUE); 313 elm_genlist_homogeneous_set(gl, EINA_TRUE);
314 elm_genlist_mode_set(gl, ELM_LIST_COMPRESS);
310 elm_table_pack(sd->tbl, gl, 0, 0, 1, 1); 315 elm_table_pack(sd->tbl, gl, 0, 0, 1, 1);
311 evas_object_show(sd->genlist);
312 316
313 // This is the entry object that will take over the entry call 317 // This is the entry object that will take over the entry call
314 sd->entry = entry = eo_add(ELM_ENTRY_CLASS, obj); 318 sd->entry = entry = eo_add(ELM_ENTRY_CLASS, obj);
@@ -327,8 +331,6 @@ _elm_combobox_eo_base_constructor(Eo *obj, Elm_Combobox_Data *sd)
327 snprintf(buf, sizeof(buf), "combobox_vertical/%s", elm_widget_style_get(obj)); 331 snprintf(buf, sizeof(buf), "combobox_vertical/%s", elm_widget_style_get(obj));
328 elm_object_style_set(sd->hover, buf); 332 elm_object_style_set(sd->hover, buf);
329 evas_object_smart_callback_add(sd->hover, "clicked", _on_hover_clicked, obj); 333 evas_object_smart_callback_add(sd->hover, "clicked", _on_hover_clicked, obj);
330 elm_object_part_content_set(sd->hover, elm_hover_best_content_location_get
331 (sd->hover, ELM_HOVER_AXIS_VERTICAL), sd->tbl);
332 eo_do(obj, 334 eo_do(obj,
333 eo_composite_attach(gl), 335 eo_composite_attach(gl),
334 eo_composite_attach(entry)); 336 eo_composite_attach(entry));