entry: update selection handlers' visibility when entry is hidden or shown
authorThiep Ha <thiepha@gmail.com>
Mon, 26 May 2014 02:28:12 +0000 (11:28 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Mon, 26 May 2014 02:28:12 +0000 (11:28 +0900)
Summary:
Selection handlers' visibility should be updated when entry is hidden or shown
When entry has selection and hidden, the selection handlers should be hidden also.
This fix T1175.

@fix

Reviewers: seoz, woohyun, raster

Reviewed By: raster

Maniphest Tasks: T1175

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

legacy/elementary/src/lib/elm_entry.c
legacy/elementary/src/lib/elm_entry.eo

index f1eea24..67dfa0b 100644 (file)
@@ -384,10 +384,16 @@ _hide_selection_handler(Evas_Object *obj)
 
    if (!sd->start_handler) return;
 
-   edje_object_signal_emit(sd->start_handler, "elm,handler,hide", "elm");
-   sd->start_handler_shown = EINA_FALSE;
-   edje_object_signal_emit(sd->end_handler, "elm,handler,hide", "elm");
-   sd->end_handler_shown = EINA_FALSE;
+   if (sd->start_handler_shown)
+     {
+        edje_object_signal_emit(sd->start_handler, "elm,handler,hide", "elm");
+        sd->start_handler_shown = EINA_FALSE;
+     }
+   if (sd->end_handler_shown)
+     {
+        edje_object_signal_emit(sd->end_handler, "elm,handler,hide", "elm");
+        sd->end_handler_shown = EINA_FALSE;
+     }
 }
 
 static Eina_Rectangle *
@@ -3562,6 +3568,25 @@ _elm_entry_evas_smart_resize(Eo *obj, Elm_Entry_Data *sd, Evas_Coord w, Evas_Coo
    eo_do_super(obj, MY_CLASS, evas_obj_smart_resize(w, h));
 
    evas_object_resize(sd->hit_rect, w, h);
+
+}
+
+EOLIAN static void
+_elm_entry_evas_smart_show(Eo *obj, Elm_Entry_Data *sd)
+{
+   eo_do_super(obj, MY_CLASS, evas_obj_smart_show());
+
+   if (sd->have_selection)
+     _update_selection_handler(obj);
+}
+
+EOLIAN static void
+_elm_entry_evas_smart_hide(Eo *obj, Elm_Entry_Data *sd)
+{
+   eo_do_super(obj, MY_CLASS, evas_obj_smart_hide());
+
+   if (sd->have_selection)
+     _hide_selection_handler(obj);
 }
 
 EOLIAN static void
index 6cf05c7..e0eeefa 100644 (file)
@@ -1163,6 +1163,8 @@ class Elm_Entry (Elm_Layout, Elm_Interface_Scrollable, Evas_Clickable_Interface)
       Evas_Smart::add;
       Evas_Smart::resize;
       Evas_Smart::del;
+      Evas_Smart::show;
+      Evas_Smart::hide;
       Elm_Widget::activate;
       Elm_Widget::focus_direction_manager_is;
       Elm_Widget::theme_apply;