elm_datetime: Fix datetime ctxpopup resize issue
authordivyesh purohit <div.purohit@samsung.com>
Wed, 1 Jul 2015 02:02:18 +0000 (11:02 +0900)
committerChunEon Park <hermet@hermet.pe.kr>
Wed, 1 Jul 2015 02:02:18 +0000 (11:02 +0900)
Summary:
In elm_datetime, ctxpopup does not resize

@fix

Test Plan:
1) Change the scale value in elementary_config to 2.0 (so that a better size change in the ctxpopup's can be observed)
2) Open elementary_test and then the datetime
3) Click on the first datetime field and observe the ctxpopup's arrow position and then close it
4) Click on the same datetime field again, now observe that the ctxpopup's arrow has concided with the diskselector as it wasn't resized properly.

Reviewers: raster, Hermet, shilpasingh, subodh6129, seoz

Reviewed By: shilpasingh, subodh6129

Subscribers: rajeshps, govi, poornima.srinivasan

Differential Revision: https://phab.enlightenment.org/D2628

src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c

index c8b345de42bd5bcb16dbb26f7d1921a52475ac9f..05d59dc17fb2b59a70b23da32027d90d39e7f85f 100644 (file)
@@ -34,12 +34,12 @@ _diskselector_item_free_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event
 }
 
 static void
-_ctxpopup_dismissed_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED )
+_ctxpopup_dismissed_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
 {
-   Evas_Object *diskselector;
-
-   diskselector = elm_object_content_unset(obj);
-   if (diskselector) evas_object_del(diskselector);
+   Ctxpopup_Module_Data *ctx_mod;
+   ctx_mod = (Ctxpopup_Module_Data *)data;
+   evas_object_del(obj);
+   ctx_mod->ctxpopup = NULL;
 }
 
 static void
@@ -140,21 +140,16 @@ _field_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
 
    snprintf(buf, sizeof(buf), "datetime/%s", elm_object_style_get(obj));
 
-   if (!ctx_mod->ctxpopup)
-     {
-        ctx_mod->ctxpopup = elm_ctxpopup_add(obj);
-        elm_object_style_set(ctx_mod->ctxpopup, buf);
-        elm_ctxpopup_horizontal_set(ctx_mod->ctxpopup, EINA_TRUE);
-        evas_object_size_hint_weight_set(ctx_mod->ctxpopup, EVAS_HINT_EXPAND,
-                                         EVAS_HINT_EXPAND);
-        evas_object_size_hint_align_set(ctx_mod->ctxpopup, EVAS_HINT_FILL, 0.5);
-        evas_object_smart_callback_add(ctx_mod->ctxpopup, "dismissed",
-                                       _ctxpopup_dismissed_cb, ctx_mod);
-     }
-
+   ctx_mod->ctxpopup = elm_ctxpopup_add(obj);
+   elm_object_style_set(ctx_mod->ctxpopup, buf);
+   elm_ctxpopup_horizontal_set(ctx_mod->ctxpopup, EINA_TRUE);
+   evas_object_size_hint_weight_set(ctx_mod->ctxpopup, EVAS_HINT_EXPAND,
+                                    EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(ctx_mod->ctxpopup, EVAS_HINT_FILL, 0.5);
+   evas_object_smart_callback_add(ctx_mod->ctxpopup, "dismissed",
+                                  _ctxpopup_dismissed_cb, ctx_mod);
    elm_ctxpopup_hover_parent_set(ctx_mod->ctxpopup, elm_widget_top_get(obj));
 
-   // because of the diskselector behaviour, it is being recreated
    diskselector = elm_diskselector_add(elm_widget_top_get(ctx_mod->mod_data.base));
    evas_object_smart_callback_add(diskselector, "clicked", _diskselector_cb, NULL);
    elm_object_style_set(diskselector, buf);