Remove backend/wlcs.rs

The tests don't work yay
This commit is contained in:
Ottatop 2024-05-04 15:31:11 -05:00
parent b654de8284
commit 9771f4c645
3 changed files with 17 additions and 74 deletions

View file

@ -45,8 +45,6 @@ use self::{udev::Udev, winit::Winit};
pub mod dummy;
pub mod udev;
pub mod winit;
#[cfg(feature = "wlcs")]
pub mod wlcs;
pub enum Backend {
/// The compositor is running in a Winit window

View file

@ -1,9 +1,12 @@
use std::collections::HashMap;
use pinnacle_api_defs::pinnacle::signal::v0alpha1::{
OutputConnectResponse, OutputDisconnectResponse,
};
use smithay::backend::renderer::test::DummyRenderer;
use smithay::backend::renderer::ImportMemWl;
use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface;
use smithay::reexports::wayland_server::Client;
use smithay::utils::{Physical, Size};
use smithay::{
@ -15,13 +18,17 @@ use smithay::{
use crate::config::StartupSettings;
use crate::state::{Pinnacle, State, WithState};
#[cfg(feature = "wlcs")]
use super::wlcs::Wlcs;
use super::Backend;
use super::BackendData;
pub const DUMMY_OUTPUT_NAME: &str = "Dummy Window";
#[cfg(feature = "wlcs")]
#[derive(Default)]
pub struct Wlcs {
pub clients: HashMap<i32, Client>,
}
pub struct Dummy {
pub renderer: DummyRenderer,
// pub dmabuf_state: (DmabufState, DmabufGlobal, Option<DmabufFeedback>),
@ -34,6 +41,14 @@ impl Backend {
let Backend::Dummy(dummy) = self else { unreachable!() };
dummy
}
#[cfg(feature = "wlcs")]
pub fn wlcs_mut(&mut self) -> &mut Wlcs {
let Backend::Dummy(dummy) = self else {
unreachable!(r#"feature gated by "wlcs""#)
};
&mut dummy.wlcs_state
}
}
impl BackendData for Dummy {

View file

@ -1,70 +0,0 @@
use std::{collections::HashMap, path::Path};
use smithay::reexports::{calloop, wayland_server::Client};
use tracing::debug;
use crate::{
state::{Pinnacle, WithState},
tag::TagId,
};
use super::Backend;
#[derive(Default)]
pub struct Wlcs {
pub clients: HashMap<i32, Client>,
}
impl Backend {
pub fn wlcs_mut(&mut self) -> &mut Wlcs {
let Backend::Dummy(dummy) = self else {
unreachable!(r#"feature gated by "wlcs""#)
};
&mut dummy.wlcs_state
}
}
impl Pinnacle {
pub fn start_wlcs_config<F>(&mut self, socket_dir: &Path, run_config: F) -> anyhow::Result<()>
where
F: FnOnce() + Send + 'static,
{
// Clear state
debug!("Clearing tags");
for output in self.space.outputs() {
output.with_state_mut(|state| state.tags.clear());
}
TagId::reset();
debug!("Clearing input state");
self.input_state.clear();
self.config.clear(&self.loop_handle);
self.signal_state.clear();
self.input_state.reload_keybind = None;
self.input_state.kill_keybind = None;
if self.grpc_server_join_handle.is_none() {
self.start_grpc_server(socket_dir)?;
}
let (pinger, ping_source) = calloop::ping::make_ping()?;
let token = self
.loop_handle
.insert_source(ping_source, move |_, _, _state| {})?;
std::thread::spawn(move || {
run_config();
pinger.ping();
});
self.config.config_reload_on_crash_token = Some(token);
Ok(())
}
}