diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c index 30ec57192..14fd5bfc9 100644 --- a/src/wayland/meta-wayland-data-device.c +++ b/src/wayland/meta-wayland-data-device.c @@ -51,6 +51,8 @@ struct _MetaWaylandDataOffer struct wl_resource *resource; MetaWaylandDataSource *source; struct wl_listener source_destroy_listener; + gboolean accepted; + gboolean action_sent; uint32_t dnd_actions; enum wl_data_device_manager_dnd_action preferred_dnd_action; }; @@ -169,7 +171,10 @@ data_offer_update_action (MetaWaylandDataOffer *offer) if (!meta_wayland_source_get_in_ask (source) && wl_resource_get_version (offer->resource) >= WL_DATA_OFFER_ACTION_SINCE_VERSION) - wl_data_offer_send_action (offer->resource, action); + { + wl_data_offer_send_action (offer->resource, action); + offer->action_sent = TRUE; + } } static void @@ -353,6 +358,8 @@ data_offer_accept (struct wl_client *client, meta_wayland_data_source_set_has_target (offer->source, mime_type != NULL); } + + offer->accepted = mime_type != NULL; } static void @@ -385,8 +392,7 @@ data_offer_finish (struct wl_client *client, offer != meta_wayland_data_source_get_current_offer (offer->source)) return; - if (meta_wayland_data_source_get_seat (offer->source) || - !meta_wayland_data_source_has_target (offer->source)) + if (!offer->accepted || !offer->action_sent) { wl_resource_post_error (offer->resource, WL_DATA_OFFER_ERROR_INVALID_FINISH,