aboutsummaryrefslogtreecommitdiff
path: root/src/layout/monitor.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2025-01-04 10:14:51 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-01-04 11:22:56 +0300
commita2f9d132a088e399fb1f292d84d3d3862127f02e (patch)
tree0e04941d8ae35be9362c53f8d41177cc71e24214 /src/layout/monitor.rs
parent1973b97cc2a51d697add3d9ad7210a4e6eba9183 (diff)
downloadniri-a2f9d132a088e399fb1f292d84d3d3862127f02e.tar.gz
niri-a2f9d132a088e399fb1f292d84d3d3862127f02e.tar.bz2
niri-a2f9d132a088e399fb1f292d84d3d3862127f02e.zip
Migrate to new Rectangle functions
Diffstat (limited to 'src/layout/monitor.rs')
-rw-r--r--src/layout/monitor.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs
index 13079319..2de3c760 100644
--- a/src/layout/monitor.rs
+++ b/src/layout/monitor.rs
@@ -7,7 +7,7 @@ use smithay::backend::renderer::element::utils::{
CropRenderElement, Relocate, RelocateRenderElement,
};
use smithay::output::Output;
-use smithay::utils::{Logical, Point, Rectangle};
+use smithay::utils::{Logical, Point, Rectangle, Size};
use super::scrolling::{Column, ColumnWidth};
use super::tile::Tile;
@@ -871,7 +871,7 @@ impl<W: LayoutElement> Monitor<W> {
let offset = switch.target_idx() - self.active_workspace_idx as f64;
let offset = offset * size.h;
- let clip_rect = Rectangle::from_loc_and_size((0., -offset), size);
+ let clip_rect = Rectangle::new(Point::from((0., -offset)), size);
rect = rect.intersection(clip_rect)?;
}
@@ -930,7 +930,7 @@ impl<W: LayoutElement> Monitor<W> {
let size = output_size(&self.output);
let (ws, bounds) = self
.workspaces_with_render_positions()
- .map(|(ws, offset)| (ws, Rectangle::from_loc_and_size(offset, size)))
+ .map(|(ws, offset)| (ws, Rectangle::new(offset, size)))
.find(|(_, bounds)| bounds.contains(pos_within_output))?;
Some((ws, bounds.loc))
}
@@ -983,9 +983,15 @@ impl<W: LayoutElement> Monitor<W> {
//
// FIXME: use proper bounds after fixing the Crop element.
let crop_bounds = if self.workspace_switch.is_some() {
- Rectangle::from_loc_and_size((-i32::MAX / 2, 0), (i32::MAX, height))
+ Rectangle::new(
+ Point::from((-i32::MAX / 2, 0)),
+ Size::from((i32::MAX, height)),
+ )
} else {
- Rectangle::from_loc_and_size((-i32::MAX / 2, -i32::MAX / 2), (i32::MAX, i32::MAX))
+ Rectangle::new(
+ Point::from((-i32::MAX / 2, -i32::MAX / 2)),
+ Size::from((i32::MAX, i32::MAX)),
+ )
};
self.workspaces_with_render_positions()