static Eina_Bool _wl_dnd_drop(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
/* static Eina_Bool _wl_dnd_offer(void *data EINA_UNUSED, int type EINA_UNUSED, void *event); */
-static Eina_Bool _wl_dnd_send(void *data, int type EINA_UNUSED, void *event);
static Eina_Bool _wl_dnd_receive(void *data, int type EINA_UNUSED, void *event);
static Eina_Bool _wl_dnd_end(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED);
static void _wl_dropable_data_handle(Wl_Cnp_Selection *sel, Ecore_Wl_Event_Selection_Data_Ready *ev);
}
static Eina_Bool
-_wl_selection_send(void *udata, int type EINA_UNUSED, void *event)
+_wl_selection_send(void *data, int type EINA_UNUSED, void *event)
{
cnp_debug("In\n");
char *buf;
int ret, len_remained;
int len_written = 0;
- Wl_Cnp_Selection *sel = udata;
- Ecore_Wl_Event_Data_Source_Send *ev = event;
+ Wl_Cnp_Selection *sel;
+ Ecore_Wl_Event_Data_Source_Send *ev;
+ void *data_ret = NULL;
+ int len_ret = 0;
+ int i = 0;
+
+ _wl_elm_cnp_init();
+ cnp_debug("In\n");
+ ev = event;
+ sel = data;
+
// TIZEN ONLY(20160627): support multiple selection types' buffer
// use priority: dnd->clipboard->primary->secondary
sel = NULL;
- Wl_Cnp_Selection *sels = udata;
+ Wl_Cnp_Selection *sels = data;
if (sels[ELM_SEL_TYPE_XDND].active)
{
sel = sels + ELM_SEL_TYPE_XDND;
if (!sel) return EINA_FALSE;
//
- _wl_elm_cnp_init();
+ for (i = 0; i < CNP_N_ATOMS; i++)
+ {
+ if (!strcmp(_atoms[i].name, ev->type))
+ {
+ cnp_debug("Found a type: %s\n", _atoms[i].name);
+ Dropable *drop;
+ eo_do(sel->requestwidget, drop = eo_key_data_get("__elm_dropable"));
+ if (drop)
+ drop->last.type = _atoms[i].name;
+ if (_atoms[i].wl_converter)
+ {
+ _atoms[i].wl_converter(ev->type, sel, sel->selbuf,
+ sel->buflen, &data_ret, &len_ret);
+ }
+ else
+ {
+ data_ret = strdup(sel->selbuf);
+ len_ret = sel->buflen;
+ }
+ break;
+ }
+ }
- len_remained = sel->buflen;
- buf = sel->selbuf;
+ len_remained = len_ret;
+ buf = data_ret;
+ cnp_debug("write: %s", buf);
- while (len_written < sel->buflen)
+ while (len_written < len_ret)
{
ret = write(ev->fd, buf, len_remained);
if (ret == -1) break;
len_written += ret;
len_remained -= ret;
}
+ free(data_ret);
close(ev->fd);
return ECORE_CALLBACK_PASS_ON;
text_uri = eina_stringshare_add("text/uri-list");
- ecore_event_handler_add(ECORE_WL_EVENT_DATA_SOURCE_SEND,
- //_wl_dnd_send, &wl_cnp_selection);// TIZEN ONLY(20160627)
- _wl_dnd_send, &wl_cnp_selections);// TIZEN ONLY(20160627)
+ _wl_elm_cnp_init();
ecore_event_handler_add(ECORE_WL_EVENT_SELECTION_DATA_READY,
//_wl_dnd_receive, &wl_cnp_selection);// TIZEN ONLY(20160627)
_wl_dnd_receive, &wl_cnp_selections);// TIZEN ONLY(20160627)
}
static Eina_Bool
-_wl_dnd_send(void *data, int type EINA_UNUSED, void *event)
-{
- char *buf;
- int ret, len_remained;
- int len_written = 0;
- Wl_Cnp_Selection *sel;
- Ecore_Wl_Event_Data_Source_Send *ev;
- void *data_ret = NULL;
- int len_ret = 0;
- int i = 0;
-
- cnp_debug("In\n");
- ev = event;
- // TIZEN ONLY(20160627): support multiple selection types' buffer
- Wl_Cnp_Selection *sels = data;
- sel = NULL;
- //use priority: dnd->clipboard->primary->secondary
- if (sels[ELM_SEL_TYPE_XDND].active)
- {
- sel = sels + ELM_SEL_TYPE_XDND;
- cnp_debug("dnd type\n");
- }
- else if (sels[ELM_SEL_TYPE_CLIPBOARD].active)
- {
- sel = sels + ELM_SEL_TYPE_CLIPBOARD;
- cnp_debug("Clipboard type\n");
- }
- else if (sels[ELM_SEL_TYPE_SECONDARY].active)
- {
- sel = sels + ELM_SEL_TYPE_SECONDARY;
- cnp_debug("Secondary type\n");
- }
- else
- {
- sel = sels + ELM_SEL_TYPE_PRIMARY;
- cnp_debug("Primary type\n");
- }
- if (!sel) return EINA_FALSE;
- //sel = data;
- //
-
- for (i = 0; i < CNP_N_ATOMS; i++)
- {
- if (!strcmp(_atoms[i].name, ev->type))
- {
- cnp_debug("Found a type: %s\n", _atoms[i].name);
- Dropable *drop;
- eo_do(sel->requestwidget, drop = eo_key_data_get("__elm_dropable"));
- if (drop)
- drop->last.type = _atoms[i].name;
- if (_atoms[i].wl_converter)
- {
- _atoms[i].wl_converter(ev->type, sel, sel->selbuf,
- sel->buflen, &data_ret, &len_ret);
- }
- else
- {
- data_ret = strdup(sel->selbuf);
- len_ret = sel->buflen;
- }
- break;
- }
- }
-
- len_remained = len_ret;
- buf = data_ret;
- cnp_debug("write: %s\n", buf);
-
- while (len_written < len_ret)
- {
- ret = write(ev->fd, buf, len_remained);
- if (ret == -1) break;
- buf += ret;
- len_written += ret;
- len_remained -= ret;
- }
- free(data_ret);
-
- close(ev->fd);
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
_wl_dnd_receive(void *data, int type EINA_UNUSED, void *event)
{
Wl_Cnp_Selection *sel;