[mutter] wayland/data-device: Don't disconnect valid dnd client
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland/data-device: Don't disconnect valid dnd client
- Date: Thu, 15 Sep 2016 02:33:22 +0000 (UTC)
commit 60bc6798f4d18632183457887b6e19e20bc1a45a
Author: Jonas Ådahl <jadahl gmail com>
Date: Tue Sep 6 18:01:54 2016 +0800
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
src/wayland/meta-wayland-data-device.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index 30ec571..14fd5bf 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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]