summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hirt <daniel.hirt@samsung.com>2015-11-30 15:29:06 +0200
committerDaniel Hirt <daniel.hirt@samsung.com>2015-11-30 16:41:50 +0200
commite03e50b4c6b8bcc5d772fb1e5610a3808ba37151 (patch)
treebedc03b058f0e1b46dd13c866882131f473c144e
parentf129e78b203436aebd9858d62734cc2d0d9e8134 (diff)
Entry: add markup cnp handlers
In Elm_Cnp, a markup data preparer was missing, which resulted in _x11_notify_handler_targets not requesting "application/x-elementary-markup" (requested "UTF8_STRING" instead) when trying to paste markup text from one entry to another (or itself). Also, there was a missing handling in the selection data callback for ELM_SEL_FORMAT_MARKUP data format. This fixes issues like not being able to paste "item" formats to the entry widget. @fix
-rw-r--r--src/lib/elm_cnp.c13
-rw-r--r--src/lib/elm_entry.c4
2 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index fb3f2ae86..070105746 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -218,6 +218,7 @@ static Eina_Bool _x11_vcard_send (char *target, void *data, i
218static Eina_Bool _x11_is_uri_type_data (X11_Cnp_Selection *sel EINA_UNUSED, Ecore_X_Event_Selection_Notify *notify); 218static Eina_Bool _x11_is_uri_type_data (X11_Cnp_Selection *sel EINA_UNUSED, Ecore_X_Event_Selection_Notify *notify);
219static Eina_Bool _x11_notify_handler_targets (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify); 219static Eina_Bool _x11_notify_handler_targets (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify);
220static Eina_Bool _x11_data_preparer_text (Ecore_X_Event_Selection_Notify *notify, Elm_Selection_Data *ddata, Tmp_Info **tmp_info); 220static Eina_Bool _x11_data_preparer_text (Ecore_X_Event_Selection_Notify *notify, Elm_Selection_Data *ddata, Tmp_Info **tmp_info);
221static Eina_Bool _x11_data_preparer_markup (Ecore_X_Event_Selection_Notify *notify, Elm_Selection_Data *ddata, Tmp_Info **tmp_info);
221static Eina_Bool _x11_data_preparer_image (Ecore_X_Event_Selection_Notify *notify, Elm_Selection_Data *ddata, Tmp_Info **tmp_info); 222static Eina_Bool _x11_data_preparer_image (Ecore_X_Event_Selection_Notify *notify, Elm_Selection_Data *ddata, Tmp_Info **tmp_info);
222static Eina_Bool _x11_data_preparer_uri (Ecore_X_Event_Selection_Notify *notify, Elm_Selection_Data *ddata, Tmp_Info **tmp_info); 223static Eina_Bool _x11_data_preparer_uri (Ecore_X_Event_Selection_Notify *notify, Elm_Selection_Data *ddata, Tmp_Info **tmp_info);
223//static int _x11_notify_handler_html (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify); 224//static int _x11_notify_handler_html (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify);
@@ -451,6 +452,7 @@ static Cnp_Atom _atoms[CNP_N_ATOMS] = {
451 .formats = ELM_SEL_FORMAT_MARKUP, 452 .formats = ELM_SEL_FORMAT_MARKUP,
452#ifdef HAVE_ELEMENTARY_X 453#ifdef HAVE_ELEMENTARY_X
453 .x_converter = _x11_general_converter, 454 .x_converter = _x11_general_converter,
455 .x_data_preparer = _x11_data_preparer_markup,
454#endif 456#endif
455 }, 457 },
456 ARRAYINIT(CNP_ATOM_text_urilist) { 458 ARRAYINIT(CNP_ATOM_text_urilist) {
@@ -956,6 +958,17 @@ _x11_data_preparer_text(Ecore_X_Event_Selection_Notify *notify,
956 return EINA_TRUE; 958 return EINA_TRUE;
957} 959}
958 960
961static Eina_Bool
962_x11_data_preparer_markup(Ecore_X_Event_Selection_Notify *notify,
963 Elm_Selection_Data *ddata, Tmp_Info **tmp_info EINA_UNUSED)
964{
965 Ecore_X_Selection_Data *data = notify->data;
966 ddata->format = ELM_SEL_FORMAT_MARKUP;
967 ddata->data = eina_memdup(data->data, data->length, EINA_TRUE);
968 ddata->len = data->length;
969 return EINA_TRUE;
970}
971
959/** 972/**
960 * So someone is pasting an image into my entry or widget... 973 * So someone is pasting an image into my entry or widget...
961 */ 974 */
diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c
index 147a80900..b20ed77f0 100644
--- a/src/lib/elm_entry.c
+++ b/src/lib/elm_entry.c
@@ -673,6 +673,10 @@ _selection_data_cb(void *data EINA_UNUSED,
673 snprintf(entry_tag, len + 1, tag_string, buf); 673 snprintf(entry_tag, len + 1, tag_string, buf);
674 _edje_entry_user_insert(obj, entry_tag); 674 _edje_entry_user_insert(obj, entry_tag);
675 } 675 }
676 else if (sel_data->format & ELM_SEL_FORMAT_MARKUP)
677 {
678 _edje_entry_user_insert(obj, buf);
679 }
676 else 680 else
677 { 681 {
678 char *txt = _elm_util_text_to_mkup(buf); 682 char *txt = _elm_util_text_to_mkup(buf);