Skip to content

Commit e814eeb

Browse files
ids1024Drakulix
authored andcommitted
Add ext-data-control-v1 protocol
This is identical to the wlr protocol, and Smithay has implementations for both. New clients should use the `ext` protocol where present. Not sure how widely used it is yet, but we probably should have both for now.
1 parent d2d7c65 commit e814eeb

File tree

4 files changed

+32
-6
lines changed

4 files changed

+32
-6
lines changed

src/state.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ use smithay::{
8888
seat::WaylandFocus,
8989
security_context::{SecurityContext, SecurityContextState},
9090
selection::{
91-
data_device::DataDeviceState, primary_selection::PrimarySelectionState,
92-
wlr_data_control::DataControlState,
91+
data_device::DataDeviceState,
92+
ext_data_control::DataControlState as ExtDataControlState,
93+
primary_selection::PrimarySelectionState,
94+
wlr_data_control::DataControlState as WlrDataControlState,
9395
},
9496
session_lock::SessionLockManagerState,
9597
shell::{
@@ -234,7 +236,8 @@ pub struct Common {
234236
pub output_power_state: OutputPowerState,
235237
pub presentation_state: PresentationState,
236238
pub primary_selection_state: PrimarySelectionState,
237-
pub data_control_state: DataControlState,
239+
pub ext_data_control_state: ExtDataControlState,
240+
pub wlr_data_control_state: WlrDataControlState,
238241
pub image_capture_source_state: ImageCaptureSourceState,
239242
pub screencopy_state: ScreencopyState,
240243
pub seat_state: SeatState<State>,
@@ -651,7 +654,12 @@ impl State {
651654
let idle_inhibit_manager_state = IdleInhibitManagerState::new::<State>(dh);
652655
let idle_inhibiting_surfaces = HashSet::new();
653656

654-
let data_control_state = DataControlState::new::<Self, _>(
657+
let ext_data_control_state = ExtDataControlState::new::<Self, _>(
658+
dh,
659+
Some(&primary_selection_state),
660+
client_not_sandboxed,
661+
);
662+
let wlr_data_control_state = WlrDataControlState::new::<Self, _>(
655663
dh,
656664
Some(&primary_selection_state),
657665
client_not_sandboxed,
@@ -737,7 +745,8 @@ impl State {
737745
overlap_notify_state,
738746
presentation_state,
739747
primary_selection_state,
740-
data_control_state,
748+
ext_data_control_state,
749+
wlr_data_control_state,
741750
viewporter_state,
742751
wl_drm_state,
743752
kde_decoration_state,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use crate::state::State;
2+
use smithay::{
3+
delegate_ext_data_control,
4+
wayland::selection::ext_data_control::{DataControlHandler, DataControlState},
5+
};
6+
7+
impl DataControlHandler for State {
8+
fn data_control_state(&mut self) -> &mut DataControlState {
9+
&mut self.common.ext_data_control_state
10+
}
11+
}
12+
13+
delegate_ext_data_control!(State);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// SPDX-License-Identifier: GPL-3.0-only
2+
3+
mod ext;
4+
mod wlr;

src/wayland/handlers/data_control.rs renamed to src/wayland/handlers/data_control/wlr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use smithay::{
88

99
impl DataControlHandler for State {
1010
fn data_control_state(&mut self) -> &mut DataControlState {
11-
&mut self.common.data_control_state
11+
&mut self.common.wlr_data_control_state
1212
}
1313
}
1414

0 commit comments

Comments
 (0)