summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@yahoo.com>2015-06-19 14:18:18 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2015-06-21 10:14:58 +0300
commit719eb670c06977dbb1c5097909020c84d8c00c9d (patch)
tree9296b447d2c6533ed671e61415ba06b93f9beee8
parentac874ffe6254d85bd0a5c05d99c8fa573d04d9d5 (diff)
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.
-rw-r--r--src/lib/elm_cnp.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index 22e71e121..3a3bb531d 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -755,8 +755,8 @@ _x11_selection_notify(void *udata EINA_UNUSED, int type EINA_UNUSED, void *event
755 } 755 }
756 cnp_debug("Target is %s\n", ev->target); 756 cnp_debug("Target is %s\n", ev->target);
757 757
758 if (!strcmp(ev->target, "TARGETS") || 758 if (ev->selection != ECORE_X_SELECTION_XDND &&
759 !strcmp(ev->target, "ATOMS")) 759 (!strcmp(ev->target, "TARGETS") || !strcmp(ev->target, "ATOMS")))
760 { 760 {
761 _x11_notify_handler_targets(sel, ev); 761 _x11_notify_handler_targets(sel, ev);
762 return ECORE_CALLBACK_PASS_ON; 762 return ECORE_CALLBACK_PASS_ON;
@@ -852,13 +852,13 @@ _x11_targets_converter(char *target EINA_UNUSED, void *data, int size, void **da
852 seltype = sel->format; 852 seltype = sel->format;
853 } 853 }
854 854
855 for (i = 0, count = 0; i < CNP_N_ATOMS ; i++) 855 for (i = CNP_ATOM_LISTING_ATOMS + 1, count = 0; i < CNP_N_ATOMS ; i++)
856 { 856 {
857 if (seltype & _atoms[i].formats) count++; 857 if (seltype & _atoms[i].formats) count++;
858 } 858 }
859 aret = malloc(sizeof(Ecore_X_Atom) * count); 859 aret = malloc(sizeof(Ecore_X_Atom) * count);
860 if (!aret) return EINA_FALSE; 860 if (!aret) return EINA_FALSE;
861 for (i = 0, count = 0; i < CNP_N_ATOMS; i++) 861 for (i = CNP_ATOM_LISTING_ATOMS + 1, count = 0; i < CNP_N_ATOMS ; i++)
862 { 862 {
863 if (seltype & _atoms[i].formats) 863 if (seltype & _atoms[i].formats)
864 aret[count ++] = _atoms[i].x_atom; 864 aret[count ++] = _atoms[i].x_atom;
@@ -2160,17 +2160,9 @@ _x11_elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data,
2160 } 2160 }
2161 2161
2162 ecore_x_dnd_types_set(xwin, NULL, 0); 2162 ecore_x_dnd_types_set(xwin, NULL, 0);
2163 for (i = 0; i < CNP_N_ATOMS; i++) 2163 for (i = CNP_ATOM_LISTING_ATOMS + 1; i < CNP_N_ATOMS; i++)
2164 { 2164 {
2165 if (_atoms[i].formats == ELM_SEL_FORMAT_TARGETS) 2165 if (format == ELM_SEL_FORMAT_TARGETS || (_atoms[i].formats & format))
2166 {
2167 if (format == ELM_SEL_FORMAT_TARGETS)
2168 {
2169 ecore_x_dnd_type_set(xwin, _atoms[i].name, EINA_TRUE);
2170 cnp_debug("set dnd type: %s\n", _atoms[i].name);
2171 }
2172 }
2173 else if (_atoms[i].formats & format)
2174 { 2166 {
2175 ecore_x_dnd_type_set(xwin, _atoms[i].name, EINA_TRUE); 2167 ecore_x_dnd_type_set(xwin, _atoms[i].name, EINA_TRUE);
2176 cnp_debug("set dnd type: %s\n", _atoms[i].name); 2168 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,
2850 /* if we already have a drag, get out */ 2842 /* if we already have a drag, get out */
2851 if (dragwin) return EINA_FALSE; 2843 if (dragwin) return EINA_FALSE;
2852 2844
2853 for (i = 0; i < CNP_N_ATOMS; i++) 2845 for (i = CNP_ATOM_LISTING_ATOMS + 1; i < CNP_N_ATOMS; i++)
2854 { 2846 {
2855 if (_atoms[i].formats == ELM_SEL_FORMAT_TARGETS) 2847 if (format == ELM_SEL_FORMAT_TARGETS || (_atoms[i].formats & format))
2856 {
2857 if (format == ELM_SEL_FORMAT_TARGETS)
2858 {
2859 types[nb_types++] = _atoms[i].name;
2860 cnp_debug("set dnd type: %s\n", _atoms[i].name);
2861 }
2862 }
2863 else if (_atoms[i].formats & format)
2864 { 2848 {
2865 types[nb_types++] = _atoms[i].name; 2849 types[nb_types++] = _atoms[i].name;
2866 cnp_debug("set dnd type: %s\n", _atoms[i].name); 2850 cnp_debug("set dnd type: %s\n", _atoms[i].name);