}
EAPI Eina_Bool
-elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object *obj,
+elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection,
Elm_Sel_Format format, const void *selbuf, size_t buflen)
{
#ifdef HAVE_ELEMENTARY_X
return EINA_FALSE;
if (!_elm_cnp_init_count) _elm_cnp_init();
if ((!selbuf) && (format != ELM_SEL_FORMAT_IMAGE))
- return elm_cnp_selection_clear(selection, obj);
+ return elm_object_cnp_selection_clear(obj, selection);
sel = selections + selection;
{
if (format == ELM_SEL_FORMAT_IMAGE)
{
- sel->selbuf = malloc(buflen+1);
+ // selbuf is actual image data, not text/string
+ sel->selbuf = malloc(buflen);
memcpy(sel->selbuf, selbuf, buflen);
}
else
}
EAPI Eina_Bool
-elm_cnp_selection_clear(Elm_Sel_Type selection, Evas_Object *obj)
+elm_object_cnp_selection_clear(Evas_Object *obj, Elm_Sel_Type selection)
{
#ifdef HAVE_ELEMENTARY_X
Cnp_Selection *sel;
}
EAPI Eina_Bool
-elm_cnp_selection_get(Elm_Sel_Type selection, Elm_Sel_Format format,
- Evas_Object *obj, Elm_Drop_Cb datacb, void *udata)
+elm_cnp_selection_get(Evas_Object *obj, Elm_Sel_Type selection,
+ Elm_Sel_Format format, Elm_Drop_Cb datacb, void *udata)
{
#ifdef HAVE_ELEMENTARY_X
Evas_Object *top;
if ((j == CNP_ATOM_text_uri) ||
(j == CNP_ATOM_text_urilist))
{
- if(!is_uri_type_data(sel, notify)) continue;
+ if (!is_uri_type_data(sel, notify)) continue;
}
cnp_debug("Atom %s matches\n",atoms[j].name);
goto done;
{
Ecore_X_Selection_Data *data;
char *str;
+ char *mkupstr;
data = notify->data;
+ str = malloc(sizeof(char) * (data->length + 1));
+ if (!str) return 0;
+ strncpy(str, (char *)data->data, data->length);
+ str[data->length] = '\0';
if (sel->datacb)
{
ddata.data = data->data;
ddata.len = data->length;
sel->datacb(sel->udata, sel->widget, &ddata);
+ free(str);
return 0;
}
- 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("Notify handler text %d %d %p\n", data->format,
+ data->length, data->data);
+ mkupstr = _elm_util_text_to_mkup((const char *)str);
cnp_debug("String is %s (from %s)\n", str, data->data);
- _elm_entry_entry_paste(sel->requestwidget, str);
+ _elm_entry_entry_paste(sel->requestwidget, mkupstr);
free(str);
+ free(mkupstr);
return 0;
}
ecore_x_dnd_callback_pos_update_set(_drag_move, NULL);
ecore_x_dnd_begin(xwin, (unsigned char *)&xdnd, sizeof(Elm_Sel_Type));
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP,
- _drag_mouse_up, (uintptr_t *)xwin);
+ _drag_mouse_up, (void *)(long)xwin);
handler_status = ecore_event_handler_add(ECORE_X_EVENT_XDND_STATUS,
_dnd_status, NULL);