summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2016-02-29 16:43:23 +0100
committerCarlos Garnacho <carlosg@gnome.org>2016-02-29 19:55:55 +0100
commit66be0387eeb3c2dad5f3b68b93e94e1842793733 (patch)
tree99a5b98b36829d1a69605c1db86aaad8656caf2b
parent837836a7225605b5f1ad13036a3696988ca02945 (diff)
downloadmutter-66be0387eeb3c2dad5f3b68b93e94e1842793733.tar.gz
wayland: Use separate destructor for the gtk_primary_selection_offer
Things don't mix well if we use the same destructor than wl_data_offer, Use a separate destructor with no DnD paths whatsoever. https://bugzilla.gnome.org/show_bug.cgi?id=762878
-rw-r--r--src/wayland/meta-wayland-data-device.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index c6a98ff99..5cdb5004a 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -516,6 +516,28 @@ destroy_data_offer (struct wl_resource *resource)
g_slice_free (MetaWaylandDataOffer, offer);
}
+static void
+destroy_primary_offer (struct wl_resource *resource)
+{
+ MetaWaylandDataOffer *offer = wl_resource_get_user_data (resource);
+
+ if (offer->source)
+ {
+ if (offer == meta_wayland_data_source_get_current_offer (offer->source))
+ {
+ meta_wayland_data_source_cancel (offer->source);
+ meta_wayland_data_source_set_current_offer (offer->source, NULL);
+ }
+
+ g_object_remove_weak_pointer (G_OBJECT (offer->source),
+ (gpointer *)&offer->source);
+ offer->source = NULL;
+ }
+
+ meta_display_sync_wayland_input_focus (meta_get_display ());
+ g_slice_free (MetaWaylandDataOffer, offer);
+}
+
static struct wl_resource *
meta_wayland_data_source_send_offer (MetaWaylandDataSource *source,
struct wl_resource *target)
@@ -563,7 +585,7 @@ meta_wayland_data_source_send_primary_offer (MetaWaylandDataSource *source,
wl_resource_set_implementation (offer->resource,
&primary_offer_interface,
offer,
- destroy_data_offer);
+ destroy_primary_offer);
gtk_primary_selection_device_send_data_offer (target, offer->resource);