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::{
6262 delegate_input_method_manager, delegate_output, delegate_pointer_constraints,
6363 delegate_pointer_gestures, delegate_presentation, delegate_primary_selection,
6464 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,
6767 };
6868
6969 pub use crate::handlers::xdg_shell::KdeDecorationsModeState;
@@ -701,3 +701,5 @@ delegate_output_management!(State);
701701
702702 impl MutterX11InteropHandler for State {}
703703 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};
9292 use smithay::wayland::shell::xdg::decoration::XdgDecorationState;
9393 use smithay::wayland::shell::xdg::XdgShellState;
9494 use smithay::wayland::shm::ShmState;
95+#[cfg(test)]
96+use smithay::wayland::single_pixel_buffer::SinglePixelBufferState;
9597 use smithay::wayland::socket::ListeningSocketSource;
9698 use smithay::wayland::tablet_manager::TabletManagerState;
9799 use smithay::wayland::text_input::TextInputManagerState;
@@ -263,6 +265,15 @@ pub struct Niri {
263265 pub activation_state: XdgActivationState,
264266 pub mutter_x11_interop_state: MutterX11InteropManagerState,
265267
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+
266277 pub seat: Seat<State>,
267278 /// Scancodes of the keys to suppress.
268279 pub suppressed_keys: HashSet<Keycode>,
@@ -1818,6 +1829,9 @@ impl Niri {
18181829 let mutter_x11_interop_state =
18191830 MutterX11InteropManagerState::new::<State, _>(&display_handle, move |_| true);
18201831
1832+ #[cfg(test)]
1833+ let single_pixel_buffer_state = SinglePixelBufferState::new::<State>(&display_handle);
1834+
18211835 let mut seat: Seat<State> = seat_state.new_wl_seat(&display_handle, backend.seat_name());
18221836 seat.add_keyboard(
18231837 config_.input.keyboard.xkb.to_xkb_config(),
@@ -1990,6 +2004,8 @@ impl Niri {
19902004 gamma_control_manager_state,
19912005 activation_state,
19922006 mutter_x11_interop_state,
2007+ #[cfg(test)]
2008+ single_pixel_buffer_state,
19932009
19942010 seat,
19952011 keyboard_focus: KeyboardFocus::Layout { surface: None },