Migrate away from Rectangle::from_loc_and_size
Deprecated in `smithay` by https://github.com/Smithay/smithay/pull/1621.
This commit is contained in:
parent
9074447c4f
commit
b685512127
26 changed files with 184 additions and 201 deletions
|
|
@ -120,30 +120,33 @@ impl<C: Coordinate> SizeExt<C> for Size<C, Logical> {
|
|||
|
||||
impl<C: Coordinate> RectExt<C> for Rectangle<C, Logical> {
|
||||
fn as_global(self) -> Rectangle<C, Global> {
|
||||
Rectangle::from_loc_and_size(self.loc.as_global(), (self.size.w, self.size.h))
|
||||
Rectangle::new(self.loc.as_global(), (self.size.w, self.size.h).into())
|
||||
}
|
||||
|
||||
fn as_local(self) -> Rectangle<C, Local> {
|
||||
Rectangle::from_loc_and_size(self.loc.as_local(), (self.size.w, self.size.h))
|
||||
Rectangle::new(self.loc.as_local(), (self.size.w, self.size.h).into())
|
||||
}
|
||||
}
|
||||
|
||||
impl<C: Coordinate> RectGlobalExt<C> for Rectangle<C, Global> {
|
||||
fn to_local(self, output: &Output) -> Rectangle<C, Local> {
|
||||
Rectangle::from_loc_and_size(self.loc.to_local(output), (self.size.w, self.size.h))
|
||||
Rectangle::new(self.loc.to_local(output), (self.size.w, self.size.h).into())
|
||||
}
|
||||
|
||||
fn as_logical(self) -> Rectangle<C, Logical> {
|
||||
Rectangle::from_loc_and_size(self.loc.as_logical(), self.size.as_logical())
|
||||
Rectangle::new(self.loc.as_logical(), self.size.as_logical())
|
||||
}
|
||||
}
|
||||
|
||||
impl<C: Coordinate> RectLocalExt<C> for Rectangle<C, Local> {
|
||||
fn to_global(self, output: &Output) -> Rectangle<C, Global> {
|
||||
Rectangle::from_loc_and_size(self.loc.to_global(output), (self.size.w, self.size.h))
|
||||
Rectangle::new(
|
||||
self.loc.to_global(output),
|
||||
(self.size.w, self.size.h).into(),
|
||||
)
|
||||
}
|
||||
|
||||
fn as_logical(self) -> Rectangle<C, Logical> {
|
||||
Rectangle::from_loc_and_size(self.loc.as_logical(), self.size.as_logical())
|
||||
Rectangle::new(self.loc.as_logical(), self.size.as_logical())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -734,7 +734,7 @@ impl<P: Program + Send + 'static> IsAlive for IcedElement<P> {
|
|||
|
||||
impl<P: Program + Send + 'static> SpaceElement for IcedElement<P> {
|
||||
fn bbox(&self) -> Rectangle<i32, Logical> {
|
||||
Rectangle::from_loc_and_size((0, 0), self.0.lock().unwrap().size)
|
||||
Rectangle::from_size(self.0.lock().unwrap().size)
|
||||
}
|
||||
|
||||
fn is_in_input_region(&self, _point: &Point<f64, Logical>) -> bool {
|
||||
|
|
@ -928,9 +928,9 @@ where
|
|||
.map(|d| d * scale_x)
|
||||
.filter_map(|x| x.snap())
|
||||
.map(|damage_rect| {
|
||||
Rectangle::from_loc_and_size(
|
||||
(damage_rect.x as i32, damage_rect.y as i32),
|
||||
(damage_rect.width as i32, damage_rect.height as i32),
|
||||
Rectangle::new(
|
||||
(damage_rect.x as i32, damage_rect.y as i32).into(),
|
||||
(damage_rect.width as i32, damage_rect.height as i32).into(),
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
|
@ -948,8 +948,7 @@ where
|
|||
location.to_f64(),
|
||||
&buffer,
|
||||
Some(alpha),
|
||||
Some(Rectangle::from_loc_and_size(
|
||||
(0., 0.),
|
||||
Some(Rectangle::from_size(
|
||||
size.to_f64()
|
||||
.to_logical(1., Transform::Normal)
|
||||
.to_i32_round(),
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ struct Mirroring(Mutex<Option<WeakOutput>>);
|
|||
|
||||
impl OutputExt for Output {
|
||||
fn geometry(&self) -> Rectangle<i32, Global> {
|
||||
Rectangle::from_loc_and_size(self.current_location(), {
|
||||
Rectangle::new(self.current_location(), {
|
||||
Transform::from(self.current_transform())
|
||||
.transform_size(
|
||||
self.current_mode()
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ impl<N: Coordinate, Kind> CanTween for EaseSize<N, Kind> {
|
|||
|
||||
impl<N: Coordinate, Kind> CanTween for EaseRectangle<N, Kind> {
|
||||
fn ease(from: Self, to: Self, time: impl Float) -> Self {
|
||||
EaseRectangle(Rectangle::from_loc_and_size(
|
||||
EaseRectangle(Rectangle::new(
|
||||
CanTween::ease(EasePoint(from.0.loc), EasePoint(to.0.loc), time).unwrap(),
|
||||
CanTween::ease(EaseSize(from.0.size), EaseSize(to.0.size), time).unwrap(),
|
||||
))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue