[mutter/gnome-3-34] wayland: Clean up meta_wayland_data_device_set_primary()
- From: Robert Mader <rmader src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-3-34] wayland: Clean up meta_wayland_data_device_set_primary()
- Date: Fri, 31 Jan 2020 14:27:00 +0000 (UTC)
commit e18aa564b0c24cbe7032e80b19082831df85d609
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Oct 23 13:14:30 2019 +0200
wayland: Clean up meta_wayland_data_device_set_primary()
This function is already checking for the focus surface client
matching the requestor. The type check was slightly bogus though
as it'd be an screwup in our code, make it an assert instead.
Also, move the check for the client having the focus into the
upper call, so this and wl_data_device.set_selection code can
get more in line.
https://gitlab.gnome.org/GNOME/mutter/issues/878
(cherry picked from commit 16eb46105425a9a677c408f5a19e1bebae88a602)
src/wayland/meta-wayland-data-device.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index ec5295d3b..8e6c74447 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -1741,16 +1741,7 @@ meta_wayland_data_device_set_primary (MetaWaylandDataDevice *data_device,
struct wl_client *focus_client;
MetaSelectionSource *selection_source;
- if (META_IS_WAYLAND_DATA_SOURCE_PRIMARY (source))
- {
- struct wl_resource *resource;
-
- resource = meta_wayland_data_source_get_resource (source);
-
- if (wl_resource_get_client (resource) !=
- meta_wayland_keyboard_get_focus_client (seat->keyboard))
- return;
- }
+ g_assert (!source || META_IS_WAYLAND_DATA_SOURCE_PRIMARY (source));
if (data_device->primary_data_source &&
data_device->primary_serial - serial < UINT32_MAX / 2)
@@ -1805,10 +1796,16 @@ primary_device_set_selection (struct wl_client *client,
uint32_t serial)
{
MetaWaylandDataDevice *data_device = wl_resource_get_user_data (resource);
+ MetaWaylandSeat *seat = wl_container_of (data_device, seat, data_device);
MetaWaylandDataSource *source = NULL;
if (source_resource)
source = wl_resource_get_user_data (source_resource);
+
+ if (wl_resource_get_client (resource) !=
+ meta_wayland_keyboard_get_focus_client (seat->keyboard))
+ return;
+
meta_wayland_data_device_set_primary (data_device, source, serial);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]