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 e865fcc460)
This commit is contained in:
Carlos Garnacho 2019-10-23 13:19:39 +02:00 committed by Robert Mader
parent e18aa564b0
commit 651d2a57f8

View File

@ -1677,6 +1677,7 @@ data_device_set_selection (struct wl_client *client,
guint32 serial) guint32 serial)
{ {
MetaWaylandDataDevice *data_device = wl_resource_get_user_data (resource); MetaWaylandDataDevice *data_device = wl_resource_get_user_data (resource);
MetaWaylandSeat *seat = wl_container_of (data_device, seat, data_device);
MetaWaylandDataSourcePrivate *priv; MetaWaylandDataSourcePrivate *priv;
MetaWaylandDataSource *source; 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. */ /* FIXME: Store serial and check against incoming serial here. */
meta_wayland_data_device_set_selection (data_device, source, serial); meta_wayland_data_device_set_selection (data_device, source, serial);
} }