more correctly handle dnd completion for wl

* always send cancel when drag is !accepted
* always null e_comp_wl->drag_source
This commit is contained in:
Mike Blumenkrantz 2017-02-10 17:23:43 -05:00
parent b568e7abb1
commit 75ff919036
1 changed files with 25 additions and 31 deletions

View File

@ -534,7 +534,9 @@ _e_comp_wl_data_device_selection_set(void *data EINA_UNUSED, E_Comp_Wl_Data_Sour
static void
_e_comp_wl_data_device_drag_finished(E_Drag *drag, int dropped)
{
struct wl_resource *res = NULL;
Evas_Object *o, *z;
E_Comp_Wl_Data_Source *data_source = e_comp_wl->drag_source;
o = edje_object_part_swallow_get(drag->comp_object, "e.swallow.content");
if (eina_streq(evas_object_type_get(o), "e_comp_object"))
@ -552,7 +554,6 @@ _e_comp_wl_data_device_drag_finished(E_Drag *drag, int dropped)
e_comp_wl->drag_client = NULL;
e_screensaver_inhibit_toggle(0);
if (dropped) return;
if (e_comp_wl->selection.target)
#ifndef HAVE_WAYLAND_ONLY
if (e_comp_wl->selection.target && e_client_has_xwindow(e_comp_wl->selection.target))
{
@ -564,15 +565,10 @@ _e_comp_wl_data_device_drag_finished(E_Drag *drag, int dropped)
return;
}
#endif
if (e_comp_wl->selection.target)
{
struct wl_resource *res;
E_Comp_Wl_Data_Source *data_source = e_comp_wl->drag_source;
if (e_comp_wl->selection.target)
res = e_comp_wl_data_find_for_client(wl_resource_get_client(e_comp_wl->selection.target->comp_data->surface));
if (res)
{
if (data_source->accepted && data_source->current_dnd_action)
if (res && data_source->accepted && data_source->current_dnd_action)
{
wl_data_device_send_drop(res);
if (wl_resource_get_version(data_source->resource) >=
@ -585,8 +581,7 @@ _e_comp_wl_data_device_drag_finished(E_Drag *drag, int dropped)
else if (wl_resource_get_version(data_source->resource) >=
WL_DATA_SOURCE_DND_FINISHED_SINCE_VERSION)
wl_data_source_send_cancelled(data_source->resource);
wl_data_device_send_leave(res);
}
if (res) wl_data_device_send_leave(res);
#ifndef HAVE_WAYLAND_ONLY
if (e_comp_util_has_xwayland())
{
@ -597,7 +592,6 @@ _e_comp_wl_data_device_drag_finished(E_Drag *drag, int dropped)
#endif
e_comp_wl->selection.target = NULL;
e_comp_wl->drag_source = NULL;
}
}
static void