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 10b1ba2b23
commit 3a83c9db9e
1 changed files with 25 additions and 31 deletions

View File

@ -536,7 +536,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"))
@ -554,7 +556,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))
{
@ -566,15 +567,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) >=
@ -587,8 +583,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())
{
@ -600,7 +595,6 @@ _e_comp_wl_data_device_drag_finished(E_Drag *drag, int dropped)
e_comp_wl->selection.target = NULL;
e_comp_wl->drag_source = NULL;
}
}
static void
_e_comp_wl_data_device_drag_key(E_Drag *drag EINA_UNUSED, Ecore_Event_Key *ev)