mirror of
https://github.com/brl/mutter.git
synced 2025-01-25 10:58:55 +00:00
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)
This commit is contained in:
parent
4cc5b85c5d
commit
e18aa564b0
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user