From caf62d9f6d758a55a1d23851daae65c98d7e00bb Mon Sep 17 00:00:00 2001 From: Daniel Juyung Seo Date: Thu, 22 Nov 2012 15:15:55 +0000 Subject: [PATCH] elm elm_entry.c: Fixed 1. Removed duplicated have_selection check. 2. enable have_selection only when a text is actually selected. Patch by Thiep Ha On Mon, Nov 19, 2012 at 9:33 PM, thiep ha wrote: Dear All, I have seen that if there is no selection in an entry, the copy/cut menus are still shown in entry. (Example: double click at the end of entry or on an empty entry). I modified source code to not show copy/cut menus in above scenario. I also removed the redundant checking condition for showing copy/cut menus. Please review this patch. Best Regards, Thiep Ha SVN revision: 79545 --- src/lib/elm_entry.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index 8a58f78..ec89def 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -1250,16 +1250,13 @@ _menu_call(Evas_Object *obj) { if (!sd->password) { - if (sd->have_selection) - { - elm_hoversel_item_add - (sd->hoversel, E_("Copy"), NULL, ELM_ICON_NONE, - _copy_cb, obj); - if (sd->editable) - elm_hoversel_item_add - (sd->hoversel, E_("Cut"), NULL, ELM_ICON_NONE, - _cut_cb, obj); - } + elm_hoversel_item_add + (sd->hoversel, E_("Copy"), NULL, ELM_ICON_NONE, + _copy_cb, obj); + if (sd->editable) + elm_hoversel_item_add + (sd->hoversel, E_("Cut"), NULL, ELM_ICON_NONE, + _cut_cb, obj); elm_hoversel_item_add (sd->hoversel, E_("Cancel"), NULL, ELM_ICON_NONE, _hover_cancel_cb, obj); @@ -1284,6 +1281,10 @@ _menu_call(Evas_Object *obj) _paste_cb, obj); } } + else + elm_hoversel_item_add + (sd->hoversel, E_("Cancel"), NULL, ELM_ICON_NONE, + _hover_cancel_cb, obj); } EINA_LIST_FOREACH(sd->items, l, it) @@ -1548,7 +1549,6 @@ _entry_selection_start_signal_cb(void *data, { if (entry != data) elm_entry_select_none(entry); } - sd->have_selection = EINA_TRUE; evas_object_smart_callback_call(data, SIG_SELECTION_START, NULL); #ifdef HAVE_ELEMENTARY_X if (sd->sel_notify_handler) @@ -3431,7 +3431,6 @@ elm_entry_select_all(Evas_Object *obj) (sd->entry_edje, "elm.text", EINA_FALSE); edje_object_signal_emit(sd->entry_edje, "elm,state,select,off", "elm"); } - sd->have_selection = EINA_TRUE; edje_object_part_text_select_all(sd->entry_edje, "elm.text"); } -- 2.7.4