debug: First iteration

- Flesh out FPS counters and graph
- Add opacity slider
- Add specialized views
- Populate workspace state inspector (very basic)
This commit is contained in:
Victoria Brekenfeld 2022-01-13 00:33:02 +01:00
parent c1484cdb02
commit 5315abb9f1
9 changed files with 234 additions and 115 deletions

View file

@ -8,14 +8,14 @@ pub use smithay::{
};
use std::{cell::Cell, mem::MaybeUninit};
const MAX_WORKSPACES: usize = 10; // TODO?
pub const MAX_WORKSPACES: usize = 10; // TODO?
pub struct ActiveWorkspace(Cell<Option<usize>>);
impl ActiveWorkspace {
fn new() -> Self {
ActiveWorkspace(Cell::new(None))
}
fn get(&self) -> Option<usize> {
pub fn get(&self) -> Option<usize> {
self.0.get()
}
fn set(&self, active: usize) -> Option<usize> {
@ -26,6 +26,7 @@ impl ActiveWorkspace {
}
}
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum Mode {
OutputBound,
Global { active: usize },
@ -44,7 +45,7 @@ impl Mode {
pub struct Workspaces {
mode: Mode,
outputs: Vec<Output>,
spaces: [Space; MAX_WORKSPACES],
pub spaces: [Space; MAX_WORKSPACES],
}
const UNINIT_SPACE: MaybeUninit<Space> = MaybeUninit::uninit();
@ -166,6 +167,11 @@ impl Workspaces {
};
}
#[cfg(feature = "debug")]
pub fn mode(&self) -> &Mode {
&self.mode
}
pub fn set_mode(&mut self, mode: Mode) {
match (&mut self.mode, mode) {
(Mode::OutputBound, Mode::Global { .. }) => {