Implement ext-data-control
Browse files at this commit7816f20e6a3ddc4057aa1ab35742dc7f67453bc2Parent: 0d361042 changed files +26 -7
- src/handlers/mod.rs +18 -7
- src/niri.rs +8 -0
src/handlers/mod.rsmodified+18 -7
| @@ -47,6 +47,9 @@ use smithay::wayland::selection::data_device::{ | |||
| 47 | set_data_device_focus, ClientDndGrabHandler, DataDeviceHandler, DataDeviceState, | 47 | set_data_device_focus, ClientDndGrabHandler, DataDeviceHandler, DataDeviceState, |
| 48 | ServerDndGrabHandler, | 48 | ServerDndGrabHandler, |
| 49 | }; | 49 | }; |
| 50 | +use smithay::wayland::selection::ext_data_control::{ | ||
| 51 | + DataControlHandler as ExtDataControlHandler, DataControlState as ExtDataControlState, | ||
| 52 | +}; | ||
| 50 | use smithay::wayland::selection::primary_selection::{ | 53 | use smithay::wayland::selection::primary_selection::{ |
| 51 | set_primary_focus, PrimarySelectionHandler, PrimarySelectionState, | 54 | set_primary_focus, PrimarySelectionHandler, PrimarySelectionState, |
| 52 | }; | 55 | }; |
| @@ -63,13 +66,13 @@ use smithay::wayland::xdg_activation::{ | |||
| 63 | }; | 66 | }; |
| 64 | use smithay::{ | 67 | use smithay::{ |
| 65 | delegate_cursor_shape, delegate_data_control, delegate_data_device, delegate_dmabuf, | 68 | delegate_cursor_shape, delegate_data_control, delegate_data_device, delegate_dmabuf, |
| 66 | - delegate_drm_lease, delegate_fractional_scale, delegate_idle_inhibit, delegate_idle_notify, | 69 | + delegate_drm_lease, delegate_ext_data_control, delegate_fractional_scale, |
| 67 | - delegate_input_method_manager, delegate_keyboard_shortcuts_inhibit, delegate_output, | 70 | + delegate_idle_inhibit, delegate_idle_notify, delegate_input_method_manager, |
| 68 | - delegate_pointer_constraints, delegate_pointer_gestures, delegate_presentation, | 71 | + delegate_keyboard_shortcuts_inhibit, delegate_output, delegate_pointer_constraints, |
| 69 | - delegate_primary_selection, delegate_relative_pointer, delegate_seat, | 72 | + delegate_pointer_gestures, delegate_presentation, delegate_primary_selection, |
| 70 | - delegate_security_context, delegate_session_lock, delegate_single_pixel_buffer, | 73 | + delegate_relative_pointer, delegate_seat, delegate_security_context, delegate_session_lock, |
| 71 | - delegate_tablet_manager, delegate_text_input_manager, delegate_viewporter, | 74 | + delegate_single_pixel_buffer, delegate_tablet_manager, delegate_text_input_manager, |
| 72 | - delegate_virtual_keyboard_manager, delegate_xdg_activation, | 75 | + delegate_viewporter, delegate_virtual_keyboard_manager, delegate_xdg_activation, |
| 73 | }; | 76 | }; |
| 74 | 77 | ||
| 75 | pub use crate::handlers::xdg_shell::KdeDecorationsModeState; | 78 | pub use crate::handlers::xdg_shell::KdeDecorationsModeState; |
| @@ -396,6 +399,14 @@ impl WlrDataControlHandler for State { | |||
| 396 | 399 | ||
| 397 | delegate_data_control!(State); | 400 | delegate_data_control!(State); |
| 398 | 401 | ||
| 402 | +impl ExtDataControlHandler for State { | ||
| 403 | + fn data_control_state(&self) -> &ExtDataControlState { | ||
| 404 | + &self.niri.ext_data_control_state | ||
| 405 | + } | ||
| 406 | +} | ||
| 407 | + | ||
| 408 | +delegate_ext_data_control!(State); | ||
| 409 | + | ||
| 399 | impl OutputHandler for State { | 410 | impl OutputHandler for State { |
| 400 | fn output_bound(&mut self, output: Output, wl_output: WlOutput) { | 411 | fn output_bound(&mut self, output: Output, wl_output: WlOutput) { |
| 401 | foreign_toplevel::on_output_bound(self, &output, &wl_output); | 412 | foreign_toplevel::on_output_bound(self, &output, &wl_output); |
src/niri.rsmodified+8 -0
| @@ -88,6 +88,7 @@ use smithay::wayland::presentation::PresentationState; | |||
| 88 | use smithay::wayland::relative_pointer::RelativePointerManagerState; | 88 | use smithay::wayland::relative_pointer::RelativePointerManagerState; |
| 89 | use smithay::wayland::security_context::SecurityContextState; | 89 | use smithay::wayland::security_context::SecurityContextState; |
| 90 | use smithay::wayland::selection::data_device::{set_data_device_selection, DataDeviceState}; | 90 | use smithay::wayland::selection::data_device::{set_data_device_selection, DataDeviceState}; |
| 91 | +use smithay::wayland::selection::ext_data_control::DataControlState as ExtDataControlState; | ||
| 91 | use smithay::wayland::selection::primary_selection::PrimarySelectionState; | 92 | use smithay::wayland::selection::primary_selection::PrimarySelectionState; |
| 92 | use smithay::wayland::selection::wlr_data_control::DataControlState as WlrDataControlState; | 93 | use smithay::wayland::selection::wlr_data_control::DataControlState as WlrDataControlState; |
| 93 | use smithay::wayland::session_lock::{LockSurface, SessionLockManagerState, SessionLocker}; | 94 | use smithay::wayland::session_lock::{LockSurface, SessionLockManagerState, SessionLocker}; |
| @@ -272,6 +273,7 @@ pub struct Niri { | |||
| 272 | pub data_device_state: DataDeviceState, | 273 | pub data_device_state: DataDeviceState, |
| 273 | pub primary_selection_state: PrimarySelectionState, | 274 | pub primary_selection_state: PrimarySelectionState, |
| 274 | pub wlr_data_control_state: WlrDataControlState, | 275 | pub wlr_data_control_state: WlrDataControlState, |
| 276 | + pub ext_data_control_state: ExtDataControlState, | ||
| 275 | pub popups: PopupManager, | 277 | pub popups: PopupManager, |
| 276 | pub popup_grab: Option<PopupGrabState>, | 278 | pub popup_grab: Option<PopupGrabState>, |
| 277 | pub presentation_state: PresentationState, | 279 | pub presentation_state: PresentationState, |
| @@ -1887,6 +1889,11 @@ impl Niri { | |||
| 1887 | Some(&primary_selection_state), | 1889 | Some(&primary_selection_state), |
| 1888 | client_is_unrestricted, | 1890 | client_is_unrestricted, |
| 1889 | ); | 1891 | ); |
| 1892 | + let ext_data_control_state = ExtDataControlState::new::<State, _>( | ||
| 1893 | + &display_handle, | ||
| 1894 | + Some(&primary_selection_state), | ||
| 1895 | + client_is_unrestricted, | ||
| 1896 | + ); | ||
| 1890 | let presentation_state = | 1897 | let presentation_state = |
| 1891 | PresentationState::new::<State>(&display_handle, Monotonic::ID as u32); | 1898 | PresentationState::new::<State>(&display_handle, Monotonic::ID as u32); |
| 1892 | let security_context_state = | 1899 | let security_context_state = |
| @@ -2101,6 +2108,7 @@ impl Niri { | |||
| 2101 | data_device_state, | 2108 | data_device_state, |
| 2102 | primary_selection_state, | 2109 | primary_selection_state, |
| 2103 | wlr_data_control_state, | 2110 | wlr_data_control_state, |
| 2111 | + ext_data_control_state, | ||
| 2104 | popups: PopupManager::default(), | 2112 | popups: PopupManager::default(), |
| 2105 | popup_grab: None, | 2113 | popup_grab: None, |
| 2106 | suppressed_keys: HashSet::new(), | 2114 | suppressed_keys: HashSet::new(), |