x11: add nested x11 backend
This commit is contained in:
parent
2698c06f50
commit
74a4ed1058
7 changed files with 470 additions and 29 deletions
31
src/state.rs
31
src/state.rs
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue