Skip to content

Commit

Permalink
seat/data_control: ensure version for primary selection
Browse files Browse the repository at this point in the history
Primary selection is available only since v2, so don't send the
events for v1 devices.
  • Loading branch information
kchibisov authored and Drakulix committed Feb 16, 2024
1 parent c9ef9d6 commit 832dee8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/wayland/selection/seat_data.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down Expand Up @@ -157,7 +158,12 @@ impl<U: Clone + Send + Sync + 'static> SeatData<U> {
// 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
Expand Down

0 comments on commit 832dee8

Please sign in to comment.