Implement primary selecton

Firefox clipboard doesn't always work without it.
This commit is contained in:
Ivan Molodetskikh
2023-09-26 22:22:11 +04:00
parent d3735227ce
commit 93369e1958
2 changed files with 15 additions and 1 deletions
+11 -1
View File
@@ -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);
+4
View File
@@ -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,