2023-05-30 20:47:12 -05:00
|
|
|
use std::{error::Error, fmt::Display};
|
|
|
|
|
2023-05-29 12:45:04 -05:00
|
|
|
use smithay::desktop::Window;
|
|
|
|
|
2023-06-01 20:23:37 -05:00
|
|
|
use crate::{backend::Backend, State};
|
2023-05-29 12:45:04 -05:00
|
|
|
|
|
|
|
pub mod automatic;
|
|
|
|
pub mod manual;
|
|
|
|
|
2023-06-01 20:23:37 -05:00
|
|
|
pub trait Layout<B: Backend> {
|
|
|
|
fn layout_windows(&self, state: &mut State<B>, windows: Vec<Window>);
|
|
|
|
fn add_window(&mut self, state: &mut State<B>, window: Window);
|
|
|
|
fn remove_window(
|
|
|
|
&mut self,
|
|
|
|
state: &mut State<B>,
|
|
|
|
window: Window,
|
|
|
|
) -> Result<(), RemoveWindowError>;
|
2023-05-30 20:47:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum RemoveWindowError {
|
|
|
|
NotFound,
|
2023-05-29 12:45:04 -05:00
|
|
|
}
|
2023-05-30 20:47:12 -05:00
|
|
|
|
|
|
|
impl Display for RemoveWindowError {
|
|
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
|
write!(f, "{:?}", self)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Error for RemoveWindowError {}
|