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
This commit is contained in:
Carlos Garnacho 2019-10-23 13:19:39 +02:00
parent 16eb461054
commit e865fcc460

View File

@ -1669,6 +1669,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;
@ -1690,6 +1691,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);
} }