From 832dee8586d783d4c60a162ef8aabca2ba7fd499 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Mon, 12 Feb 2024 19:36:59 +0400 Subject: [PATCH] seat/data_control: ensure version for primary selection Primary selection is available only since v2, so don't send the events for v1 devices. --- src/wayland/selection/seat_data.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/wayland/selection/seat_data.rs b/src/wayland/selection/seat_data.rs index e3591d578b81..58243a3e0a30 100644 --- a/src/wayland/selection/seat_data.rs +++ b/src/wayland/selection/seat_data.rs @@ -1,3 +1,4 @@ +use wayland_protocols_wlr::data_control::v1::server::zwlr_data_control_device_v1::EVT_PRIMARY_SELECTION_SINCE; use wayland_server::protocol::wl_data_device::WlDataDevice; use wayland_server::{Client, DisplayHandle, Resource}; @@ -157,7 +158,12 @@ impl SeatData { // later on. SelectionDevice::DataDevice(_) => ty == SelectionTarget::Clipboard, SelectionDevice::Primary(_) => ty == SelectionTarget::Primary, - SelectionDevice::DataControl(_) => update_data_control, + SelectionDevice::DataControl(data_control) => { + // Primary selection is available for data control only since v2. + update_data_control + && (data_control.version() >= EVT_PRIMARY_SELECTION_SINCE + || ty != SelectionTarget::Primary) + } }) { // Data control doesn't require focus and should always get selection updates, unless