diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-09-26 22:22:11 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-09-26 22:22:11 +0400 |
| commit | 93369e1958e995d9ad487bb1e33a1bfb9afabb2e (patch) | |
| tree | 0efa175df0c91a20fcba9a6144848862e953a765 | |
| parent | d3735227cec6439d36cd2f6061df5dbc7cc9bc19 (diff) | |
| download | niri-93369e1958e995d9ad487bb1e33a1bfb9afabb2e.tar.gz niri-93369e1958e995d9ad487bb1e33a1bfb9afabb2e.tar.bz2 niri-93369e1958e995d9ad487bb1e33a1bfb9afabb2e.zip | |
Implement primary selecton
Firefox clipboard doesn't always work without it.
| -rw-r--r-- | src/handlers/mod.rs | 12 | ||||
| -rw-r--r-- | src/niri.rs | 4 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index e99cc5ce..87a0267d 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 bf1e8838..c3dbbe63 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::<State>(&display_handle); let pointer_gestures_state = PointerGesturesState::new::<State>(&display_handle); let data_device_state = DataDeviceState::new::<State>(&display_handle); + let primary_selection_state = PrimarySelectionState::new::<State>(&display_handle); let presentation_state = PresentationState::new::<State>(&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, |
