bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=87a25fd353ec245e3ff434ad964b223538092471

commit 87a25fd353ec245e3ff434ad964b223538092471
Author: Marcel Hollerbach <[email protected]>
Date:   Fri Mar 31 21:23:48 2017 +0200

    combobox: fix 0px height on first click
    
    the height of a item is 0 because the item is not realized, so if no
    item is realized we are waiting until one is realized, until then we
    just take 1px as a height, so at minimum one item needs to be realized.
    
    If there is a realized item (or we are getting the event that there is
    one) we are just calling _table_resize again, and are getting the size
    for real.
---
 src/lib/elementary/elc_combobox.c | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/lib/elementary/elc_combobox.c 
b/src/lib/elementary/elc_combobox.c
index 1543181..01dc21a 100644
--- a/src/lib/elementary/elc_combobox.c
+++ b/src/lib/elementary/elc_combobox.c
@@ -33,6 +33,7 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
    {NULL, NULL}
 };
 
+static void _table_resize(void *data);
 static Eina_Bool _key_action_move(Evas_Object *obj, const char *params);
 static Eina_Bool _key_action_activate(Evas_Object *obj, const char *params);
 
@@ -141,6 +142,12 @@ count_items_genlist(void *data)
 }
 
 static void
+_item_realized(void *data, Evas_Object *obj EINA_UNUSED, void *event_info 
EINA_UNUSED)
+{
+   _table_resize(data);
+}
+
+static void
 _table_resize(void *data)
 {
    ELM_COMBOBOX_DATA_GET(data, sd);
@@ -148,11 +155,24 @@ _table_resize(void *data)
      {
         int hover_parent_w, hover_parent_h, obj_h, obj_w, obj_y, win_y_offset;
         int current_height, h;
+        Eina_List *realized;
+
         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,
-                                 NULL, &h);
-        if (h) sd->item_height = h;
+
+        if (!(realized = elm_genlist_realized_items_get(sd->genlist)))
+          {
+             //nothing realized and wait until at least one item is realized
+             h = 1;
+             evas_object_smart_callback_add(sd->genlist, "realized", 
_item_realized, data);
+          }
+        else
+          {
+             // take the first, and update according to that
+             
evas_object_geometry_get(elm_object_item_track(eina_list_data_get(realized)), 
NULL, NULL,
+                                      NULL, &h);
+          }
+
+        sd->item_height = h;
         evas_object_geometry_get(sd->entry, NULL, NULL, &obj_w, NULL);
         evas_object_geometry_get(data, NULL, &obj_y, NULL, &obj_h);
         evas_object_geometry_get(sd->hover_parent, NULL, NULL, &hover_parent_w,

-- 


Reply via email to