From 25b887b0c136d5a4bae1b5bf2ad36fb8ff9149ad Mon Sep 17 00:00:00 2001 From: tasn Date: Mon, 8 Aug 2011 07:51:02 +0000 Subject: [PATCH] Elm entry: Fixed 'Paste' to only show if there clipboard isn't empty. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@62193 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/elm_cnp_helper.c | 10 ++++++++++ src/lib/elm_entry.c | 2 +- src/lib/elm_widget.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lib/elm_cnp_helper.c b/src/lib/elm_cnp_helper.c index ee9511c..cddb58a 100644 --- a/src/lib/elm_cnp_helper.c +++ b/src/lib/elm_cnp_helper.c @@ -390,6 +390,16 @@ static Ecore_Event_Handler *handler_status = NULL; static const char *text_uri; Eina_Bool +elm_selection_selection_has_owner(void) +{ +#ifdef HAVE_ELEMENTARY_X + return !!ecore_x_selection_owner_get(clipboard_atom); +#else + return EINA_FALSE; +#endif +} + +Eina_Bool elm_selection_set(Elm_Sel_Type selection, Evas_Object *widget, Elm_Sel_Format format, const char *selbuf) { #ifdef HAVE_ELEMENTARY_X diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index 851c202..03bde8b 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -1078,7 +1078,7 @@ _menu_press(Evas_Object *obj) elm_hoversel_item_add(wd->hoversel, E_("Select"), NULL, ELM_ICON_NONE, _select, obj); } - if (1) // need way to detect if someone has a selection + if (elm_selection_selection_has_owner()) { if (wd->editable) elm_hoversel_item_add(wd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE, diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h index fb90163..24c7936 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -673,6 +673,7 @@ struct _Elm_Selection_Data Eina_Bool elm_selection_set(Elm_Sel_Type selection, Evas_Object *widget, Elm_Sel_Format format, const char *buf); Eina_Bool elm_selection_clear(Elm_Sel_Type selection, Evas_Object *widget); Eina_Bool elm_selection_get(Elm_Sel_Type selection, Elm_Sel_Format format, Evas_Object *widget, Elm_Drop_Cb datacb, void *udata); +Eina_Bool elm_selection_selection_has_owner(void); Eina_Bool elm_drop_target_add(Evas_Object *widget, Elm_Sel_Type, Elm_Drop_Cb, void *); Eina_Bool elm_drop_target_del(Evas_Object *widget); Eina_Bool elm_drag_start(Evas_Object *, Elm_Sel_Format, const char *, void (*)(void *,Evas_Object*),void*); -- 2.7.4