[mutter/gnome-3-34] wayland: Send primary offer to all data devices from the same client
- From: Robert Mader <rmader src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-3-34] wayland: Send primary offer to all data devices from the same client
- Date: Tue, 23 Jun 2020 18:50:47 +0000 (UTC)
commit a416bed34cfeeba37671f61c96d1b68581d3246d
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed May 13 16:39:44 2020 +0200
wayland: Send primary offer to all data devices from the same client
Make the data device track the keyboard focus, and use that list to
forward the primary selection to all data devices from the same
client.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1253
(cherry-pick of commit b45d5ef3f5a497703fd2c77b7088249cbf3ef367)
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1262
src/wayland/meta-wayland-data-device.c | 16 ++++++++++------
src/wayland/meta-wayland-data-device.h | 1 +
2 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index 9ed237417d..8d3f2d754d 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -1858,10 +1858,7 @@ owner_changed_cb (MetaSelection *selection,
if (selection_type == META_SELECTION_PRIMARY)
{
- data_device_resource =
- wl_resource_find_for_client (&data_device->primary_resource_list,
- focus_client);
- if (data_device_resource)
+ wl_resource_for_each (data_device_resource, &data_device->primary_focus_resource_list)
{
struct wl_resource *offer = NULL;
@@ -2014,6 +2011,7 @@ meta_wayland_data_device_init (MetaWaylandDataDevice *data_device)
wl_list_init (&data_device->resource_list);
wl_list_init (&data_device->focus_resource_list);
wl_list_init (&data_device->primary_resource_list);
+ wl_list_init (&data_device->primary_focus_resource_list);
}
static struct wl_resource *
@@ -2097,6 +2095,8 @@ meta_wayland_data_device_set_keyboard_focus (MetaWaylandDataDevice *data_device)
data_device->focus_client = focus_client;
move_resources (&data_device->resource_list,
&data_device->focus_resource_list);
+ move_resources (&data_device->primary_resource_list,
+ &data_device->primary_focus_resource_list);
if (!focus_client)
return;
@@ -2113,10 +2113,14 @@ meta_wayland_data_device_set_keyboard_focus (MetaWaylandDataDevice *data_device)
wl_data_device_send_selection (data_device_resource, offer);
}
- data_device_resource = wl_resource_find_for_client (&data_device->primary_resource_list, focus_client);
- if (data_device_resource)
+ move_resources_for_client (&data_device->primary_focus_resource_list,
+ &data_device->primary_resource_list,
+ focus_client);
+
+ wl_resource_for_each (data_device_resource, &data_device->primary_focus_resource_list)
{
struct wl_resource *offer;
+
offer = create_and_send_primary_offer (data_device, data_device_resource);
gtk_primary_selection_device_send_selection (data_device_resource, offer);
}
diff --git a/src/wayland/meta-wayland-data-device.h b/src/wayland/meta-wayland-data-device.h
index 7ebaca3266..efeaffed52 100644
--- a/src/wayland/meta-wayland-data-device.h
+++ b/src/wayland/meta-wayland-data-device.h
@@ -65,6 +65,7 @@ struct _MetaWaylandDataDevice
struct wl_list resource_list;
struct wl_list focus_resource_list;
struct wl_list primary_resource_list;
+ struct wl_list primary_focus_resource_list;
MetaWaylandDragGrab *current_grab;
struct wl_client *focus_client;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]