forge
Explore
Log in

Don't you dare go Hollow

Add test-only single-pixel-buffer support

Browse files at this commit

d38bfc4affb27c04530fad98e12cedadcdd6a0f9Ivan MolodetskikhParent: fbb0054
src/handlers/mod.rsmodified+4 -2
@@ -62,8 +62,8 @@ use smithay::{
62 delegate_input_method_manager, delegate_output, delegate_pointer_constraints,62 delegate_input_method_manager, delegate_output, delegate_pointer_constraints,
63 delegate_pointer_gestures, delegate_presentation, delegate_primary_selection,63 delegate_pointer_gestures, delegate_presentation, delegate_primary_selection,
64 delegate_relative_pointer, delegate_seat, delegate_security_context, delegate_session_lock,64 delegate_relative_pointer, delegate_seat, delegate_security_context, delegate_session_lock,
65- delegate_tablet_manager, delegate_text_input_manager, delegate_viewporter,65+ delegate_single_pixel_buffer, delegate_tablet_manager, delegate_text_input_manager,
66- delegate_virtual_keyboard_manager, delegate_xdg_activation,66+ delegate_viewporter, delegate_virtual_keyboard_manager, delegate_xdg_activation,
67 };67 };
68 68
69 pub use crate::handlers::xdg_shell::KdeDecorationsModeState;69 pub use crate::handlers::xdg_shell::KdeDecorationsModeState;
@@ -701,3 +701,5 @@ delegate_output_management!(State);
701 701
702 impl MutterX11InteropHandler for State {}702 impl MutterX11InteropHandler for State {}
703 delegate_mutter_x11_interop!(State);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 use smithay::wayland::shell::xdg::decoration::XdgDecorationState;92 use smithay::wayland::shell::xdg::decoration::XdgDecorationState;
93 use smithay::wayland::shell::xdg::XdgShellState;93 use smithay::wayland::shell::xdg::XdgShellState;
94 use smithay::wayland::shm::ShmState;94 use smithay::wayland::shm::ShmState;
95+#[cfg(test)]
96+use smithay::wayland::single_pixel_buffer::SinglePixelBufferState;
95 use smithay::wayland::socket::ListeningSocketSource;97 use smithay::wayland::socket::ListeningSocketSource;
96 use smithay::wayland::tablet_manager::TabletManagerState;98 use smithay::wayland::tablet_manager::TabletManagerState;
97 use smithay::wayland::text_input::TextInputManagerState;99 use smithay::wayland::text_input::TextInputManagerState;
@@ -263,6 +265,15 @@ pub struct Niri {
263 pub activation_state: XdgActivationState,265 pub activation_state: XdgActivationState,
264 pub mutter_x11_interop_state: MutterX11InteropManagerState,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 pub seat: Seat<State>,277 pub seat: Seat<State>,
267 /// Scancodes of the keys to suppress.278 /// Scancodes of the keys to suppress.
268 pub suppressed_keys: HashSet<Keycode>,279 pub suppressed_keys: HashSet<Keycode>,
@@ -1818,6 +1829,9 @@ impl Niri {
1818 let mutter_x11_interop_state =1829 let mutter_x11_interop_state =
1819 MutterX11InteropManagerState::new::<State, _>(&display_handle, move |_| true);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 let mut seat: Seat<State> = seat_state.new_wl_seat(&display_handle, backend.seat_name());1835 let mut seat: Seat<State> = seat_state.new_wl_seat(&display_handle, backend.seat_name());
1822 seat.add_keyboard(1836 seat.add_keyboard(
1823 config_.input.keyboard.xkb.to_xkb_config(),1837 config_.input.keyboard.xkb.to_xkb_config(),
@@ -1990,6 +2004,8 @@ impl Niri {
1990 gamma_control_manager_state,2004 gamma_control_manager_state,
1991 activation_state,2005 activation_state,
1992 mutter_x11_interop_state,2006 mutter_x11_interop_state,
2007+ #[cfg(test)]
2008+ single_pixel_buffer_state,
1993 2009
1994 seat,2010 seat,
1995 keyboard_focus: KeyboardFocus::Layout { surface: None },2011 keyboard_focus: KeyboardFocus::Layout { surface: None },