Enable wlr_data_control protocol (#101)
This commit is contained in:
parent
d051d14197
commit
72ee1c4d5a
4 changed files with 28 additions and 1 deletions
|
|
@ -51,6 +51,7 @@ pub struct Config {
|
||||||
pub struct StaticConfig {
|
pub struct StaticConfig {
|
||||||
pub key_bindings: HashMap<key_bindings::KeyPattern, key_bindings::Action>,
|
pub key_bindings: HashMap<key_bindings::KeyPattern, key_bindings::Action>,
|
||||||
pub tiling_enabled: bool,
|
pub tiling_enabled: bool,
|
||||||
|
pub data_control_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
@ -191,6 +192,7 @@ impl Config {
|
||||||
StaticConfig {
|
StaticConfig {
|
||||||
key_bindings: HashMap::new(),
|
key_bindings: HashMap::new(),
|
||||||
tiling_enabled: false,
|
tiling_enabled: false,
|
||||||
|
data_control_enabled: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
11
src/state.rs
11
src/state.rs
|
|
@ -71,7 +71,10 @@ use smithay::{
|
||||||
presentation::PresentationState,
|
presentation::PresentationState,
|
||||||
seat::WaylandFocus,
|
seat::WaylandFocus,
|
||||||
security_context::{SecurityContext, SecurityContextState},
|
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},
|
session_lock::{LockSurface, SessionLockManagerState},
|
||||||
shell::{kde::decoration::KdeDecorationState, xdg::decoration::XdgDecorationState},
|
shell::{kde::decoration::KdeDecorationState, xdg::decoration::XdgDecorationState},
|
||||||
shm::ShmState,
|
shm::ShmState,
|
||||||
|
|
@ -160,6 +163,7 @@ pub struct Common {
|
||||||
pub output_configuration_state: OutputConfigurationState<State>,
|
pub output_configuration_state: OutputConfigurationState<State>,
|
||||||
pub presentation_state: PresentationState,
|
pub presentation_state: PresentationState,
|
||||||
pub primary_selection_state: PrimarySelectionState,
|
pub primary_selection_state: PrimarySelectionState,
|
||||||
|
pub data_control_state: Option<DataControlState>,
|
||||||
pub screencopy_state: ScreencopyState,
|
pub screencopy_state: ScreencopyState,
|
||||||
pub seat_state: SeatState<State>,
|
pub seat_state: SeatState<State>,
|
||||||
pub session_lock_manager_state: SessionLockManagerState,
|
pub session_lock_manager_state: SessionLockManagerState,
|
||||||
|
|
@ -358,6 +362,10 @@ impl State {
|
||||||
TextInputManagerState::new::<Self>(&dh);
|
TextInputManagerState::new::<Self>(&dh);
|
||||||
VirtualKeyboardManagerState::new::<State, _>(&dh, client_should_see_privileged_protocols);
|
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);
|
let shell = Shell::new(&config, dh);
|
||||||
|
|
||||||
State {
|
State {
|
||||||
|
|
@ -400,6 +408,7 @@ impl State {
|
||||||
output_configuration_state,
|
output_configuration_state,
|
||||||
presentation_state,
|
presentation_state,
|
||||||
primary_selection_state,
|
primary_selection_state,
|
||||||
|
data_control_state,
|
||||||
viewporter_state,
|
viewporter_state,
|
||||||
wl_drm_state,
|
wl_drm_state,
|
||||||
kde_decoration_state,
|
kde_decoration_state,
|
||||||
|
|
|
||||||
15
src/wayland/handlers/data_control.rs
Normal file
15
src/wayland/handlers/data_control.rs
Normal 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);
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
pub mod buffer;
|
pub mod buffer;
|
||||||
pub mod compositor;
|
pub mod compositor;
|
||||||
|
pub mod data_control;
|
||||||
pub mod data_device;
|
pub mod data_device;
|
||||||
pub mod decoration;
|
pub mod decoration;
|
||||||
pub mod dmabuf;
|
pub mod dmabuf;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue