Skip to content

Commit

Permalink
Fix build with debug feature
Browse files Browse the repository at this point in the history
  • Loading branch information
ids1024 committed Oct 31, 2023
1 parent 809eeaf commit 7e74d8d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 25 deletions.
7 changes: 4 additions & 3 deletions src/backend/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -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(<R as Renderer>::Error::from)
Expand All @@ -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));
Expand Down
10 changes: 6 additions & 4 deletions src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,17 +327,18 @@ fn format_pointer_focus(focus: Option<PointerFocusTarget>) -> 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"),
}
}
Expand Down Expand Up @@ -369,16 +370,17 @@ fn format_keyboard_focus(focus: Option<KeyboardFocusTarget>) -> 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"),
}
}
26 changes: 8 additions & 18 deletions src/input/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
Expand Down Expand Up @@ -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);
}
}
}
}
Expand Down

0 comments on commit 7e74d8d

Please sign in to comment.