[mutter/wip/carlosg/selection-fixes: 15/15] wayland: Figure out better the right selection source for a wl_data_offer



commit e8619c95878e0877b6a47c185662750aed0fe665
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Oct 11 19:32:42 2019 +0200

    wayland: Figure out better the right selection source for a wl_data_offer
    
    We were just looking at DnD actions which might still be unset at that
    point. Instead of doing these heuristics, set a flag on DnD offers.
    
    Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/845

 src/wayland/meta-wayland-data-device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index f95be0bf8..278af9ce5 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -60,6 +60,7 @@ struct _MetaWaylandDataOffer
   gboolean action_sent;
   uint32_t dnd_actions;
   enum wl_data_device_manager_dnd_action preferred_dnd_action;
+  guint dnd : 1;
 };
 
 typedef struct _MetaWaylandDataSourcePrivate
@@ -399,7 +400,7 @@ data_offer_receive (struct wl_client *client, struct wl_resource *resource,
   GList *mime_types;
   gboolean found;
 
-  if (offer->dnd_actions != 0)
+  if (offer->dnd)
     selection_type = META_SELECTION_DND;
   else
     selection_type = META_SELECTION_CLIPBOARD;
@@ -622,6 +623,7 @@ create_and_send_dnd_offer (MetaWaylandDataSource *source,
   MetaWaylandDataOffer *offer = g_slice_new0 (MetaWaylandDataOffer);
   char **p;
 
+  offer->dnd = TRUE;
   offer->source = source;
   g_object_add_weak_pointer (G_OBJECT (source), (gpointer *)&offer->source);
   offer->resource = wl_resource_create (wl_resource_get_client (target),


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