[mutter/wip/carlosg/selection-fixes] wayland: Figure out better the right selection source for a wl_data_offer
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/selection-fixes] wayland: Figure out better the right selection source for a wl_data_offer
- Date: Fri, 11 Oct 2019 23:21:33 +0000 (UTC)
commit e1751ad9ee1ac4a1bfcb49352c88bb001ae55594
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, 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),
>k_primary_selection_offer_interface,
wl_resource_get_version (target), 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]