Skip to content

Commit

Permalink
Use Rectangle::new/::from_size instead of constructing struct
Browse files Browse the repository at this point in the history
  • Loading branch information
ids1024 committed Dec 27, 2024
1 parent 1bfb64e commit 771ba0b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
6 changes: 1 addition & 5 deletions src/desktop/wayland/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ impl RendererSurfaceState {
Some(size) => size,
};

let rect = Rectangle {
loc: (0, 0).into(),
size,
}
.to_f64();
let rect = Rectangle::from_size(size).to_f64();

// The input region is always within the surface itself, so if the surface itself doesn't contain the
// point we can return false.
Expand Down
5 changes: 1 addition & 4 deletions src/wayland/shell/xdg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,10 +619,7 @@ impl PositionerState {
// example if the anchor of the anchor rectangle is at (x, y), the surface
// has the gravity bottom|right, and the offset is (ox, oy), the calculated
// surface position will be (x + ox, y + oy)
let mut geometry = Rectangle {
loc: self.offset,
size: self.rect_size,
};
let mut geometry = Rectangle::new(self.offset, self.rect_size);

// Defines the anchor point for the anchor rectangle. The specified anchor
// is used derive an anchor point that the child surface will be
Expand Down

0 comments on commit 771ba0b

Please sign in to comment.