#![doc(
html_logo_url = "https://raw.githubusercontent.com/VimYoung/Spell/main/spell-framework/assets/spell_trans.png"
)]
#![doc(
html_favicon_url = "https://raw.githubusercontent.com/VimYoung/Spell/main/spell-framework/assets/spell_trans.ico"
)]
#![doc = include_str!("../docs/entry.md")]
#![warn(missing_docs)]
mod configure;
#[cfg(docsrs)]
mod dummy_skia_docs;
mod event_macros;
pub mod forge;
#[cfg(feature = "i-slint-renderer-skia")]
#[cfg(not(docsrs))]
#[doc(hidden)]
mod skia_non_docs;
pub mod slint_adapter;
pub mod vault;
pub mod wayland_adapter;
pub mod layer_properties {
pub use crate::configure::{WindowConf, WindowConfBuilder};
pub use smithay_client_toolkit::shell::wlr_layer::Anchor as LayerAnchor;
pub use smithay_client_toolkit::shell::wlr_layer::KeyboardInteractivity as BoardType;
pub use smithay_client_toolkit::shell::wlr_layer::Layer as LayerType;
}
pub mod macro_internal {
pub use crate::vault::set_notification;
pub use paste::paste;
pub use smithay_client_toolkit::reexports::calloop::{
Interest, Mode, PostAction, generic::Generic,
};
pub use tracing::{info, span::Span, warn};
}
use std::error::Error;
use tracing::{Level, span, trace};
pub trait IpcController {
fn get_type(&self, key: &str) -> String;
fn change_val(&self, key: &str, val: &str);
fn custom_command(&self, _command: &str) {}
}
pub trait SpellAssociatedNew: std::fmt::Debug {
fn on_call(&mut self) -> Result<(), Box<dyn Error>>;
fn get_span(&self) -> span::Span {
span!(Level::INFO, "unnamed-widget")
}
fn is_locked(&self) -> bool {
true
}
}
pub fn cast_spell_inner<S: SpellAssociatedNew>(mut waywindow: S) -> Result<(), Box<dyn Error>> {
let span = waywindow.get_span();
let _gaurd = span.enter();
trace!("{:?}", &waywindow);
while waywindow.is_locked() {
waywindow.on_call()?
}
Ok(())
}
pub fn cast_spells_new(
mut windows: Vec<Box<dyn SpellAssociatedNew>>,
) -> Result<(), Box<dyn Error>> {
loop {
for win in windows.iter_mut() {
let span = win.get_span().clone();
let _gaurd = span.enter();
win.on_call()?;
}
}
}