diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-01-04 10:14:51 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-01-04 11:22:56 +0300 |
| commit | a2f9d132a088e399fb1f292d84d3d3862127f02e (patch) | |
| tree | 0e04941d8ae35be9362c53f8d41177cc71e24214 /src/layout/mod.rs | |
| parent | 1973b97cc2a51d697add3d9ad7210a4e6eba9183 (diff) | |
| download | niri-a2f9d132a088e399fb1f292d84d3d3862127f02e.tar.gz niri-a2f9d132a088e399fb1f292d84d3d3862127f02e.tar.bz2 niri-a2f9d132a088e399fb1f292d84d3d3862127f02e.zip | |
Migrate to new Rectangle functions
Diffstat (limited to 'src/layout/mod.rs')
| -rw-r--r-- | src/layout/mod.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 081a5f35..4923282b 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -1289,7 +1289,7 @@ impl<W: LayoutElement> Layout<W> { // window geometry. let width = move_.tile.window_size().w; let height = output_size(&move_.output).h; - let mut target = Rectangle::from_loc_and_size((0., 0.), (width, height)); + let mut target = Rectangle::from_size(Size::from((width, height))); // FIXME: ideally this shouldn't include the tile render offset, but the code // duplication would be a bit annoying for this edge case. target.loc.y -= move_.tile_render_location().y; @@ -2405,10 +2405,8 @@ impl<W: LayoutElement> Layout<W> { if let Some(InteractiveMoveState::Moving(move_)) = &mut self.interactive_move { if output.map_or(true, |output| move_.output == *output) { let pos_within_output = move_.tile_render_location(); - let view_rect = Rectangle::from_loc_and_size( - pos_within_output.upscale(-1.), - output_size(&move_.output), - ); + let view_rect = + Rectangle::new(pos_within_output.upscale(-1.), output_size(&move_.output)); move_.tile.update(true, view_rect); } } @@ -4121,7 +4119,7 @@ mod tests { id, parent_id: None, is_floating: false, - bbox: Rectangle::from_loc_and_size((0, 0), (100, 200)), + bbox: Rectangle::from_size(Size::from((100, 200))), min_max_size: Default::default(), } } @@ -4295,7 +4293,7 @@ mod tests { any::<(i16, i16, u16, u16)>().prop_map(|(x, y, w, h)| { let loc: Point<i32, _> = Point::from((x.into(), y.into())); let size: Size<i32, _> = Size::from((w.max(1).into(), h.max(1).into())); - Rectangle::from_loc_and_size(loc, size) + Rectangle::new(loc, size) }) } @@ -6078,7 +6076,7 @@ mod tests { Op::AddWindow { params: TestWindowParams { - bbox: Rectangle::from_loc_and_size((0, 0), (1280, 200)), + bbox: Rectangle::from_size(Size::from((1280, 200))), ..TestWindowParams::new(1) }, } |
