Merge "Elementary migration revision 69922 Merge remote-tracking branch 'remotes...
authorJeonghyun Yun <jh0506.yun@samsung.com>
Thu, 5 Apr 2012 23:38:08 +0000 (08:38 +0900)
committerGerrit Code Review <gerrit2@localhost>
Thu, 5 Apr 2012 23:38:08 +0000 (08:38 +0900)
src/lib/elm_cnp.c
src/lib/elm_entry.c

index b705e04..a8b2b46 100644 (file)
@@ -813,31 +813,46 @@ notify_handler_text(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify)
 {
    Ecore_X_Selection_Data *data;
    char *str;
+   char *mkupstr;
 
    data = notify->data;
+   str = malloc(sizeof(char) * (data->length + 1));
+   if (str)
+     {
+        strncpy(str, (char *)data->data, data->length);
+        str[data->length] = '\0';
+     }
+   else
+     str = data->data;
 
    if (sel->datacb)
      {
         Elm_Selection_Data ddata;
-        str = malloc(sizeof(char) * (data->length + 1));
-        strncpy(str, (char *)data->data, data->length);
-        str[data->length] = '\0';
 
         ddata.x = ddata.y = 0;
         ddata.format = ELM_SEL_FORMAT_TEXT;
         ddata.data = str;
         ddata.len = data->length;
         sel->datacb(sel->udata, sel->widget, &ddata);
-        free(str);
-        return 0;
+     }
+   else
+     {
+        cnp_debug("Notify handler text %d %d %p\n", data->format, data->length, data->data);
+        mkupstr = _elm_util_text_to_mkup((const char *) str);
+        if (mkupstr)
+          {
+             entry_insert_filter(sel->requestwidget, mkupstr);
+             free(mkupstr);
+          }
+        else
+          entry_insert_filter(sel->requestwidget, str);
+
+        cnp_debug("String is %s (from %s)\n", str, data->data);
+        //_elm_entry_entry_paste(sel->requestwidget, str);
      }
 
-   cnp_debug("Notify handler text %d %d %p\n", data->format,data->length, data->data);
-   str = _elm_util_text_to_mkup((const char *) data->data);
-   cnp_debug("String is %s (from %s)\n", str, data->data);
-   entry_insert_filter(sel->requestwidget, str);
-   //_elm_entry_entry_paste(sel->requestwidget, str);
-   free(str);
+   if (str != data->data)
+     free(str);
    return 0;
 }
 
index bb42ded..b1d90db 100644 (file)
@@ -1305,6 +1305,13 @@ _elm_entry_entry_paste(Evas_Object *obj, const char *entry)
 
    edje_object_part_text_user_insert(wd->ent, "elm.text", str);
    if (str != entry) free(str);
+
+   // start for cbhm
+#ifdef HAVE_ELEMENTARY_X
+   if (cnpwidgetdata == obj)
+      ecore_x_selection_secondary_set(elm_win_xwindow_get(obj), "",1);
+#endif
+   // end for cbhm
 }
 
 static void