jackdanielz pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=cb46964852650697d3f345606ab79e6fe6c7c8f8

commit cb46964852650697d3f345606ab79e6fe6c7c8f8
Author: Thiep Ha <thiep...@gmail.com>
Date:   Fri Sep 18 11:38:39 2015 +0300

    test_dnd: transfer text without markup when drag label
    
    Summary:
    In Types Dnd test, if we drag from label to entry, the text is inserted
    with "<br/>". The reason is that we drag with type ELM_SEL_FORMAT_TEXT
    but the transferred data is markup.
    This patch fixes it by changing the transferred data to text.
    
    @fix
    
    Reviewers: JackDanielZ
    
    Subscribers: seoz
    
    Differential Revision: https://phab.enlightenment.org/D3072
---
 src/bin/test_dnd.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/bin/test_dnd.c b/src/bin/test_dnd.c
index dd24585..40c2c61 100644
--- a/src/bin/test_dnd.c
+++ b/src/bin/test_dnd.c
@@ -1250,14 +1250,26 @@ _label_create_icon(void *data, Evas_Object *parent, 
Evas_Coord *xoff, Evas_Coord
 }
 
 static void
+_label_drag_done_cb(void *data, Evas_Object *obj EINA_UNUSED)
+{
+   free(data);
+}
+
+static void
 _label_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj 
EINA_UNUSED, void *event_info EINA_UNUSED)
 {
    Evas_Object *lb = data;
-   const char *text = elm_object_text_get(lb);
+   const char *mkup = elm_object_text_get(lb);
+   char *text = evas_textblock_text_markup_to_utf8(NULL, mkup);
 
+   if (!text)
+     {
+        printf("Cannot convert text\n");
+     }
    elm_drag_start(lb, ELM_SEL_FORMAT_TEXT, text, ELM_XDND_ACTION_COPY,
                   _label_create_icon, lb,
-                  NULL, NULL, NULL, NULL, NULL, NULL);
+                  NULL, NULL, NULL, NULL,
+                  _label_drag_done_cb, text);
 }
 
 static Evas_Object *

-- 


Reply via email to