[mutter] wayland: Use separate destructor for the gtk_primary_selection_offer



commit 66be0387eeb3c2dad5f3b68b93e94e1842793733
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Feb 29 16:43:23 2016 +0100

    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

 src/wayland/meta-wayland-data-device.c |   24 +++++++++++++++++++++++-
 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 c6a98ff..5cdb500 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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]