Enable wlr_data_control protocol (#101)

This commit is contained in:
xDarksome 2023-11-14 00:47:43 +04:00 committed by GitHub
parent d051d14197
commit 72ee1c4d5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 1 deletions

View file

@ -51,6 +51,7 @@ pub struct Config {
pub struct StaticConfig {
pub key_bindings: HashMap<key_bindings::KeyPattern, key_bindings::Action>,
pub tiling_enabled: bool,
pub data_control_enabled: bool,
}
#[derive(Debug)]
@ -191,6 +192,7 @@ impl Config {
StaticConfig {
key_bindings: HashMap::new(),
tiling_enabled: false,
data_control_enabled: false,
}
}

View file

@ -71,7 +71,10 @@ use smithay::{
presentation::PresentationState,
seat::WaylandFocus,
security_context::{SecurityContext, SecurityContextState},
selection::{data_device::DataDeviceState, primary_selection::PrimarySelectionState},
selection::{
data_device::DataDeviceState, primary_selection::PrimarySelectionState,
wlr_data_control::DataControlState,
},
session_lock::{LockSurface, SessionLockManagerState},
shell::{kde::decoration::KdeDecorationState, xdg::decoration::XdgDecorationState},
shm::ShmState,
@ -160,6 +163,7 @@ pub struct Common {
pub output_configuration_state: OutputConfigurationState<State>,
pub presentation_state: PresentationState,
pub primary_selection_state: PrimarySelectionState,
pub data_control_state: Option<DataControlState>,
pub screencopy_state: ScreencopyState,
pub seat_state: SeatState<State>,
pub session_lock_manager_state: SessionLockManagerState,
@ -358,6 +362,10 @@ impl State {
TextInputManagerState::new::<Self>(&dh);
VirtualKeyboardManagerState::new::<State, _>(&dh, client_should_see_privileged_protocols);
let data_control_state = config.static_conf.data_control_enabled.then(|| {
DataControlState::new::<Self, _>(dh, Some(&primary_selection_state), |_| true)
});
let shell = Shell::new(&config, dh);
State {
@ -400,6 +408,7 @@ impl State {
output_configuration_state,
presentation_state,
primary_selection_state,
data_control_state,
viewporter_state,
wl_drm_state,
kde_decoration_state,

View file

@ -0,0 +1,15 @@
// SPDX-License-Identifier: GPL-3.0-only
use crate::state::State;
use smithay::{
delegate_data_control,
wayland::selection::wlr_data_control::{DataControlHandler, DataControlState},
};
impl DataControlHandler for State {
fn data_control_state(&self) -> &DataControlState {
self.common.data_control_state.as_ref().unwrap()
}
}
delegate_data_control!(State);

View file

@ -2,6 +2,7 @@
pub mod buffer;
pub mod compositor;
pub mod data_control;
pub mod data_device;
pub mod decoration;
pub mod dmabuf;