mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 01:50:42 -05:00
wayland/data-device: Don't disconnect valid dnd client
We cannot check 'has-target' or 'has-seat' when verifying a wl_data_offer.finish request is valid or not, since the source may have effected 'has-target' or whether theh source has a seat or not when the finish request was already on the wire. Instead of checking against the source state, keep track whether the required operations has been done on the offer in question (i.e. whether an action has been sent, or a mime type been accepted). This fixes incorrectly raised error when dragging from gtk+'s testdnd via Xwayland onto gtk+'s testdnd using Wayland. https://bugzilla.gnome.org/show_bug.cgi?id=770937
This commit is contained in:
parent
342532a98d
commit
60bc6798f4
@ -51,6 +51,8 @@ struct _MetaWaylandDataOffer
|
|||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
MetaWaylandDataSource *source;
|
MetaWaylandDataSource *source;
|
||||||
struct wl_listener source_destroy_listener;
|
struct wl_listener source_destroy_listener;
|
||||||
|
gboolean accepted;
|
||||||
|
gboolean action_sent;
|
||||||
uint32_t dnd_actions;
|
uint32_t dnd_actions;
|
||||||
enum wl_data_device_manager_dnd_action preferred_dnd_action;
|
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) &&
|
if (!meta_wayland_source_get_in_ask (source) &&
|
||||||
wl_resource_get_version (offer->resource) >=
|
wl_resource_get_version (offer->resource) >=
|
||||||
WL_DATA_OFFER_ACTION_SINCE_VERSION)
|
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
|
static void
|
||||||
@ -353,6 +358,8 @@ data_offer_accept (struct wl_client *client,
|
|||||||
meta_wayland_data_source_set_has_target (offer->source,
|
meta_wayland_data_source_set_has_target (offer->source,
|
||||||
mime_type != NULL);
|
mime_type != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
offer->accepted = mime_type != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -385,8 +392,7 @@ data_offer_finish (struct wl_client *client,
|
|||||||
offer != meta_wayland_data_source_get_current_offer (offer->source))
|
offer != meta_wayland_data_source_get_current_offer (offer->source))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (meta_wayland_data_source_get_seat (offer->source) ||
|
if (!offer->accepted || !offer->action_sent)
|
||||||
!meta_wayland_data_source_has_target (offer->source))
|
|
||||||
{
|
{
|
||||||
wl_resource_post_error (offer->resource,
|
wl_resource_post_error (offer->resource,
|
||||||
WL_DATA_OFFER_ERROR_INVALID_FINISH,
|
WL_DATA_OFFER_ERROR_INVALID_FINISH,
|
||||||
|
Loading…
Reference in New Issue
Block a user