if (!offer->source || offer->source->offer != offer)
return;
+ if (offer->source->set_selection) {
+ wl_resource_post_error(offer->resource,
+ WL_DATA_OFFER_ERROR_INVALID_FINISH,
+ "finish only valid for drag n drop");
+ return;
+ }
+
/* Disallow finish while we have a grab driving drag-and-drop, or
* if the negotiation is not at the right stage
*/
seat->selection_data_source = source;
seat->selection_serial = serial;
+ source->set_selection = true;
if (keyboard)
focus = keyboard->focus;
source->dnd_actions = 0;
source->current_dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE;
source->compositor_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE;
+ source->set_selection = false;
wl_array_init(&source->mime_types);