devilhorns pushed a commit to branch master.

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

commit 7147e8b487cfdc61886f0adebca8cd85457833af
Author: Chris Michael <[email protected]>
Date:   Wed Aug 12 10:18:41 2015 -0400

    elementary: Fix Copy and Paste test to actually paste clipboard text
    
    Summary: The Elm Copy and Paste test was not actually pasting the
    copied text into the entry when the Paste button was clicked. This
    patch fixes that issue.
    
    @fix
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/bin/test_cnp.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/bin/test_cnp.c b/src/bin/test_cnp.c
index 66f8bc4..35de89e 100644
--- a/src/bin/test_cnp.c
+++ b/src/bin/test_cnp.c
@@ -17,9 +17,11 @@ _bt_copy_clicked(void *data, Evas_Object *obj EINA_UNUSED, 
void *event_info EINA
 }
 
 static Eina_Bool
-_selection(void *d EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 
Elm_Selection_Data *ev)
+_selection(void *data, Evas_Object *obj EINA_UNUSED, Elm_Selection_Data *ev)
 {
+   Evas_Object *en = data;
    const char *fmt = NULL;
+
    switch (ev->format)
      {
         case ELM_SEL_FORMAT_TARGETS: fmt = "TARGETS"; break;
@@ -31,6 +33,18 @@ _selection(void *d EINA_UNUSED, Evas_Object *obj 
EINA_UNUSED, Elm_Selection_Data
         case ELM_SEL_FORMAT_HTML: fmt = "HTML"; break;
      }
    fprintf(stderr, "got selection type '%s': length %zu\n", fmt, ev->len);
+
+   if (ev->format == ELM_SEL_FORMAT_TEXT)
+     {
+        char *stripstr;
+
+        stripstr = malloc(ev->len + 1);
+        strncpy(stripstr, (char *)ev->data, ev->len);
+        stripstr[ev->len] = '\0';
+        elm_entry_entry_insert(en, stripstr);
+        free(stripstr);
+     }
+
    return EINA_TRUE;
 }
 
@@ -40,7 +54,7 @@ _bt_paste_clicked(void *data, Evas_Object *obj EINA_UNUSED, 
void *event_info EIN
    Evas_Object *en = data;
 
    elm_cnp_selection_get(en, ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT,
-                         _selection, NULL);
+                         _selection, en);
 }
 
 static void

-- 


Reply via email to