From 7e74d8db0b3580fe3b1a9b549a56db5d6bb52dce Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Fri, 20 Oct 2023 15:22:03 -0700 Subject: [PATCH] Fix build with `debug` feature --- src/backend/render/mod.rs | 7 ++++--- src/debug.rs | 10 ++++++---- src/input/mod.rs | 26 ++++++++------------------ 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/backend/render/mod.rs b/src/backend/render/mod.rs index 569d1f9e..82dfa82c 100644 --- a/src/backend/render/mod.rs +++ b/src/backend/render/mod.rs @@ -447,7 +447,6 @@ where #[cfg(feature = "debug")] puffin::profile_function!(); - let theme = state.theme.cosmic(); let mut elements = cursor_elements(renderer, state, output, cursor_mode); #[cfg(feature = "debug")] @@ -472,11 +471,11 @@ where elements.push(fps_overlay.into()); } - if state.shell.outputs.first() == Some(output) { + if state.shell.outputs().next() == Some(output) { if let Some(profiler_overlay) = profiler_ui( state, renderer.glow_renderer_mut(), - Rectangle::from_loc_and_size((0, 0), output_geo.size), + Rectangle::from_loc_and_size((0, 0), output_geo.size).as_logical(), scale, ) .map_err(::Error::from) @@ -497,6 +496,8 @@ where return Ok(elements); } + let theme = state.theme.cosmic(); + let overview = state.shell.overview_mode(); let (resize_mode, resize_indicator) = state.shell.resize_mode(); let resize_indicator = resize_indicator.map(|indicator| (resize_mode, indicator)); diff --git a/src/debug.rs b/src/debug.rs index 2ff571d0..c4b3f94b 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -327,17 +327,18 @@ fn format_pointer_focus(focus: Option) -> String { }, Some(Fullscreen(x)) => format!( "Fullscreen {} ({})", - match x.surface() { + match &x { CosmicSurface::Wayland(w) => w.toplevel().wl_surface().id().protocol_id(), CosmicSurface::X11(x) => x.window_id(), _ => unreachable!(), }, - x.surface().title() + x.title() ), Some(LayerSurface(x)) => format!("LayerSurface {}", x.wl_surface().id().protocol_id()), Some(Popup(x)) => format!("Popup {}", x.wl_surface().id().protocol_id()), Some(OverrideRedirect(x)) => format!("Override Redirect {}", x.window_id()), Some(PointerFocusTarget::ResizeFork(x)) => format!("Resize Fork {:?}", x.node), + Some(LockSurface(x)) => format!("LockSurface {}", x.wl_surface().id().protocol_id()), None => format!("None"), } } @@ -369,16 +370,17 @@ fn format_keyboard_focus(focus: Option) -> String { }, Some(Fullscreen(x)) => format!( "Fullscreen {} ({})", - match x.surface() { + match &x { CosmicSurface::Wayland(w) => w.toplevel().wl_surface().id().protocol_id(), CosmicSurface::X11(x) => x.window_id(), _ => unreachable!(), }, - x.surface().title() + x.title() ), Some(LayerSurface(x)) => format!("LayerSurface {}", x.wl_surface().id().protocol_id()), Some(Popup(x)) => format!("Popup {}", x.wl_surface().id().protocol_id()), Some(Group(_)) => format!("Window Group"), + Some(LockSurface(x)) => format!("LockSurface {}", x.wl_surface().id().protocol_id()), None => format!("None"), } } diff --git a/src/input/mod.rs b/src/input/mod.rs index 15ea9edb..1a8aea65 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -748,15 +748,10 @@ impl State { } #[cfg(feature = "debug")] if self.common.seats().position(|x| x == &seat).unwrap() == 0 { - let location = if let Some(output) = self.common.shell.outputs.first() { - self.common - .shell - .map_global_to_space(position, output) - .to_i32_round() - } else { - position.to_i32_round() - }; - self.common.egui.state.handle_pointer_motion(location); + if let Some(output) = self.common.shell.outputs().next() { + let location = position.to_local(&output).to_i32_round().as_logical(); + self.common.egui.state.handle_pointer_motion(location); + } } } } @@ -808,15 +803,10 @@ impl State { ptr.frame(self); #[cfg(feature = "debug")] if self.common.seats().position(|x| x == &seat).unwrap() == 0 { - let location = if let Some(output) = self.common.shell.outputs.first() { - self.common - .shell - .map_global_to_space(position, output) - .to_i32_round() - } else { - position.to_i32_round() - }; - self.common.egui.state.handle_pointer_motion(location); + if let Some(output) = self.common.shell.outputs().next() { + let location = position.to_local(&output).to_i32_round().as_logical(); + self.common.egui.state.handle_pointer_motion(location); + } } } }