[mutter/gnome-3-34] wayland: Do not cancel data source on offer destruction



commit edb618b2a4063050cc8965b30e205ef4c1319149
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Nov 20 00:30:23 2019 +0100

    wayland: Do not cancel data source on offer destruction
    
    This is wrong for both clipboard and DnD, as the selection source
    will still be able to focus another surface, and churn another
    wl_offer.
    
    We should just detach the data offer from the data source in this
    case, and let the source live on. However, we should still check
    that there is a source and an offer to finish DnD, do that when
    handling the drop operation instead.
    
    https://gitlab.gnome.org/GNOME/mutter/issues/591
    
    (cherry picked from commit 48639ac5da35697d885bd0736dea46e34a832ca2)

 src/wayland/meta-wayland-data-device.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index c7384d2c8..e5018407d 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -571,12 +571,7 @@ destroy_data_offer (struct wl_resource *resource)
               WL_DATA_OFFER_ACTION_SINCE_VERSION)
             meta_wayland_data_source_notify_finish (offer->source);
           else
-            {
-              if (seat->data_device.dnd_data_source == offer->source)
-                unset_selection_source (&seat->data_device, META_SELECTION_DND);
-              meta_wayland_data_source_cancel (offer->source);
-              meta_wayland_data_source_set_current_offer (offer->source, NULL);
-            }
+            meta_wayland_data_source_set_current_offer (offer->source, NULL);
         }
 
       g_object_remove_weak_pointer (G_OBJECT (offer->source),
@@ -1036,6 +1031,7 @@ drag_grab_button (MetaWaylandPointerGrab *grab,
       gboolean success;
 
       if (drag_grab->drag_focus && source &&
+          meta_wayland_data_source_get_current_offer (source) &&
           meta_wayland_data_source_has_target (source) &&
           meta_wayland_data_source_get_current_action (source))
         {


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