Add test-only single-pixel-buffer support

This commit is contained in:
Ivan Molodetskikh
2024-12-20 08:49:18 +03:00
parent fbb0054232
commit d38bfc4aff
2 changed files with 20 additions and 2 deletions
+4 -2
View File
@@ -62,8 +62,8 @@ use smithay::{
delegate_input_method_manager, delegate_output, delegate_pointer_constraints,
delegate_pointer_gestures, delegate_presentation, delegate_primary_selection,
delegate_relative_pointer, delegate_seat, delegate_security_context, delegate_session_lock,
delegate_tablet_manager, delegate_text_input_manager, delegate_viewporter,
delegate_virtual_keyboard_manager, delegate_xdg_activation,
delegate_single_pixel_buffer, delegate_tablet_manager, delegate_text_input_manager,
delegate_viewporter, delegate_virtual_keyboard_manager, delegate_xdg_activation,
};
pub use crate::handlers::xdg_shell::KdeDecorationsModeState;
@@ -701,3 +701,5 @@ delegate_output_management!(State);
impl MutterX11InteropHandler for State {}
delegate_mutter_x11_interop!(State);
delegate_single_pixel_buffer!(State);
+16
View File
@@ -92,6 +92,8 @@ use smithay::wayland::shell::wlr_layer::{self, Layer, WlrLayerShellState};
use smithay::wayland::shell::xdg::decoration::XdgDecorationState;
use smithay::wayland::shell::xdg::XdgShellState;
use smithay::wayland::shm::ShmState;
#[cfg(test)]
use smithay::wayland::single_pixel_buffer::SinglePixelBufferState;
use smithay::wayland::socket::ListeningSocketSource;
use smithay::wayland::tablet_manager::TabletManagerState;
use smithay::wayland::text_input::TextInputManagerState;
@@ -263,6 +265,15 @@ pub struct Niri {
pub activation_state: XdgActivationState,
pub mutter_x11_interop_state: MutterX11InteropManagerState,
// This will not work as is outside of tests, so it is gated with #[cfg(test)] for now. In
// particular, shaders will need to learn about the single pixel buffer. Also, it must be
// verified that a black single-pixel-buffer background lets the foreground surface to be
// unredirected.
//
// https://github.com/YaLTeR/niri/issues/619
#[cfg(test)]
pub single_pixel_buffer_state: SinglePixelBufferState,
pub seat: Seat<State>,
/// Scancodes of the keys to suppress.
pub suppressed_keys: HashSet<Keycode>,
@@ -1818,6 +1829,9 @@ impl Niri {
let mutter_x11_interop_state =
MutterX11InteropManagerState::new::<State, _>(&display_handle, move |_| true);
#[cfg(test)]
let single_pixel_buffer_state = SinglePixelBufferState::new::<State>(&display_handle);
let mut seat: Seat<State> = seat_state.new_wl_seat(&display_handle, backend.seat_name());
seat.add_keyboard(
config_.input.keyboard.xkb.to_xkb_config(),
@@ -1990,6 +2004,8 @@ impl Niri {
gamma_control_manager_state,
activation_state,
mutter_x11_interop_state,
#[cfg(test)]
single_pixel_buffer_state,
seat,
keyboard_focus: KeyboardFocus::Layout { surface: None },