mutter/0008-wayland-Figure-out-better-the-right-selection-source.patch
Adam Williamson 751740e9bf Backport multiple fixes for F31 FE/blocker bugs
MR #832 for #1749433 (also needs change in gnome-shell)
MR #840 for #1760254
MR #848 for #1751646 and #1759644
MR #842 for #1758873
2019-10-12 08:52:31 -07:00

68 lines
2.8 KiB
Diff

From e1751ad9ee1ac4a1bfcb49352c88bb001ae55594 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 11 Oct 2019 19:32:42 +0200
Subject: [PATCH 8/8] 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, store the selection type on
the data offer.
Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/845
---
src/wayland/meta-wayland-data-device.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index f95be0bf8..38aa0f317 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;
+ MetaSelectionType selection_type;
};
typedef struct _MetaWaylandDataSourcePrivate
@@ -399,11 +400,7 @@ data_offer_receive (struct wl_client *client, struct wl_resource *resource,
GList *mime_types;
gboolean found;
- if (offer->dnd_actions != 0)
- selection_type = META_SELECTION_DND;
- else
- selection_type = META_SELECTION_CLIPBOARD;
-
+ selection_type = offer->selection_type;
mime_types = meta_selection_get_mimetypes (meta_display_get_selection (display),
selection_type);
found = g_list_find_custom (mime_types, mime_type, (GCompareFunc) g_strcmp0) != NULL;
@@ -622,6 +619,7 @@ create_and_send_dnd_offer (MetaWaylandDataSource *source,
MetaWaylandDataOffer *offer = g_slice_new0 (MetaWaylandDataOffer);
char **p;
+ offer->selection_type = META_SELECTION_DND;
offer->source = source;
g_object_add_weak_pointer (G_OBJECT (source), (gpointer *)&offer->source);
offer->resource = wl_resource_create (wl_resource_get_client (target),
@@ -2043,6 +2041,7 @@ create_and_send_clipboard_offer (MetaWaylandDataDevice *data_device,
return NULL;
offer = g_slice_new0 (MetaWaylandDataOffer);
+ offer->selection_type = META_SELECTION_CLIPBOARD;
offer->resource = wl_resource_create (wl_resource_get_client (target),
&wl_data_offer_interface,
wl_resource_get_version (target), 0);
@@ -2075,6 +2074,7 @@ create_and_send_primary_offer (MetaWaylandDataDevice *data_device,
return NULL;
offer = g_slice_new0 (MetaWaylandDataOffer);
+ offer->selection_type = META_SELECTION_PRIMARY;
offer->resource = wl_resource_create (wl_resource_get_client (target),
&gtk_primary_selection_offer_interface,
wl_resource_get_version (target), 0);
--
2.23.0