diff --git a/protocol/wlr-data-control-unstable-v1.xml b/protocol/wlr-data-control-unstable-v1.xml index 75e8671b0d..4990866826 100644 --- a/protocol/wlr-data-control-unstable-v1.xml +++ b/protocol/wlr-data-control-unstable-v1.xml @@ -108,7 +108,8 @@ the primary clipboard selections). Immediately following the wlr_data_control_device.data_offer event, the new data_offer object will send out wlr_data_control_offer.offer events to describe the MIME - types it offers. + types it offers. Offers will be propagated to other listening clients + except for the client that made the offer. diff --git a/types/wlr_data_control_v1.c b/types/wlr_data_control_v1.c index 239e238ad4..d57ea0222b 100644 --- a/types/wlr_data_control_v1.c +++ b/types/wlr_data_control_v1.c @@ -457,6 +457,17 @@ static void control_send_selection(struct wlr_data_control_device_v1 *device) { } device->selection_offer_resource = NULL; + + struct client_data_source *client_source = + wl_container_of(source, client_source, source); + if (client_source && device->resource) { + struct wl_resource *source_resource = client_source->resource; + // Don't send the offer back to the client that sent it + if (source_resource && wl_resource_get_client(source_resource) == + wl_resource_get_client(device->resource)) + return; + } + if (source != NULL) { device->selection_offer_resource = create_offer(device, &source->mime_types, false); @@ -488,6 +499,17 @@ static void control_send_primary_selection( } device->primary_selection_offer_resource = NULL; + + struct client_primary_selection_source *client_source = + wl_container_of(source, client_source, source); + if (client_source && device->resource) { + struct wl_resource *source_resource = client_source->resource; + // Don't send the offer back to the client that sent it + if (source_resource && wl_resource_get_client(source_resource) == + wl_resource_get_client(device->resource)) + return; + } + if (source != NULL) { device->primary_selection_offer_resource = create_offer(device, &source->mime_types, true);