From 651d2a57f8e07ea50c1932df31886c69cea8f1cd Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 23 Oct 2019 13:19:39 +0200 Subject: [PATCH] wayland: Check focus surface client in wl_data_device.set_selection() Similar to our handling in set_primary(), ignore set_selection() requests that come from unfocused clients. https://gitlab.gnome.org/GNOME/mutter/issues/878 (cherry picked from commit e865fcc460d7666873475f7bb9efc7fd4b336ab8) --- src/wayland/meta-wayland-data-device.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c index 8e6c74447..f2ff09630 100644 --- a/src/wayland/meta-wayland-data-device.c +++ b/src/wayland/meta-wayland-data-device.c @@ -1677,6 +1677,7 @@ data_device_set_selection (struct wl_client *client, guint32 serial) { MetaWaylandDataDevice *data_device = wl_resource_get_user_data (resource); + MetaWaylandSeat *seat = wl_container_of (data_device, seat, data_device); MetaWaylandDataSourcePrivate *priv; MetaWaylandDataSource *source; @@ -1698,6 +1699,10 @@ data_device_set_selection (struct wl_client *client, } } + if (wl_resource_get_client (resource) != + meta_wayland_keyboard_get_focus_client (seat->keyboard)) + return; + /* FIXME: Store serial and check against incoming serial here. */ meta_wayland_data_device_set_selection (data_device, source, serial); }