diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index e99cc5ceb..87a0267db 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -14,9 +14,10 @@ use smithay::wayland::data_device::{ ServerDndGrabHandler, }; use smithay::wayland::dmabuf::{DmabufGlobal, DmabufHandler, DmabufState, ImportError}; +use smithay::wayland::primary_selection::{PrimarySelectionHandler, PrimarySelectionState}; use smithay::{ delegate_data_device, delegate_dmabuf, delegate_output, delegate_pointer_gestures, - delegate_presentation, delegate_seat, delegate_tablet_manager, + delegate_presentation, delegate_primary_selection, delegate_seat, delegate_tablet_manager, }; use crate::niri::State; @@ -75,6 +76,15 @@ impl ServerDndGrabHandler for State {} delegate_data_device!(State); +impl PrimarySelectionHandler for State { + type SelectionUserData = (); + + fn primary_selection_state(&self) -> &PrimarySelectionState { + &self.niri.primary_selection_state + } +} +delegate_primary_selection!(State); + delegate_output!(State); delegate_presentation!(State); diff --git a/src/niri.rs b/src/niri.rs index bf1e88380..c3dbbe631 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -53,6 +53,7 @@ use smithay::wayland::dmabuf::DmabufFeedback; use smithay::wayland::output::OutputManagerState; use smithay::wayland::pointer_gestures::PointerGesturesState; use smithay::wayland::presentation::PresentationState; +use smithay::wayland::primary_selection::PrimarySelectionState; use smithay::wayland::shell::wlr_layer::{Layer, WlrLayerShellState}; use smithay::wayland::shell::xdg::decoration::XdgDecorationState; use smithay::wayland::shell::xdg::XdgShellState; @@ -103,6 +104,7 @@ pub struct Niri { pub tablet_state: TabletManagerState, pub pointer_gestures_state: PointerGesturesState, pub data_device_state: DataDeviceState, + pub primary_selection_state: PrimarySelectionState, pub popups: PopupManager, pub presentation_state: PresentationState, @@ -243,6 +245,7 @@ impl Niri { let tablet_state = TabletManagerState::new::(&display_handle); let pointer_gestures_state = PointerGesturesState::new::(&display_handle); let data_device_state = DataDeviceState::new::(&display_handle); + let primary_selection_state = PrimarySelectionState::new::(&display_handle); let presentation_state = PresentationState::new::(&display_handle, CLOCK_MONOTONIC as u32); @@ -593,6 +596,7 @@ impl Niri { tablet_state, pointer_gestures_state, data_device_state, + primary_selection_state, popups: PopupManager::default(), presentation_state,