debug: Remove old debug overlay

This commit is contained in:
Victoria Brekenfeld 2022-11-22 09:57:29 +01:00
parent 1de4b97bca
commit 9c41c80345
3 changed files with 4 additions and 292 deletions

View file

@ -13,9 +13,7 @@ use smithay::{
glow::GlowRenderer,
},
},
desktop::layer_map_for_output,
reexports::wayland_server::Resource,
utils::{IsAlive, Logical, Rectangle},
utils::{Logical, Rectangle},
};
pub const ELEMENTS_COLOR: Color32 = Color32::from_rgb(70, 198, 115);
@ -123,11 +121,11 @@ pub fn fps_ui(
std::env!("CARGO_PKG_VERSION")
));
if let Some(hash) = std::option_env!("GIT_HASH").and_then(|x| x.get(0..10)) {
ui.label(format!(" :{hash}"));
ui.label(format!(": {hash}"));
}
if !state.egui.active {
ui.label("Press Super+Escape for debug menu");
ui.label("Press Super+Escape for debug overlay");
} else {
ui.set_max_width(300.0);
ui.separator();
@ -190,204 +188,3 @@ pub fn fps_ui(
state.clock.now().into(),
)
}
/*
pub fn debug_ui(
state: &mut Common,
area: Rectangle<f64, Physical>,
scale: f64,
) -> Option<EguiFrame> {
if !state.egui.active {
return None;
}
Some(state.egui.debug_state.run(
|ctx| {
use crate::utils::prelude::*;
egui::Window::new("Workspaces")
.default_pos([0.0, 300.0])
.vscroll(true)
.collapsible(true)
.show(ctx, |ui| {
use crate::{
config::WorkspaceMode as ConfigMode,
shell::{OutputBoundState, WorkspaceMode, MAX_WORKSPACES},
};
ui.set_min_width(250.0);
// Mode
ui.label(egui::RichText::new("Mode").heading());
let mut mode = match &state.shell.workspace_mode {
WorkspaceMode::Global { .. } => ConfigMode::Global,
WorkspaceMode::OutputBound => ConfigMode::OutputBound,
};
ui.radio_value(&mut mode, ConfigMode::OutputBound, "Output bound");
ui.radio_value(&mut mode, ConfigMode::Global, "Global");
state.shell.set_mode(mode);
let mode = match &state.shell.workspace_mode {
WorkspaceMode::OutputBound => (ConfigMode::OutputBound, None),
WorkspaceMode::Global { ref active, .. } => {
(ConfigMode::Global, Some(*active))
}
};
match mode {
(ConfigMode::OutputBound, _) => {
ui.label("Workspaces:");
for output in state.shell.outputs().cloned().collect::<Vec<_>>() {
ui.horizontal(|ui| {
let active = output
.user_data()
.get::<OutputBoundState>()
.unwrap()
.active
.get();
let mut active_val = active as f64;
ui.label(output.name());
ui.add(
egui::DragValue::new(&mut active_val)
.clamp_range(0..=(MAX_WORKSPACES - 1))
.speed(1.0),
);
if active != active_val as usize {
state.shell.activate(
&state.seats[0],
&output,
active_val as usize,
);
}
});
}
}
(ConfigMode::Global, Some(active)) => {
ui.horizontal(|ui| {
let mut active_val = active as f64;
ui.label("Workspace:");
ui.add(
egui::DragValue::new(&mut active_val)
.clamp_range(0..=(MAX_WORKSPACES - 1))
.speed(1.0),
);
if active != active_val as usize {
let output = state.shell.outputs().next().cloned().unwrap();
state.shell.activate(
&state.seats[0],
&output,
active_val as usize,
);
}
});
}
_ => unreachable!(),
}
// Spaces
for (i, workspace) in state.shell.spaces.iter().enumerate() {
ui.collapsing(format!("Space: {}", i), |ui| {
ui.collapsing(format!("Windows"), |ui| {
for window in workspace.space.windows() {
ui.collapsing(format!("{:?}", window.toplevel()), |ui| {
ui.label(format!("Rect: {:?}", {
let mut geo = window.geometry();
geo.loc += workspace
.space
.window_location(window)
.unwrap_or((0, 0).into());
geo
}));
ui.label(format!(
"Bounding box: {:?}",
workspace.space.window_bbox(window)
));
});
}
})
});
}
});
egui::Window::new("Outputs")
.collapsible(true)
.hscroll(true)
.default_pos([300.0, 300.0])
.show(ctx, |ui| {
ui.label(format!("Global Space: {:?}", state.shell.global_space()));
for output in state
.shell
.outputs()
.cloned()
.collect::<Vec<_>>()
.into_iter()
{
ui.separator();
ui.collapsing(output.name(), |ui| {
ui.label(format!("Mode: {:#?}", output.current_mode()));
ui.label(format!("Scale: {:#?}", output.current_scale()));
ui.label(format!("Transform: {:#?}", output.current_transform()));
ui.label(format!("Geometry: {:?}", output.geometry()));
ui.label(format!(
"Local Geometry: {:?}",
state
.shell
.active_space(&output)
.space
.output_geometry(&output)
));
ui.label(format!(
"Relative Geometry: {:?}",
state
.shell
.space_relative_output_geometry((0i32, 0i32), &output)
));
ui.separator();
ui.collapsing("Layers:", |ui| {
let map = layer_map_for_output(&output);
for layer in map.layers() {
ui.collapsing(
format!(
"{}/{:?}",
layer.wl_surface().id(),
layer.wl_surface().client_id()
),
|ui| {
ui.label(format!(
"Alive: {:?} {:?} {:?}",
layer.alive(),
layer.layer_surface().alive(),
layer.wl_surface().alive()
));
ui.label(format!("Layer: {:?}", layer.layer()));
ui.label(format!("Namespace: {:?}", layer.namespace()));
ui.label(format!("Geometry: {:?}", layer.bbox()));
ui.label(format!(
"Anchor: {:?}",
layer.cached_state().anchor
));
ui.label(format!(
"Margin: {:?}",
layer.cached_state().margin
));
ui.label(format!(
"Exclusive: {:?}",
layer.cached_state().exclusive_zone
));
},
);
}
ui.label(format!("{:?}", map));
});
});
}
});
},
area,
scale,
state.egui.alpha,
&state.start_time,
state.egui.modifiers.clone(),
))
}
*/

View file

@ -163,10 +163,6 @@ impl State {
_ => {}
}
}
#[cfg(feature = "debug")]
{
self.common.egui.debug_state.handle_device_added(&device);
}
}
InputEvent::DeviceRemoved { device } => {
for seat in &mut self.common.seats() {
@ -182,10 +178,6 @@ impl State {
break;
}
}
#[cfg(feature = "debug")]
{
self.common.egui.debug_state.handle_device_removed(&device);
}
}
InputEvent::Keyboard { event, .. } => {
use smithay::backend::input::KeyboardKeyEvent;
@ -230,25 +222,6 @@ impl State {
{
return FilterResult::Intercept(None);
}
#[cfg(feature = "debug")]
{
if data.common.seats().position(|x| x == seat).unwrap() == 0
&& data.common.egui.active
{
if data.common.egui.debug_state.wants_keyboard() {
data.common.egui.debug_state.handle_keyboard(
&handle,
state == KeyState::Pressed,
modifiers.clone(),
);
userdata
.get::<SupressedKeys>()
.unwrap()
.add(&handle);
return FilterResult::Intercept(None);
}
}
}
if state == KeyState::Pressed
&& (keysyms::KEY_XF86Switch_VT_1..=KEY_XF86Switch_VT_12)
@ -371,14 +344,6 @@ impl State {
time: event.time(),
},
);
#[cfg(feature = "debug")]
if self.common.seats().position(|x| x == seat).unwrap() == 0 {
self.common
.egui
.debug_state
.handle_pointer_motion(position.to_i32_round());
}
break;
}
}
@ -416,13 +381,6 @@ impl State {
},
);
#[cfg(feature = "debug")]
if self.common.seats().position(|x| x == seat).unwrap() == 0 {
self.common
.egui
.debug_state
.handle_pointer_motion(position.to_i32_round());
}
break;
}
}
@ -435,21 +393,6 @@ impl State {
let userdata = seat.user_data();
let devices = userdata.get::<Devices>().unwrap();
if devices.has_device(&device) {
#[cfg(feature = "debug")]
if self.common.seats().position(|x| x == seat).unwrap() == 0
&& self.common.egui.active
{
if self.common.egui.debug_state.wants_pointer() {
if let Some(button) = event.button() {
self.common.egui.debug_state.handle_pointer_button(
button,
event.state() == ButtonState::Pressed,
);
}
break;
}
}
let serial = SERIAL_COUNTER.next_serial();
let button = event.button_code();
if event.state() == ButtonState::Pressed {
@ -543,25 +486,6 @@ impl State {
InputEvent::PointerAxis { event, .. } => {
let device = event.device();
for seat in self.common.seats().cloned().collect::<Vec<_>>().iter() {
#[cfg(feature = "debug")]
if self.common.seats().position(|x| x == seat).unwrap() == 0
&& self.common.egui.active
{
if self.common.egui.debug_state.wants_pointer() {
self.common.egui.debug_state.handle_pointer_axis(
event
.amount_discrete(Axis::Horizontal)
.or_else(|| event.amount(Axis::Horizontal).map(|x| x * 3.0))
.unwrap_or(0.0),
event
.amount_discrete(Axis::Vertical)
.or_else(|| event.amount(Axis::Vertical).map(|x| x * 3.0))
.unwrap_or(0.0),
);
break;
}
}
let userdata = seat.user_data();
let devices = userdata.get::<Devices>().unwrap();
if devices.has_device(&device) {

View file

@ -252,14 +252,7 @@ impl State {
log,
#[cfg(feature = "debug")]
egui: Egui {
debug_state: smithay_egui::EguiState::new(Rectangle::from_loc_and_size(
(0, 0),
(400, 800),
)),
active: false,
alpha: 1.0,
},
egui: Egui { active: false },
compositor_state,
data_device_state,
@ -435,9 +428,7 @@ impl Common {
#[cfg(feature = "debug")]
pub struct Egui {
pub debug_state: smithay_egui::EguiState,
pub active: bool,
pub alpha: f32,
}
#[cfg(feature = "debug")]