summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-05-12 12:08:32 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-05-12 12:08:25 -0400
commit31f98a6d8117cabd9f2c582fdbc6ead370a5cbba (patch)
tree48a7062c77ee8eaa492583cde4dc520216c6b1b0
parent37ff7b43f11fcbc6859fe45584e34d72a13bef77 (diff)
downloadefl-31f98a6d8117cabd9f2c582fdbc6ead370a5cbba.tar.gz
elm_cnp: only attempt to manage wl selections which are created by elm_cnp
use serials of the selections and events to avoid mangling external selections
-rw-r--r--src/lib/elementary/elm_cnp.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/elementary/elm_cnp.c b/src/lib/elementary/elm_cnp.c
index 8430108c56..eff4c1441e 100644
--- a/src/lib/elementary/elm_cnp.c
+++ b/src/lib/elementary/elm_cnp.c
@@ -2389,6 +2389,8 @@ struct _Wl_Cnp_Selection
Elm_Sel_Format format;
Ecore_Wl2_Window *win;
Elm_Xdnd_Action action;
+ uint32_t selection_serial;
+ uint32_t drag_serial;
Eina_Bool active : 1;
};
@@ -2942,7 +2944,7 @@ _wl_elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Form
}
types[count - 1] = 0;
- ecore_wl2_dnd_selection_set(ecore_wl2_window_input_get(win), types);
+ sel->selection_serial = ecore_wl2_dnd_selection_set(ecore_wl2_window_input_get(win), types);
free(types);
return EINA_TRUE;
@@ -3142,7 +3144,7 @@ _wl_elm_cnp_selection_clear(Evas_Object *obj, Elm_Sel_Type selection EINA_UNUSED
ELM_SAFE_FREE(sel->selbuf, free);
sel->buflen = 0;
/* sel->clear(); */
- ecore_wl2_dnd_selection_clear(ecore_wl2_window_input_get(_wl_elm_widget_window_get(obj)));
+ sel->selection_serial = ecore_wl2_dnd_selection_clear(ecore_wl2_window_input_get(_wl_elm_widget_window_get(obj)));
return EINA_TRUE;
}
@@ -3163,6 +3165,9 @@ _wl_selection_send(void *data, int type EINA_UNUSED, void *event)
cnp_debug("In\n");
ev = event;
sel = data;
+ if ((ev->serial != sel->selection_serial) &&
+ (ev->serial != sel->drag_serial))
+ return ECORE_CALLBACK_RENEW;
for (i = 0; i < CNP_N_ATOMS; i++)
{
@@ -3455,7 +3460,7 @@ _wl_elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data,
parent = ecore_evas_wayland2_window_get(ee);
}
- ecore_wl2_dnd_drag_start(ecore_wl2_window_input_get(win), parent, win);
+ wl_cnp_selection.drag_serial = ecore_wl2_dnd_drag_start(ecore_wl2_window_input_get(win), parent, win);
return EINA_TRUE;
}
@@ -3723,7 +3728,8 @@ _wl_dnd_end(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
cnp_debug("In\n");
ev = event;
-
+ if (ev->serial != wl_cnp_selection.drag_serial)
+ return ECORE_CALLBACK_RENEW;
if (dragdonecb) dragdonecb(dragdonedata, dragwidget);
if (dragwin)