Migrate away from Rectangle::from_loc_and_size

Deprecated in `smithay` by https://github.com/Smithay/smithay/pull/1621.
This commit is contained in:
Ian Douglas Scott 2024-12-26 18:18:35 -08:00 committed by Victoria Brekenfeld
parent 9074447c4f
commit b685512127
26 changed files with 184 additions and 201 deletions

View file

@ -249,7 +249,7 @@ impl Program for ContextMenu {
let output = seat.active_output();
let position = [
// to the right -> down
Rectangle::from_loc_and_size(
Rectangle::new(
position
+ Point::from((
bounds.width.ceil() as i32,
@ -258,7 +258,7 @@ impl Program for ContextMenu {
min_size.as_global(),
),
// to the right -> up
Rectangle::from_loc_and_size(
Rectangle::new(
position
+ Point::from((
bounds.width.ceil() as i32,
@ -268,12 +268,12 @@ impl Program for ContextMenu {
min_size.as_global(),
),
// to the left -> down
Rectangle::from_loc_and_size(
Rectangle::new(
position + Point::from((-min_size.w, bounds.y.ceil() as i32)),
min_size.as_global(),
),
// to the left -> up
Rectangle::from_loc_and_size(
Rectangle::new(
position
+ Point::from((
-min_size.w,
@ -669,16 +669,16 @@ impl MenuGrab {
let output = seat.active_output();
let position = [
Rectangle::from_loc_and_size(position, min_size.as_global()), // normal
Rectangle::from_loc_and_size(
Rectangle::new(position, min_size.as_global()), // normal
Rectangle::new(
position - Point::from((min_size.w, 0)),
min_size.as_global(),
), // flipped left
Rectangle::from_loc_and_size(
Rectangle::new(
position - Point::from((0, min_size.h)),
min_size.as_global(),
), // flipped up
Rectangle::from_loc_and_size(
Rectangle::new(
position - Point::from((min_size.w, min_size.h)),
min_size.as_global(),
), // flipped left & up

View file

@ -114,7 +114,7 @@ impl MoveGrabState {
CosmicMappedRenderElement::from(IndicatorShader::focus_element(
renderer,
Key::Window(Usage::MoveGrabIndicator, self.window.key()),
Rectangle::from_loc_and_size(
Rectangle::new(
render_location,
self.window
.geometry()
@ -350,15 +350,15 @@ impl MoveGrab {
fn update_location(&mut self, state: &mut State, location: Point<f64, Logical>) {
let mut shell = state.common.shell.write().unwrap();
let Some(current_output) =
shell
.outputs()
.find(|output| {
output.geometry().as_logical().overlaps_or_touches(
Rectangle::from_loc_and_size(location.to_i32_floor(), (0, 0)),
)
})
.cloned()
let Some(current_output) = shell
.outputs()
.find(|output| {
output
.geometry()
.as_logical()
.overlaps_or_touches(Rectangle::new(location.to_i32_floor(), (0, 0).into()))
})
.cloned()
else {
return;
};
@ -412,10 +412,7 @@ impl MoveGrab {
for output in &self.window_outputs {
element.output_enter(
output,
Rectangle::from_loc_and_size(
(0, 0),
output.geometry().size.as_logical(),
),
Rectangle::from_size(output.geometry().size.as_logical()),
);
}
(element, geo.loc.as_logical())
@ -778,7 +775,7 @@ impl Drop for MoveGrab {
match previous {
ManagedLayer::Sticky => {
grab_state.window.set_geometry(Rectangle::from_loc_and_size(
grab_state.window.set_geometry(Rectangle::new(
window_location,
grab_state.window.geometry().size.as_global(),
));
@ -800,7 +797,7 @@ impl Drop for MoveGrab {
Some((window, location.to_global(&output)))
}
_ => {
grab_state.window.set_geometry(Rectangle::from_loc_and_size(
grab_state.window.set_geometry(Rectangle::new(
window_location,
grab_state.window.geometry().size.as_global(),
));