From: Hyoyoung Chang <hyoyoung@gmail.com>

Subject: [E-devel] [patch] elm_cnp_helper - bugfix mixing with ecore selection set apis
Date: Tue, 20 Dec 2011 18:57:25 +0900

Dear all

When ecore selection set apis(such as ecore_x_selection_clipboard_set)
used in elementary,
Some data is not pasted to elementary widgets.
It's due to mix ecore selection with elementary selection apis.

Data which by ecore doesn't have TARGETS information,
so elementary make it up with TARGETS Information for copying & pasting.

Thank you.


SVN revision: 66407
This commit is contained in:
Hyoyoung Chang 2011-12-21 03:49:53 +00:00 committed by Mike Blumenkrantz
parent d3b9a3ac50
commit fe1cf81624
2 changed files with 14 additions and 13 deletions

View File

@ -594,7 +594,8 @@ _get_selection_type(void *data, int size)
{
Cnp_Selection *sel;
sel = selections + *((int *)data);
if (sel->active)
if (sel->active &&
(sel->format >= ELM_SEL_TARGETS) && (sel->format < ELM_SEL_FORMAT_MAX))
return sel->format;
}
return ELM_SEL_FORMAT_NONE;
@ -606,32 +607,30 @@ targets_converter(char *target __UNUSED__, void *data, int size, void **data_ret
int i,count;
Ecore_X_Atom *aret;
Cnp_Selection *sel;
Elm_Sel_Format seltype;
if (!data_ret) return EINA_FALSE;
if (_get_selection_type(data, size) == ELM_SEL_FORMAT_NONE)
{
if (data_ret)
{
*data_ret = malloc(size * sizeof(char) + 1);
memcpy(*data_ret, data, size);
((char**)(data_ret))[0][size] = 0;
}
if (size_ret) *size_ret = size;
return EINA_TRUE;
/* TODO : fallback into precise type */
seltype = ELM_SEL_FORMAT_TEXT;
}
else
{
sel = selections + *((int *)data);
seltype = sel->format;
}
sel = selections + *((int *)data);
for (i = 0, count = 0; i < CNP_N_ATOMS ; i++)
{
if (sel->format & atoms[i].formats) count++;
if (seltype & atoms[i].formats) count++;
}
aret = malloc(sizeof(Ecore_X_Atom) * count);
for (i = 0, count = 0; i < CNP_N_ATOMS; i++)
{
if (sel->format & atoms[i].formats) aret[count ++] = atoms[i].atom;
if (seltype & atoms[i].formats) aret[count ++] = atoms[i].atom;
}
*data_ret = aret;

View File

@ -741,6 +741,8 @@ typedef enum _Elm_Sel_Format
ELM_SEL_FORMAT_VCARD = 0x08,
/** Raw HTMLish things for widgets that want that stuff (hello webkit!) */
ELM_SEL_FORMAT_HTML = 0x10,
ELM_SEL_FORMAT_MAX
} Elm_Sel_Format;
struct _Elm_Selection_Data