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

@ -98,8 +98,7 @@ where
renderer.wait(&sync)?;
let format = get_transparent(format).unwrap_or(format);
let mapping = renderer
.copy_framebuffer(Rectangle::from_loc_and_size((0, 0), buffer_size), format)?;
let mapping = renderer.copy_framebuffer(Rectangle::from_size(buffer_size), format)?;
let gl_data = renderer.map_texture(&mapping)?;
assert!((width * height * pixelsize) as usize <= gl_data.len());
@ -496,7 +495,7 @@ pub fn render_window_to_buffer(
Transform::Normal,
&geometry.size.to_buffer(1, Transform::Normal),
);
logical_rect.intersection(Rectangle::from_loc_and_size((0, 0), geometry.size))
logical_rect.intersection(Rectangle::from_size(geometry.size))
})
.map(DamageElement::new)
.map(Into::<WindowCaptureElement<R>>::into),
@ -733,7 +732,7 @@ pub fn render_cursor_to_buffer(
.into_iter()
.filter_map(|rect| {
let logical_rect = rect.to_logical(1, Transform::Normal, &Size::from((64, 64)));
logical_rect.intersection(Rectangle::from_loc_and_size((0, 0), (64, 64)))
logical_rect.intersection(Rectangle::from_size((64, 64).into()))
})
.map(DamageElement::new)
.map(Into::<WindowCaptureElement<R>>::into),

View file

@ -271,7 +271,7 @@ pub fn minimize_rectangle(output: &Output, window: &CosmicSurface) -> Rectangle<
let map = layer_map_for_output(output);
let layer = map.layer_for_surface(&surface, WindowSurfaceType::ALL);
layer.and_then(|s| map.layer_geometry(s)).map(|local| {
Rectangle::from_loc_and_size(
Rectangle::new(
Point::from((local.loc.x + relative.loc.x, local.loc.y + relative.loc.y)),
relative.size,
)
@ -279,7 +279,7 @@ pub fn minimize_rectangle(output: &Output, window: &CosmicSurface) -> Rectangle<
})
.unwrap_or_else(|| {
let output_size = output.geometry().size;
Rectangle::from_loc_and_size(
Rectangle::new(
Point::from((
(output_size.w / 2) - 100,
output_size.h - (output_size.h / 3) - 50,

View file

@ -166,7 +166,7 @@ fn unconstrain_layer_popup(surface: &PopupSurface, output: &Output, layer_surfac
let layer_geo = map.layer_geometry(layer_surface).unwrap();
// the output_rect represented relative to the parents coordinate system
let mut relative = Rectangle::from_loc_and_size((0, 0), output.geometry().size).as_logical();
let mut relative = Rectangle::from_size(output.geometry().size).as_logical();
relative.loc -= layer_geo.loc;
let toplevel_offset = get_popup_toplevel_coords(surface);
let mut geometry = surface.with_pending_state(|state| state.positioner.get_geometry());

View file

@ -124,7 +124,7 @@ impl OverlapNotifyState {
if let Some(window_geo) = window.global_geometry() {
if let Some(intersection) = layer_geo.intersection(window_geo) {
// relative to layer location
let region = Rectangle::from_loc_and_size(
let region = Rectangle::new(
intersection.loc - layer_geo.loc,
intersection.size,
)
@ -145,7 +145,7 @@ impl OverlapNotifyState {
.to_global(&output);
if let Some(intersection) = layer_geo.intersection(other_geo) {
// relative to layer location
let region = Rectangle::from_loc_and_size(
let region = Rectangle::new(
intersection.loc - layer_geo.loc,
intersection.size,
)

View file

@ -870,7 +870,7 @@ where
inner
.damage
.push(Rectangle::from_loc_and_size((x, y), (width, height)));
.push(Rectangle::new((x, y).into(), (width, height).into()));
}
zcosmic_screencopy_frame_v2::Request::Capture => {
let mut inner = data.inner.lock().unwrap();

View file

@ -244,7 +244,7 @@ where
} else {
toplevel_state.rectangles.push((
surface.downgrade(),
Rectangle::from_loc_and_size((x, y), (width, height)),
Rectangle::new((x, y).into(), (width, height).into()),
));
}
}