Add test-only single-pixel-buffer support
Browse files at this commitd38bfc4affb27c04530fad98e12cedadcdd6a0f9Parent: fbb00542 changed files +20 -2
- src/handlers/mod.rs +4 -2
- src/niri.rs +16 -0
src/handlers/mod.rsmodified+4 -2
| @@ -62,8 +62,8 @@ use smithay::{ | ||
| 62 | 62 | delegate_input_method_manager, delegate_output, delegate_pointer_constraints, |
| 63 | 63 | delegate_pointer_gestures, delegate_presentation, delegate_primary_selection, |
| 64 | 64 | delegate_relative_pointer, delegate_seat, delegate_security_context, delegate_session_lock, |
| 65 | - delegate_tablet_manager, delegate_text_input_manager, delegate_viewporter, | |
| 66 | - delegate_virtual_keyboard_manager, delegate_xdg_activation, | |
| 65 | + delegate_single_pixel_buffer, delegate_tablet_manager, delegate_text_input_manager, | |
| 66 | + delegate_viewporter, delegate_virtual_keyboard_manager, delegate_xdg_activation, | |
| 67 | 67 | }; |
| 68 | 68 | |
| 69 | 69 | pub use crate::handlers::xdg_shell::KdeDecorationsModeState; |
| @@ -701,3 +701,5 @@ delegate_output_management!(State); | ||
| 701 | 701 | |
| 702 | 702 | impl MutterX11InteropHandler for State {} |
| 703 | 703 | delegate_mutter_x11_interop!(State); |
| 704 | + | |
| 705 | +delegate_single_pixel_buffer!(State); |
src/niri.rsmodified+16 -0
| @@ -92,6 +92,8 @@ use smithay::wayland::shell::wlr_layer::{self, Layer, WlrLayerShellState}; | ||
| 92 | 92 | use smithay::wayland::shell::xdg::decoration::XdgDecorationState; |
| 93 | 93 | use smithay::wayland::shell::xdg::XdgShellState; |
| 94 | 94 | use smithay::wayland::shm::ShmState; |
| 95 | +#[cfg(test)] | |
| 96 | +use smithay::wayland::single_pixel_buffer::SinglePixelBufferState; | |
| 95 | 97 | use smithay::wayland::socket::ListeningSocketSource; |
| 96 | 98 | use smithay::wayland::tablet_manager::TabletManagerState; |
| 97 | 99 | use smithay::wayland::text_input::TextInputManagerState; |
| @@ -263,6 +265,15 @@ pub struct Niri { | ||
| 263 | 265 | pub activation_state: XdgActivationState, |
| 264 | 266 | pub mutter_x11_interop_state: MutterX11InteropManagerState, |
| 265 | 267 | |
| 268 | + // This will not work as is outside of tests, so it is gated with #[cfg(test)] for now. In | |
| 269 | + // particular, shaders will need to learn about the single pixel buffer. Also, it must be | |
| 270 | + // verified that a black single-pixel-buffer background lets the foreground surface to be | |
| 271 | + // unredirected. | |
| 272 | + // | |
| 273 | + // https://github.com/YaLTeR/niri/issues/619 | |
| 274 | + #[cfg(test)] | |
| 275 | + pub single_pixel_buffer_state: SinglePixelBufferState, | |
| 276 | + | |
| 266 | 277 | pub seat: Seat<State>, |
| 267 | 278 | /// Scancodes of the keys to suppress. |
| 268 | 279 | pub suppressed_keys: HashSet<Keycode>, |
| @@ -1818,6 +1829,9 @@ impl Niri { | ||
| 1818 | 1829 | let mutter_x11_interop_state = |
| 1819 | 1830 | MutterX11InteropManagerState::new::<State, _>(&display_handle, move |_| true); |
| 1820 | 1831 | |
| 1832 | + #[cfg(test)] | |
| 1833 | + let single_pixel_buffer_state = SinglePixelBufferState::new::<State>(&display_handle); | |
| 1834 | + | |
| 1821 | 1835 | let mut seat: Seat<State> = seat_state.new_wl_seat(&display_handle, backend.seat_name()); |
| 1822 | 1836 | seat.add_keyboard( |
| 1823 | 1837 | config_.input.keyboard.xkb.to_xkb_config(), |
| @@ -1990,6 +2004,8 @@ impl Niri { | ||
| 1990 | 2004 | gamma_control_manager_state, |
| 1991 | 2005 | activation_state, |
| 1992 | 2006 | mutter_x11_interop_state, |
| 2007 | + #[cfg(test)] | |
| 2008 | + single_pixel_buffer_state, | |
| 1993 | 2009 | |
| 1994 | 2010 | seat, |
| 1995 | 2011 | keyboard_focus: KeyboardFocus::Layout { surface: None }, |