view: let view_set_fallback_natural_geometry() return wlr_box

This commit is contained in:
tokyo4j 2025-09-01 17:04:41 +09:00 committed by Johan Malm
parent 164b17c279
commit e6b5d91b63
3 changed files with 11 additions and 11 deletions

View file

@ -484,7 +484,7 @@ void view_moved(struct view *view);
void view_minimize(struct view *view, bool minimized);
bool view_compute_centered_position(struct view *view,
const struct wlr_box *ref, int w, int h, int *x, int *y);
void view_set_fallback_natural_geometry(struct view *view);
struct wlr_box view_get_fallback_natural_geometry(struct view *view);
void view_store_natural_geometry(struct view *view);
/**

View file

@ -953,16 +953,16 @@ adjust_floating_geometry(struct view *view, struct wlr_box *geometry,
&geometry->x, &geometry->y);
}
void
view_set_fallback_natural_geometry(struct view *view)
struct wlr_box
view_get_fallback_natural_geometry(struct view *view)
{
view->natural_geometry.width = VIEW_FALLBACK_WIDTH;
view->natural_geometry.height = VIEW_FALLBACK_HEIGHT;
struct wlr_box box = {
.width = VIEW_FALLBACK_WIDTH,
.height = VIEW_FALLBACK_HEIGHT,
};
view_compute_centered_position(view, NULL,
view->natural_geometry.width,
view->natural_geometry.height,
&view->natural_geometry.x,
&view->natural_geometry.y);
box.width, box.height, &box.x, &box.y);
return box;
}
void
@ -1502,7 +1502,7 @@ view_maximize(struct view *view, enum view_axis axis,
*/
if ((axis == VIEW_AXIS_HORIZONTAL || axis == VIEW_AXIS_VERTICAL)
&& wlr_box_empty(&view->natural_geometry)) {
view_set_fallback_natural_geometry(view);
view->natural_geometry = view_get_fallback_natural_geometry(view);
}
set_maximized(view, axis);

View file

@ -756,7 +756,7 @@ check_natural_geometry(struct view *view)
if (!view_is_floating(view)
&& (view->natural_geometry.width < LAB_MIN_VIEW_WIDTH
|| view->natural_geometry.height < LAB_MIN_VIEW_HEIGHT)) {
view_set_fallback_natural_geometry(view);
view->natural_geometry = view_get_fallback_natural_geometry(view);
}
}