chore: clippy

This commit is contained in:
Vukašin Vojinović 2026-02-23 16:25:06 +01:00 committed by Victoria Brekenfeld
parent c13e52da04
commit 2ca99c670a
59 changed files with 1974 additions and 2137 deletions

View file

@ -237,22 +237,22 @@ impl ImageCopyCaptureHandler for State {
}
ImageCaptureSourceKind::Toplevel(mut toplevel) => {
let shell = self.common.shell.read();
if let Some(element) = shell.element_for_surface(&toplevel) {
if element.has_active_window(&toplevel) {
if let Some(workspace) = shell.space_for(element) {
if let Some(geometry) = workspace.element_geometry(element) {
let mut surface_geo = element.active_window_geometry().as_local();
surface_geo.loc += geometry.loc;
let global_geo = surface_geo.to_global(workspace.output());
if global_geo.contains(pointer_loc) {
let buffer_pos = (pointer_loc - global_geo.loc)
.as_logical()
.to_buffer(1, Transform::Normal, &toplevel.geometry().size);
session.set_cursor_hotspot(hotspot);
session.set_cursor_pos(Some(buffer_pos));
}
}
}
if let Some(element) = shell.element_for_surface(&toplevel)
&& element.has_active_window(&toplevel)
&& let Some(workspace) = shell.space_for(element)
&& let Some(geometry) = workspace.element_geometry(element)
{
let mut surface_geo = element.active_window_geometry().as_local();
surface_geo.loc += geometry.loc;
let global_geo = surface_geo.to_global(workspace.output());
if global_geo.contains(pointer_loc) {
let buffer_pos = (pointer_loc - global_geo.loc).as_logical().to_buffer(
1,
Transform::Normal,
&toplevel.geometry().size,
);
session.set_cursor_hotspot(hotspot);
session.set_cursor_pos(Some(buffer_pos));
}
}

View file

@ -577,18 +577,16 @@ pub fn render_window_to_buffer(
let pointer = seat.get_pointer().unwrap();
let pointer_loc = pointer.current_location().to_i32_round().as_global();
let mut location = None;
if let Some(element) = shell.element_for_surface(toplevel) {
if element.has_active_window(toplevel) {
if let Some(workspace) = shell.space_for(element) {
if let Some(geometry) = workspace.element_geometry(element) {
let mut surface_geo = element.active_window_geometry().as_local();
surface_geo.loc += geometry.loc;
let global_geo = surface_geo.to_global(workspace.output());
if global_geo.contains(pointer_loc) {
location = Some((pointer_loc - global_geo.loc).as_logical().to_f64());
}
}
}
if let Some(element) = shell.element_for_surface(toplevel)
&& element.has_active_window(toplevel)
&& let Some(workspace) = shell.space_for(element)
&& let Some(geometry) = workspace.element_geometry(element)
{
let mut surface_geo = element.active_window_geometry().as_local();
surface_geo.loc += geometry.loc;
let global_geo = surface_geo.to_global(workspace.output());
if global_geo.contains(pointer_loc) {
location = Some((pointer_loc - global_geo.loc).as_logical().to_f64());
}
};
std::mem::drop(shell);
@ -620,19 +618,17 @@ pub fn render_window_to_buffer(
// TODO cosmic-workspaces wants to omit, but metadata cursor capture in portal should
// still include dnd surface in window capture buffer?
if draw_cursor {
if let Some(dnd_icon) = get_dnd_icon(&seat) {
elements.extend(
cursor::draw_dnd_icon(
renderer,
&dnd_icon.surface,
(location + dnd_icon.offset.to_f64()).to_i32_round(),
1.0,
)
.into_iter()
.map(WindowCaptureElement::from),
);
}
if draw_cursor && let Some(dnd_icon) = get_dnd_icon(&seat) {
elements.extend(
cursor::draw_dnd_icon(
renderer,
&dnd_icon.surface,
(location + dnd_icon.offset.to_f64()).to_i32_round(),
1.0,
)
.into_iter()
.map(WindowCaptureElement::from),
);
}
}