[mutter/wip/carlosg/check-selection-request-focus: 17/17] wayland: Check focus surface client in wl_data_device.set_selection()



commit e095dacca3a471786c83b4c1dde61c847c742b59
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Oct 23 13:19:39 2019 +0200

    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

 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 53b81a7c2..2887da62d 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -1669,6 +1669,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;
 
@@ -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. */
   meta_wayland_data_device_set_selection (data_device, source, serial);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]