mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2024-12-25 09:59:21 +01:00
Fix builtin config and metaconfig xwayland
This commit is contained in:
parent
7b006596af
commit
dc70a8a3e7
7 changed files with 39 additions and 36 deletions
|
@ -55,10 +55,10 @@ pub enum Backend {
|
|||
Dummy(Dummy),
|
||||
}
|
||||
|
||||
pub struct UninitBackend<B> {
|
||||
pub seat_name: String,
|
||||
pub(crate) struct UninitBackend<B> {
|
||||
pub(crate) seat_name: String,
|
||||
#[allow(clippy::complexity)]
|
||||
pub init: Box<dyn FnOnce(&mut Pinnacle) -> anyhow::Result<B>>,
|
||||
pub(crate) init: Box<dyn FnOnce(&mut Pinnacle) -> anyhow::Result<B>>,
|
||||
}
|
||||
|
||||
impl Backend {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
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, DisplayHandle};
|
||||
use smithay::reexports::wayland_server::DisplayHandle;
|
||||
use smithay::utils::{Physical, Size};
|
||||
|
||||
use smithay::{
|
||||
|
@ -24,7 +22,7 @@ pub const DUMMY_OUTPUT_NAME: &str = "Dummy Window";
|
|||
#[cfg(feature = "wlcs")]
|
||||
#[derive(Default)]
|
||||
pub struct Wlcs {
|
||||
pub clients: HashMap<i32, Client>,
|
||||
pub clients: std::collections::HashMap<i32, smithay::reexports::wayland_server::Client>,
|
||||
}
|
||||
|
||||
pub struct Dummy {
|
||||
|
@ -55,7 +53,7 @@ impl BackendData for Dummy {
|
|||
}
|
||||
|
||||
impl Dummy {
|
||||
pub fn try_new(display_handle: DisplayHandle) -> UninitBackend<Dummy> {
|
||||
pub(crate) fn try_new(display_handle: DisplayHandle) -> UninitBackend<Dummy> {
|
||||
let mode = smithay::output::Mode {
|
||||
size: (1920, 1080).into(),
|
||||
refresh: 60_000,
|
||||
|
|
|
@ -164,7 +164,7 @@ impl Backend {
|
|||
}
|
||||
|
||||
impl Udev {
|
||||
pub fn try_new(display_handle: DisplayHandle) -> anyhow::Result<UninitBackend<Udev>> {
|
||||
pub(crate) fn try_new(display_handle: DisplayHandle) -> anyhow::Result<UninitBackend<Udev>> {
|
||||
// Initialize session
|
||||
let (session, notifier) = LibSeatSession::new()?;
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ impl Backend {
|
|||
}
|
||||
|
||||
impl Winit {
|
||||
pub fn try_new(display_handle: DisplayHandle) -> anyhow::Result<UninitBackend<Winit>> {
|
||||
pub(crate) fn try_new(display_handle: DisplayHandle) -> anyhow::Result<UninitBackend<Winit>> {
|
||||
let window_builder = WindowBuilder::new()
|
||||
.with_title("Pinnacle")
|
||||
.with_name("pinnacle", "pinnacle")
|
||||
|
|
|
@ -131,11 +131,11 @@ impl Metaconfig {
|
|||
}),
|
||||
socket_dir,
|
||||
no_config: cli
|
||||
.map(|cli| cli.no_config)
|
||||
.and_then(|cli| cli.no_config.then_some(true))
|
||||
.or(self.no_config)
|
||||
.unwrap_or_default(),
|
||||
no_xwayland: cli
|
||||
.map(|cli| cli.no_xwayland)
|
||||
.and_then(|cli| cli.no_xwayland.then_some(true))
|
||||
.or(self.no_xwayland)
|
||||
.unwrap_or_default(),
|
||||
})
|
||||
|
@ -388,14 +388,18 @@ impl Pinnacle {
|
|||
pinnacle.start_config(true)
|
||||
};
|
||||
|
||||
let metaconfig = match parse_metaconfig(&self.config.config_dir) {
|
||||
Ok(metaconfig) => metaconfig,
|
||||
Err(err) => {
|
||||
let msg = format!(
|
||||
"Could not load `metaconfig.toml` at {}: {err}",
|
||||
self.config.config_dir.display()
|
||||
);
|
||||
return load_default_config(self, &msg);
|
||||
let metaconfig = if builtin {
|
||||
Metaconfig::default()
|
||||
} else {
|
||||
match parse_metaconfig(&self.config.config_dir) {
|
||||
Ok(metaconfig) => metaconfig,
|
||||
Err(err) => {
|
||||
let msg = format!(
|
||||
"Could not load `metaconfig.toml` at {}: {err}",
|
||||
self.config.config_dir.display()
|
||||
);
|
||||
return load_default_config(self, &msg);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -102,21 +102,21 @@ impl CompositorHandler for State {
|
|||
});
|
||||
if let Some(dmabuf) = maybe_dmabuf {
|
||||
if let Ok((blocker, source)) = dmabuf.generate_blocker(Interest::READ) {
|
||||
let client = surface
|
||||
.client()
|
||||
.expect("Surface has no client/is no longer alive");
|
||||
let res =
|
||||
state
|
||||
.pinnacle
|
||||
.loop_handle
|
||||
.insert_source(source, move |_, _, state| {
|
||||
state
|
||||
.client_compositor_state(&client)
|
||||
.blocker_cleared(state, &state.pinnacle.display_handle.clone());
|
||||
Ok(())
|
||||
});
|
||||
if res.is_ok() {
|
||||
compositor::add_blocker(surface, blocker);
|
||||
if let Some(client) = surface.client() {
|
||||
let res =
|
||||
state
|
||||
.pinnacle
|
||||
.loop_handle
|
||||
.insert_source(source, move |_, _, state| {
|
||||
state.client_compositor_state(&client).blocker_cleared(
|
||||
state,
|
||||
&state.pinnacle.display_handle.clone(),
|
||||
);
|
||||
Ok(())
|
||||
});
|
||||
if res.is_ok() {
|
||||
compositor::add_blocker(surface, blocker);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,8 +123,9 @@ static SUPPORTED_EXTENSIONS: &[WlcsExtensionDescriptor] = extension_list!(
|
|||
("wp_viewporter", 1),
|
||||
("xdg_shell", 6),
|
||||
("linux-dmabuf-v1", 5),
|
||||
("xdg_shell", 6),
|
||||
("security-context", 1),
|
||||
("zwp_pointer_constraints_v1", 1),
|
||||
("zwp_relative_pointer_manager_v1", 1),
|
||||
);
|
||||
|
||||
static DESCRIPTOR: WlcsIntegrationDescriptor = WlcsIntegrationDescriptor {
|
||||
|
|
Loading…
Reference in a new issue