chore: manual clippy

This commit is contained in:
Vukašin Vojinović 2025-10-16 15:46:54 +02:00 committed by Victoria Brekenfeld
parent 0847247c33
commit 5e9ea93819
20 changed files with 253 additions and 291 deletions

View file

@ -108,7 +108,9 @@ impl ResizeSurfaceGrab {
+ self.initial_window_location.x;
}
} else if (self.initial_window_location.x + self.initial_window_size.w + dx as i32
- output_geom.loc.x - output_geom.size.w).unsigned_abs()
- output_geom.loc.x
- output_geom.size.w)
.unsigned_abs()
< self.edge_snap_threshold
{
new_window_width =
@ -134,7 +136,9 @@ impl ResizeSurfaceGrab {
+ self.initial_window_location.y;
}
} else if (self.initial_window_location.y + self.initial_window_size.h + dy as i32
- output_geom.loc.y - output_geom.size.h).unsigned_abs()
- output_geom.loc.y
- output_geom.size.h)
.unsigned_abs()
< self.edge_snap_threshold
{
new_window_height =
@ -146,8 +150,8 @@ impl ResizeSurfaceGrab {
let min_width = min_size.map(|s| s.w).unwrap_or(360);
let min_height = min_size.map(|s| s.h).unwrap_or(240);
let max_width = max_size.map(|s| s.w).unwrap_or(i32::max_value());
let max_height = max_size.map(|s| s.h).unwrap_or(i32::max_value());
let max_width = max_size.map(|s| s.w).unwrap_or(i32::MAX);
let max_height = max_size.map(|s| s.h).unwrap_or(i32::MAX);
new_window_width = new_window_width.max(min_width).min(max_width);
new_window_height = new_window_height.max(min_height).min(max_height);
@ -353,7 +357,9 @@ impl TouchGrab<State> for ResizeSurfaceGrab {
event: &TouchMotionEvent,
seq: Serial,
) {
if event.slot == <Self as TouchGrab<State>>::start_data(self).slot && self.update_location(event.location.as_global()) {
if event.slot == <Self as TouchGrab<State>>::start_data(self).slot
&& self.update_location(event.location.as_global())
{
handle.unset_grab(self, data);
}

View file

@ -650,10 +650,7 @@ impl FloatingLayout {
window: &CosmicMapped,
to: Option<Rectangle<i32, Local>>,
) -> Option<Rectangle<i32, Local>> {
let Some(mut mapped_geometry) = self.space.element_geometry(window).map(RectExt::as_local)
else {
return None;
};
let mut mapped_geometry = self.space.element_geometry(window).map(RectExt::as_local)?;
let _ = self.animations.remove(window);
if let Some(to) = to {
@ -673,7 +670,7 @@ impl FloatingLayout {
);
}
if let Some(_) = window.floating_tiled.lock().unwrap().take() {
if window.floating_tiled.lock().unwrap().take().is_some() {
if let Some(last_size) = window.last_geometry.lock().unwrap().map(|geo| geo.size) {
let geometry = Rectangle::new(mapped_geometry.loc, last_size);
window.set_tiled(false);
@ -972,8 +969,8 @@ impl FloatingLayout {
let (min_size, max_size) = (mapped.min_size(), mapped.max_size());
let min_width = min_size.map(|s| s.w).unwrap_or(360);
let min_height = min_size.map(|s| s.h).unwrap_or(240);
let max_width = max_size.map(|s| s.w).unwrap_or(i32::max_value());
let max_height = max_size.map(|s| s.h).unwrap_or(i32::max_value());
let max_width = max_size.map(|s| s.w).unwrap_or(i32::MAX);
let max_height = max_size.map(|s| s.h).unwrap_or(i32::MAX);
geo.size.w = min_width.max(geo.size.w).min(max_width);
geo.size.h = min_height.max(geo.size.h).min(max_height);
@ -1313,29 +1310,26 @@ impl FloatingLayout {
let window_geometry = if mapped.is_maximized(false) {
geometry
} else {
prev
.map(|mut rect| {
if let Some(old_size) = old_output_size {
rect = Rectangle::new(
Point::new(
(rect.loc.x as f64 + rect.size.w as f64 / 2.)
/ old_size.w as f64
* output_size.w as f64
- rect.size.w as f64 / 2.,
(rect.loc.y as f64 + rect.size.h as f64 / 2.)
/ old_size.h as f64
* output_size.h as f64
- rect.size.h as f64 / 2.,
),
rect.size.to_f64(),
)
.to_i32_round();
}
Rectangle::new(rect.loc.constrain(geometry), rect.size)
})
.unwrap_or_else(|| {
Rectangle::new(Point::from((0, 0)), mapped.geometry().size.as_local())
})
prev.map(|mut rect| {
if let Some(old_size) = old_output_size {
rect = Rectangle::new(
Point::new(
(rect.loc.x as f64 + rect.size.w as f64 / 2.) / old_size.w as f64
* output_size.w as f64
- rect.size.w as f64 / 2.,
(rect.loc.y as f64 + rect.size.h as f64 / 2.) / old_size.h as f64
* output_size.h as f64
- rect.size.h as f64 / 2.,
),
rect.size.to_f64(),
)
.to_i32_round();
}
Rectangle::new(rect.loc.constrain(geometry), rect.size)
})
.unwrap_or_else(|| {
Rectangle::new(Point::from((0, 0)), mapped.geometry().size.as_local())
})
};
mapped.set_geometry(window_geometry.to_global(&output));
@ -1529,7 +1523,7 @@ impl FloatingLayout {
.to_physical_precise_round(output_scale),
scale,
);
RelocateRenderElement::from_element(
rescaled,
(geometry.loc - original_geo.loc)
@ -1549,7 +1543,7 @@ impl FloatingLayout {
.to_physical_precise_round(output_scale),
scale,
);
RelocateRenderElement::from_element(
rescaled,
(geometry.loc - original_geo.loc)