cnp: fix wayland drop format selection

previously the drop format was chosen in a manner unrelated to what
the offered format was, leading to applications receiving either the correct
data with the wrong format, the wrong data with the wrong format, or
the wrong data with the correct format. by comparing the drop handler
types with the offered type and ensuring that there is a match, the
correctness of the format that the application receives is more reliable

@fix
This commit is contained in:
Mike Blumenkrantz 2015-08-13 14:51:17 -04:00
parent 2ace38aba0
commit 3096e62408
1 changed files with 7 additions and 9 deletions

View File

@ -3240,17 +3240,15 @@ _wl_dropable_data_handle(Wl_Cnp_Selection *sel, char *data)
Dropable_Cbs *cbs;
EINA_INLIST_FOREACH_SAFE(drop->cbs_list, itr, cbs)
{
if (cbs->types && drop->last.format)
if (cbs->types & drop->last.format)
{
/* If it's markup that also supports images */
if (cbs->types & (ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_IMAGE))
if ((cbs->types & ELM_SEL_FORMAT_IMAGE) && (drop->last.format & ELM_SEL_FORMAT_IMAGE))
{
sdata.format = ELM_SEL_FORMAT_MARKUP;
sdata.data = (char *)savedtypes.imgfile;
}
else if (cbs->types & ELM_SEL_FORMAT_IMAGE)
{
sdata.format = ELM_SEL_FORMAT_IMAGE;
/* If it's markup that also supports images */
if ((cbs->types & ELM_SEL_FORMAT_MARKUP) && (drop->last.format & ELM_SEL_FORMAT_MARKUP))
sdata.format = ELM_SEL_FORMAT_MARKUP;
else
sdata.format = ELM_SEL_FORMAT_IMAGE;
sdata.data = (char *)savedtypes.imgfile;
}
else