[mutter/wip/carlosg/check-selection-request-focus: 2/3] wayland: Clean up meta_wayland_data_device_set_primary()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/check-selection-request-focus: 2/3] wayland: Clean up meta_wayland_data_device_set_primary()
- Date: Wed, 23 Oct 2019 11:23:59 +0000 (UTC)
commit 98a688ec8c4803b71e6fc21fe76b4c33ea315232
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 the type check an assert, and make it so we just check the
keyboard focus client once.
https://gitlab.gnome.org/GNOME/mutter/issues/878
src/wayland/meta-wayland-data-device.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index 897f3c782..34ffd7ca0 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -1733,17 +1733,15 @@ meta_wayland_data_device_set_primary (MetaWaylandDataDevice *data_device,
struct wl_resource *data_device_resource;
struct wl_client *focus_client;
MetaSelectionSource *selection_source;
+ struct wl_resource *source_resource;
- if (META_IS_WAYLAND_DATA_SOURCE_PRIMARY (source))
- {
- struct wl_resource *resource;
+ g_assert (META_IS_WAYLAND_DATA_SOURCE_PRIMARY (source));
- resource = meta_wayland_data_source_get_resource (source);
+ focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard);
+ source_resource = meta_wayland_data_source_get_resource (source);
- if (wl_resource_get_client (resource) !=
- meta_wayland_keyboard_get_focus_client (seat->keyboard))
- return;
- }
+ if (wl_resource_get_client (source_resource) != focus_client)
+ return;
if (data_device->primary_data_source &&
data_device->primary_serial - serial < UINT32_MAX / 2)
@@ -1778,7 +1776,6 @@ meta_wayland_data_device_set_primary (MetaWaylandDataDevice *data_device,
selection_source);
g_object_unref (selection_source);
- focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard);
if (focus_client)
{
data_device_resource = wl_resource_find_for_client (&data_device->primary_resource_list, focus_client);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]