From 928ce9c6f6e931f2cd798b6f95b939e6719ccfb2 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Tue, 11 Jan 2022 17:22:23 +0100 Subject: [PATCH] debug: Wire up egui-interface --- Cargo.lock | 179 ++++++++++++++++++++++++++++++++++++--------- Cargo.toml | 14 +++- src/backend/x11.rs | 49 ++++++++++--- src/input/mod.rs | 115 ++++++++++++++++++++++++++++- src/main.rs | 2 +- src/state.rs | 19 +++++ 6 files changed, 328 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c5078324..2c57008c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,22 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ab_glyph" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61caed9aec6daeee1ea38ccf5fb225e4f96c1eeead1b4a5c267324a63cf02326" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13739d7177fbd22bb0ed28badfff9f372f8bef46c863db4e1c6248f6b223b6e" + [[package]] name = "addr2line" version = "0.17.0" @@ -18,10 +34,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] -name = "anyhow" -version = "1.0.51" +name = "ahash" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "anyhow" +version = "1.0.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84450d0b4a8bd1ba4144ce8ce718fbc5d071358b1e5384bace6536b3d1f2d5b3" dependencies = [ "backtrace", ] @@ -47,6 +74,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5d78ce20460b82d3fa150275ed9d55e21064fc7951177baacf86a145c4a4b1f" +[[package]] +name = "atomic_refcell" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b5e5f48b927f04e952dedc932f31995a65a0bf65ec971c74436e51bf6e970d" + [[package]] name = "atty" version = "0.2.14" @@ -87,9 +120,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "calloop" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42dcfbd723aa6eff9f024cfd5ad08b11144d79b2d8d37b4a31a006ceab255c77" +checksum = "bf2eec61efe56aa1e813f5126959296933cf0700030e4314786c48779a66ab82" dependencies = [ "log", "nix", @@ -136,19 +169,21 @@ version = "0.1.0" dependencies = [ "anyhow", "bitflags", + "egui", "slog", "slog-async", "slog-scope", "slog-stdlog", "slog-term", "smithay", + "smithay-egui", ] [[package]] name = "crossbeam-channel" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" +checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa" dependencies = [ "cfg-if", "crossbeam-utils", @@ -156,9 +191,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" +checksum = "cfcae03edb34f947e64acdb1c33ec169824e20657e9ecb61cef6c8c74dcb8120" dependencies = [ "cfg-if", "lazy_static", @@ -236,6 +271,45 @@ dependencies = [ "libc", ] +[[package]] +name = "egui" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c733356eb5f1139fdeedc370c00e9ea689c5d9120502c43925285bc7249a333" +dependencies = [ + "ahash", + "epaint", + "nohash-hasher", +] + +[[package]] +name = "emath" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55673de2eb96660dde25ba7b2d36a7054beead1a2bec74dcfd5eb05a1e1ba76d" + +[[package]] +name = "epaint" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adfd9296f7f92902e41c0e8e5deca6d2fb29f289c86d03a01ea01bd7498316c2" +dependencies = [ + "ab_glyph", + "ahash", + "atomic_refcell", + "emath", + "nohash-hasher", +] + +[[package]] +name = "fastrand" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "779d043b6a0b90cc4c0ed7ee380a6504394cee7efd7db050e3774eee387324b2" +dependencies = [ + "instant", +] + [[package]] name = "gbm" version = "0.7.0" @@ -313,9 +387,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" +checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" dependencies = [ "autocfg", "hashbrown", @@ -414,6 +488,12 @@ dependencies = [ "memoffset", ] +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + [[package]] name = "num-integer" version = "0.1.44" @@ -448,6 +528,15 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" +[[package]] +name = "owned_ttf_parser" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ef05f2882a8b3e7acc10c153ade2631f7bfc8ce00d2bf3fb8f4e9d2ae6ea5c3" +dependencies = [ + "ttf-parser", +] + [[package]] name = "parking_lot" version = "0.11.2" @@ -481,24 +570,24 @@ checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" [[package]] name = "ppv-lite86" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] name = "proc-macro2" -version = "1.0.34" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f84e92c0f7c9d58328b85a78557813e4bd845130db68d7184635344399423b1" +checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" dependencies = [ "unicode-xid", ] [[package]] name = "quote" -version = "1.0.10" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" +checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d" dependencies = [ "proc-macro2", ] @@ -663,7 +752,7 @@ checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" [[package]] name = "smithay" version = "0.3.0" -source = "git+https://github.com/Smithay/smithay.git?rev=820e67f#820e67f82c69c3524740cf8b85a5c1c3a59c32f7" +source = "git+https://github.com/Smithay/smithay.git?branch=feature/egl_userdata#1edff977226474e25e0fe90cbfb91860978b80cc" dependencies = [ "appendlist", "bitflags", @@ -694,11 +783,23 @@ dependencies = [ "xkbcommon", ] +[[package]] +name = "smithay-egui" +version = "0.1.0" +source = "git+https://github.com/Smithay/smithay-egui.git?rev=ad146d59#ad146d59cc35199ef68024cc04c0a6e0c40b0d91" +dependencies = [ + "egui", + "lazy_static", + "memoffset", + "slog", + "smithay", +] + [[package]] name = "syn" -version = "1.0.82" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59" +checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7" dependencies = [ "proc-macro2", "quote", @@ -713,13 +814,13 @@ checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" [[package]] name = "tempfile" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ "cfg-if", + "fastrand", "libc", - "rand", "redox_syscall", "remove_dir_all", "winapi", @@ -775,12 +876,24 @@ dependencies = [ "winapi", ] +[[package]] +name = "ttf-parser" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ccbe8381883510b6a2d8f1e32905bddd178c11caef8083086d0c0c9ab0ac281" + [[package]] name = "unicode-xid" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + [[package]] name = "wasi" version = "0.10.2+wasi-snapshot-preview1" @@ -789,9 +902,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wayland-commons" -version = "0.29.1" +version = "0.29.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "265ef51b3b3e5c9ef098f10425c39624663f459c3821dcaacc4748be975f1beb" +checksum = "94f6e5e340d7c13490eca867898c4cec5af56c27a5ffe5c80c6fc4708e22d33e" dependencies = [ "nix", "once_cell", @@ -801,9 +914,9 @@ dependencies = [ [[package]] name = "wayland-protocols" -version = "0.29.1" +version = "0.29.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b3b6f1dc0193072ef4eadcb144da30d58c1f2895516c063804d213310703c8e" +checksum = "60147ae23303402e41fe034f74fb2c35ad0780ee88a1c40ac09a3be1e7465741" dependencies = [ "bitflags", "wayland-commons", @@ -813,9 +926,9 @@ dependencies = [ [[package]] name = "wayland-scanner" -version = "0.29.1" +version = "0.29.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaaf2bc85e7b9143159af96bd23d954a5abe391c4376db712320643280fdc6f4" +checksum = "39a1ed3143f7a143187156a2ab52742e89dac33245ba505c17224df48939f9e0" dependencies = [ "proc-macro2", "quote", @@ -824,9 +937,9 @@ dependencies = [ [[package]] name = "wayland-server" -version = "0.29.1" +version = "0.29.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0307b0fbbae986e86934b8fbcc56299bbaf8de0b5ad0f00405fb583503c085a" +checksum = "c6cc7a08542e2cdbca4a55daa9b5b9dce492f9703c8948045a5cae86847b48f2" dependencies = [ "bitflags", "downcast-rs", @@ -842,9 +955,9 @@ dependencies = [ [[package]] name = "wayland-sys" -version = "0.29.1" +version = "0.29.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba9e06acb775b3007f8d3094438306979e572d1d3b844d7a71557a84b055d959" +checksum = "d9341df79a8975679188e37dab3889bfa57c44ac2cb6da166f519a81cbe452d4" dependencies = [ "dlib", "libc", diff --git a/Cargo.toml b/Cargo.toml index a3d4a5ac..0a084a24 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,10 +13,20 @@ slog-term = "2.8" slog-async = "2.7" slog-scope = "4.4" slog-stdlog = "4.1" +egui = { version = "0.16", optional = true } [dependencies.smithay] version = "0.3" git = "https://github.com/Smithay/smithay.git" -rev = "820e67f" +branch = "feature/egl_userdata" default-features = false -features = ["backend_x11", "backend_egl", "desktop", "use_system_lib", "renderer_gl", "wayland_frontend"] \ No newline at end of file +features = ["backend_x11", "backend_egl", "desktop", "use_system_lib", "renderer_gl", "wayland_frontend"] + +[dependencies.smithay-egui] +git = "https://github.com/Smithay/smithay-egui.git" +rev = "ad146d59" +optional = true + +[features] +default = ["debug"] +debug = ["egui", "smithay-egui"] \ No newline at end of file diff --git a/src/backend/x11.rs b/src/backend/x11.rs index d5393601..a6ae140e 100644 --- a/src/backend/x11.rs +++ b/src/backend/x11.rs @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only +use crate::state::Common; use crate::{ input::{set_active_output, Devices}, state::{BackendData, State}, @@ -15,7 +16,7 @@ use smithay::{ renderer::{gles2::Gles2Renderer, Bind, ImportDma, ImportEgl, Unbind}, x11::{Window, WindowBuilder, X11Backend, X11Event, X11Handle, X11Input, X11Surface}, }, - desktop::{layer_map_for_output, Space}, + desktop::layer_map_for_output, reexports::{ calloop::{ping, EventLoop, LoopHandle}, gbm::Device as GbmDevice, @@ -33,7 +34,6 @@ use std::{ cell::RefCell, rc::Rc, sync::{Arc, Mutex}, - time::Instant, }; pub struct X11State { @@ -96,10 +96,10 @@ impl X11State { .iter_mut() .find(|s| s.output == output_ref) { - if let Err(err) = surface.render_from_space( + if let Err(err) = surface.render_output( &mut *x11_state.renderer.borrow_mut(), - state.common.spaces.active_space_mut(&output_ref), - &state.common.start_time, + &output_ref, + &mut state.common, ) { slog_scope::error!("Error rendering: {}", err); } @@ -130,12 +130,41 @@ pub struct Surface { } impl Surface { - pub fn render_from_space( + pub fn render_output( &mut self, renderer: &mut Gles2Renderer, - space: &mut Space, - start_time: &Instant, + output: &Output, + state: &mut Common, ) -> Result<()> { + #[allow(unused_mut)] + let mut custom_elements = Vec::new(); + let space = state.spaces.active_space_mut(output); + + #[cfg(feature = "debug")] + if state.egui.active { + let size = space.output_geometry(&self.output).unwrap(); + let scale = space.output_scale(&self.output).unwrap(); + let frame = state.egui.state.run( + |ctx| { + egui::SidePanel::left("my_left_panel").show(ctx, |ui| { + ui.label(format!( + "cosmic-comp version {}", + std::env!("CARGO_PKG_VERSION") + )); + }); + }, + size, + size.to_f64().to_physical(scale).to_i32_round().size, + scale, + state.egui.alpha, + &state.start_time, + state.egui.modifiers.clone(), + ); + custom_elements.push( + Box::new(frame) as smithay::desktop::space::DynamicRenderElements + ); + } + let (buffer, age) = self .surface .buffer() @@ -148,11 +177,11 @@ impl Surface { &self.output, age as usize, [0.153, 0.161, 0.165, 1.0], - &[], + &*custom_elements, ) { Ok(Some(_)) => { slog_scope::trace!("Finished rendering"); - space.send_frames(false, start_time.elapsed().as_millis() as u32); + space.send_frames(false, state.start_time.elapsed().as_millis() as u32); self.surface .submit() .with_context(|| "Failed to submit buffer for display")?; diff --git a/src/input/mod.rs b/src/input/mod.rs index a9c1dbe3..b556b242 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -2,14 +2,14 @@ use crate::state::State; use smithay::{ - backend::input::{Device, DeviceCapability, InputBackend, InputEvent}, + backend::input::{Device, DeviceCapability, InputBackend, InputEvent, KeyState}, desktop::{layer_map_for_output, Space}, reexports::wayland_server::{protocol::wl_surface::WlSurface, Display}, utils::{Logical, Point}, wayland::{ data_device::set_data_device_focus, output::Output, - seat::{CursorImageStatus, FilterResult, Keysym, Seat, XkbConfig}, + seat::{keysyms, CursorImageStatus, FilterResult, KeysymHandle, Seat, XkbConfig}, shell::wlr_layer::Layer as WlrLayer, SERIAL_COUNTER, }, @@ -17,9 +17,29 @@ use smithay::{ use std::{cell::RefCell, collections::HashMap}; pub struct ActiveOutput(pub RefCell); - +pub struct SupressedKeys(RefCell>); pub struct Devices(RefCell>>); +impl SupressedKeys { + fn new() -> SupressedKeys { + SupressedKeys(RefCell::new(Vec::new())) + } + + fn add(&self, keysym: &KeysymHandle) { + self.0.borrow_mut().push(keysym.raw_code()); + } + + fn filter(&self, keysym: &KeysymHandle) -> bool { + let mut keys = self.0.borrow_mut(); + if let Some(i) = keys.iter().position(|x| *x == keysym.raw_code()) { + keys.remove(i); + true + } else { + false + } + } +} + impl Devices { fn new() -> Devices { Devices(RefCell::new(HashMap::new())) @@ -61,8 +81,8 @@ pub fn add_seat(display: &mut Display, name: String) -> Seat { let (seat, _) = Seat::new(display, name, None); let userdata = seat.user_data(); userdata.insert_if_missing(|| Devices::new()); + userdata.insert_if_missing(|| SupressedKeys::new()); userdata.insert_if_missing(|| RefCell::new(CursorImageStatus::Hidden)); - userdata.insert_if_missing(|| Vec::::new()); seat } @@ -137,6 +157,10 @@ impl State { _ => {} } } + #[cfg(feature = "debug")] + { + self.common.egui.state.handle_device_added(&device); + } } InputEvent::DeviceRemoved { device } => { for seat in &mut self.common.seats { @@ -157,6 +181,10 @@ impl State { break; } } + #[cfg(feature = "debug")] + { + self.common.egui.state.handle_device_added(&device); + } } InputEvent::Keyboard { event, .. } => { use smithay::backend::input::KeyboardKeyEvent; @@ -179,6 +207,37 @@ impl State { time, |modifiers, handle| { // here we can handle global shortcuts and the like + if userdata.get::().unwrap().filter(&handle) { + return FilterResult::Intercept(()); + } + + #[cfg(feature = "debug")] + { + self.common.egui.modifiers = modifiers.clone(); + if self.common.seats.iter().position(|x| x == seat).unwrap() + == 0 + && modifiers.logo + && handle.raw_syms().contains(&keysyms::KEY_Escape) + && state == KeyState::Pressed + { + self.common.egui.active = !self.common.egui.active; + userdata.get::().unwrap().add(&handle); + return FilterResult::Intercept(()); + } + if self.common.seats.iter().position(|x| x == seat).unwrap() + == 0 + && self.common.egui.active + && self.common.egui.state.wants_keyboard() + { + self.common.egui.state.handle_keyboard( + handle.raw_syms(), + state == KeyState::Pressed, + modifiers.clone(), + ); + return FilterResult::Intercept(()); + } + } + let _ = (modifiers, handle); FilterResult::Forward }, @@ -233,6 +292,13 @@ impl State { .unwrap() .motion(position, under, serial, event.time()); + #[cfg(feature = "debug")] + if self.common.seats.iter().position(|x| x == seat).unwrap() == 0 { + self.common + .egui + .state + .handle_pointer_motion(position.to_i32_round()); + } break; } } @@ -256,6 +322,14 @@ impl State { seat.get_pointer() .unwrap() .motion(position, under, serial, event.time()); + + #[cfg(feature = "debug")] + if self.common.seats.iter().position(|x| x == seat).unwrap() == 0 { + self.common + .egui + .state + .handle_pointer_motion(position.to_i32_round()); + } break; } } @@ -271,6 +345,21 @@ impl State { let userdata = seat.user_data(); let devices = userdata.get::().unwrap(); if devices.has_device(&device) { + #[cfg(feature = "debug")] + if self.common.seats.iter().position(|x| x == seat).unwrap() == 0 + && self.common.egui.active + && self.common.egui.state.wants_pointer() + { + if let Some(button) = event.button() { + self.common.egui.state.handle_pointer_button( + button, + event.state() == ButtonState::Pressed, + self.common.egui.modifiers.clone(), + ); + } + break; + } + let serial = SERIAL_COUNTER.next_serial(); let button = event.button_code(); let state = match event.state() { @@ -340,6 +429,24 @@ impl State { let device = event.device(); for seat in self.common.seats.clone().iter() { + #[cfg(feature = "debug")] + if self.common.seats.iter().position(|x| x == seat).unwrap() == 0 + && self.common.egui.active + && self.common.egui.state.wants_pointer() + { + self.common.egui.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::().unwrap(); if devices.has_device(&device) { diff --git a/src/main.rs b/src/main.rs index 158dfe1a..7b47fd17 100644 --- a/src/main.rs +++ b/src/main.rs @@ -67,7 +67,7 @@ fn init_logger() -> Result { slog_stdlog::init().unwrap(); slog_scope::info!("Version: {}", std::env!("CARGO_PKG_VERSION")); - if cfg!(debug_assertions) { + if cfg!(feature = "debug") { slog_scope::debug!( "Debug build ({})", std::option_env!("GIT_HASH").unwrap_or("Unknown") diff --git a/src/state.rs b/src/state.rs index 9af50cc1..46370bf0 100644 --- a/src/state.rs +++ b/src/state.rs @@ -33,6 +33,17 @@ pub struct Common { pub start_time: Instant, pub should_stop: bool, + + #[cfg(feature = "debug")] + pub egui: Egui, +} + +#[cfg(feature = "debug")] +pub struct Egui { + pub state: smithay_egui::EguiState, + pub modifiers: smithay::wayland::seat::ModifiersState, + pub active: bool, + pub alpha: f32, } pub enum BackendData { @@ -78,6 +89,14 @@ impl State { start_time: Instant::now(), should_stop: false, + + #[cfg(feature = "debug")] + egui: Egui { + state: smithay_egui::EguiState::new(), + modifiers: Default::default(), + active: false, + alpha: 1.0, + }, }, backend: BackendData::Unset, }