From 1776d9b6477d42c078cec0444eef0a9da4196456 Mon Sep 17 00:00:00 2001 From: Daniel Zaoui Date: Fri, 19 Jun 2015 14:18:18 +0300 Subject: [PATCH] DnD: fix usage of TARGETS - TARGETS notifier is specific to CnP and should not be called for DnD - On DnD (when drag starts) and on CnP, it doesn't make sense that the TARGETS type are sent to the potential target. Only basic types should be sent. --- legacy/elementary/src/lib/elm_cnp.c | 32 ++++++++--------------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/legacy/elementary/src/lib/elm_cnp.c b/legacy/elementary/src/lib/elm_cnp.c index 22e71e1214..3a3bb531dd 100644 --- a/legacy/elementary/src/lib/elm_cnp.c +++ b/legacy/elementary/src/lib/elm_cnp.c @@ -755,8 +755,8 @@ _x11_selection_notify(void *udata EINA_UNUSED, int type EINA_UNUSED, void *event } cnp_debug("Target is %s\n", ev->target); - if (!strcmp(ev->target, "TARGETS") || - !strcmp(ev->target, "ATOMS")) + if (ev->selection != ECORE_X_SELECTION_XDND && + (!strcmp(ev->target, "TARGETS") || !strcmp(ev->target, "ATOMS"))) { _x11_notify_handler_targets(sel, ev); return ECORE_CALLBACK_PASS_ON; @@ -852,13 +852,13 @@ _x11_targets_converter(char *target EINA_UNUSED, void *data, int size, void **da seltype = sel->format; } - for (i = 0, count = 0; i < CNP_N_ATOMS ; i++) + for (i = CNP_ATOM_LISTING_ATOMS + 1, count = 0; i < CNP_N_ATOMS ; i++) { if (seltype & _atoms[i].formats) count++; } aret = malloc(sizeof(Ecore_X_Atom) * count); if (!aret) return EINA_FALSE; - for (i = 0, count = 0; i < CNP_N_ATOMS; i++) + for (i = CNP_ATOM_LISTING_ATOMS + 1, count = 0; i < CNP_N_ATOMS ; i++) { if (seltype & _atoms[i].formats) aret[count ++] = _atoms[i].x_atom; @@ -2160,17 +2160,9 @@ _x11_elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data, } ecore_x_dnd_types_set(xwin, NULL, 0); - for (i = 0; i < CNP_N_ATOMS; i++) + for (i = CNP_ATOM_LISTING_ATOMS + 1; i < CNP_N_ATOMS; i++) { - if (_atoms[i].formats == ELM_SEL_FORMAT_TARGETS) - { - if (format == ELM_SEL_FORMAT_TARGETS) - { - ecore_x_dnd_type_set(xwin, _atoms[i].name, EINA_TRUE); - cnp_debug("set dnd type: %s\n", _atoms[i].name); - } - } - else if (_atoms[i].formats & format) + if (format == ELM_SEL_FORMAT_TARGETS || (_atoms[i].formats & format)) { ecore_x_dnd_type_set(xwin, _atoms[i].name, EINA_TRUE); cnp_debug("set dnd type: %s\n", _atoms[i].name); @@ -2850,17 +2842,9 @@ _wl_elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data, /* if we already have a drag, get out */ if (dragwin) return EINA_FALSE; - for (i = 0; i < CNP_N_ATOMS; i++) + for (i = CNP_ATOM_LISTING_ATOMS + 1; i < CNP_N_ATOMS; i++) { - if (_atoms[i].formats == ELM_SEL_FORMAT_TARGETS) - { - if (format == ELM_SEL_FORMAT_TARGETS) - { - types[nb_types++] = _atoms[i].name; - cnp_debug("set dnd type: %s\n", _atoms[i].name); - } - } - else if (_atoms[i].formats & format) + if (format == ELM_SEL_FORMAT_TARGETS || (_atoms[i].formats & format)) { types[nb_types++] = _atoms[i].name; cnp_debug("set dnd type: %s\n", _atoms[i].name);