[mutter/wip/carlosg/selection-fixes: 8/8] 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: 8/8] wayland: Figure out better the right selection source for a wl_data_offer
- Date: Fri, 11 Oct 2019 17:47:26 +0000 (UTC)
commit 2018683789e223d8af7f2a981bc1f41b750522af
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 be unset at that point.
Instead of doing these heuristics, check the matching data source on the
MetaWaylandDataDevice before picking a selection source.
Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/845
src/wayland/meta-wayland-data-device.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index f95be0bf8..284098a34 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -394,15 +394,26 @@ data_offer_receive (struct wl_client *client, struct wl_resource *resource,
const char *mime_type, int32_t fd)
{
MetaWaylandDataOffer *offer = wl_resource_get_user_data (resource);
+ MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
+ MetaWaylandDataDevice *data_device = &compositor->seat->data_device;
MetaDisplay *display = meta_get_display ();
MetaSelectionType selection_type;
GList *mime_types;
gboolean found;
- if (offer->dnd_actions != 0)
- selection_type = META_SELECTION_DND;
+ if (offer->source == data_device->dnd_data_source)
+ {
+ selection_type = META_SELECTION_DND;
+ }
+ else if (offer->source == data_device->selection_data_source)
+ {
+ selection_type = META_SELECTION_CLIPBOARD;
+ }
else
- selection_type = META_SELECTION_CLIPBOARD;
+ {
+ close (fd);
+ return;
+ }
mime_types = meta_selection_get_mimetypes (meta_display_get_selection (display),
selection_type);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]