From 3096e62408e28b0887b5422f4f1d070e5e921f80 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 13 Aug 2015 14:51:17 -0400 Subject: [PATCH] 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 --- legacy/elementary/src/lib/elm_cnp.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/legacy/elementary/src/lib/elm_cnp.c b/legacy/elementary/src/lib/elm_cnp.c index 98835b6ed8..1bb657a279 100644 --- a/legacy/elementary/src/lib/elm_cnp.c +++ b/legacy/elementary/src/lib/elm_cnp.c @@ -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