x11: add nested x11 backend

This commit is contained in:
Victoria Brekenfeld 2021-12-15 23:23:49 +01:00
parent 2698c06f50
commit 74a4ed1058
7 changed files with 470 additions and 29 deletions

View file

@ -1,19 +1,44 @@
// SPDX-License-Identifier: GPL-3.0-only
use std::{cell::RefCell, rc::Rc};
use smithay::reexports::wayland_server::Display;
use crate::backend::x11::X11State;
use smithay::{desktop::Space, reexports::wayland_server::Display};
use std::{cell::RefCell, rc::Rc, time::Instant};
pub struct State {
pub display: Rc<RefCell<Display>>,
pub spaces: Space, //TODO: Multiple workspaces
pub start_time: Instant,
pub should_stop: bool,
pub backend: BackendData,
}
pub enum BackendData {
X11(X11State),
// TODO
// Wayland(WaylandState),
// Udev(UdevState),
Unset,
}
impl BackendData {
pub fn x11(&mut self) -> &mut X11State {
match self {
BackendData::X11(ref mut x11_state) => x11_state,
_ => unreachable!("Called x11 in non x11 backend"),
}
}
}
impl State {
pub fn new(display: Display) -> State {
State {
display: Rc::new(RefCell::new(display)),
spaces: Space::new(slog_scope::logger() /*TODO*/),
start_time: Instant::now(),
should_stop: false,
backend: BackendData::Unset,
}
}
}