diff --git a/Cargo.lock b/Cargo.lock index 327a4709..5aa14f91 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1050,6 +1050,7 @@ checksum = "53eafabcce0cb2325a59a98736efe0bf060585b437763f8c476957fb274bb974" dependencies = [ "accesskit", "ahash", + "backtrace", "emath", "epaint", "log", diff --git a/crates/notedeck_chrome/Cargo.toml b/crates/notedeck_chrome/Cargo.toml index ff2c05fb..39882b98 100644 --- a/crates/notedeck_chrome/Cargo.toml +++ b/crates/notedeck_chrome/Cargo.toml @@ -42,6 +42,8 @@ path = "src/preview.rs" [features] default = [] profiling = ["notedeck_columns/puffin", "puffin", "puffin_egui"] +debug-widget-callstack = ["egui/callstack"] +debug-interactive-widgets = [] [target.'cfg(target_os = "android")'.dependencies] android_logger = "0.11.1" diff --git a/crates/notedeck_chrome/src/theme.rs b/crates/notedeck_chrome/src/theme.rs index c20da79b..1ec31309 100644 --- a/crates/notedeck_chrome/src/theme.rs +++ b/crates/notedeck_chrome/src/theme.rs @@ -124,9 +124,26 @@ pub fn add_custom_style(is_mobile: bool, style: &mut Style) { ..Interaction::default() }; - #[cfg(debug_assertions)] + // debug: show callstack for the current widget on hover if all + // modifier keys are pressed down. + #[cfg(feature = "debug-widget-callstack")] { - style.debug.show_interactive_widgets = true; + #[cfg(not(debug_assertions))] + compile_error!( + "The `debug-widget-callstack` feature requires a debug build, \ + release builds are unsupported." + ); style.debug.debug_on_hover_with_all_modifiers = true; } + + // debug: show an overlay on all interactive widgets + #[cfg(feature = "debug-interactive-widgets")] + { + #[cfg(not(debug_assertions))] + compile_error!( + "The `debug-interactive-widgets` feature requires a debug build, \ + release builds are unsupported." + ); + style.debug.show_interactive_widgets = true; + } }