aboutsummaryrefslogtreecommitdiff
path: root/src/ui
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/ui
parent1973b97cc2a51d697add3d9ad7210a4e6eba9183 (diff)
downloadniri-a2f9d132a088e399fb1f292d84d3d3862127f02e.tar.gz
niri-a2f9d132a088e399fb1f292d84d3d3862127f02e.tar.bz2
niri-a2f9d132a088e399fb1f292d84d3d3862127f02e.zip
Migrate to new Rectangle functions
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/screenshot_ui.rs25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/ui/screenshot_ui.rs b/src/ui/screenshot_ui.rs
index f7d1bd1a..4f2dba3e 100644
--- a/src/ui/screenshot_ui.rs
+++ b/src/ui/screenshot_ui.rs
@@ -127,9 +127,9 @@ impl ScreenshotUi {
let size = output_transform.transform_size(output_mode.size);
(
output,
- Rectangle::from_loc_and_size(
- (size.w / 4, size.h / 4),
- (size.w / 2, size.h / 2),
+ Rectangle::new(
+ Point::from((size.w / 4, size.h / 4)),
+ Size::from((size.w / 2, size.h / 2)),
),
)
}
@@ -268,10 +268,10 @@ impl ScreenshotUi {
if output == selection_output {
// Check if the selection is still valid. If not, reset it back to default.
- if !Rectangle::from_loc_and_size((0, 0), size).contains_rect(rect) {
- rect = Rectangle::from_loc_and_size(
- (size.w / 4, size.h / 4),
- (size.w / 2, size.h / 2),
+ if !Rectangle::from_size(size).contains_rect(rect) {
+ rect = Rectangle::new(
+ Point::from((size.w / 4, size.h / 4)),
+ Size::from((size.w / 2, size.h / 2)),
);
*a = rect.loc;
*b = rect.loc + rect.size - Size::from((1, 1));
@@ -446,7 +446,7 @@ impl ScreenshotUi {
);
match res {
Ok((texture, _)) => {
- tex_rect = Some((texture, Rectangle::from_loc_and_size((0, 0), rect.size)));
+ tex_rect = Some((texture, Rectangle::from_size(rect.size)));
}
Err(err) => {
warn!("error compositing pointer onto screenshot: {err:?}");
@@ -556,9 +556,12 @@ impl ScreenshotUi {
let mut rect = rect_from_corner_points(*a, *b);
if rect.size.is_empty() || rect.size == Size::from((1, 1)) {
let data = &output_data[output];
- rect = Rectangle::from_loc_and_size((rect.loc.x - 16, rect.loc.y - 16), (32, 32))
- .intersection(Rectangle::from_loc_and_size((0, 0), data.size))
- .unwrap_or_default();
+ rect = Rectangle::new(
+ Point::from((rect.loc.x - 16, rect.loc.y - 16)),
+ Size::from((32, 32)),
+ )
+ .intersection(Rectangle::from_size(data.size))
+ .unwrap_or_default();
*a = rect.loc;
*b = rect.loc + rect.size - Size::from((1, 1));
}