Revert "view: let view_set_fallback_natural_geometry() return wlr_box"

The newly introduced view_get_fallback_natural_geometry() returned a default
position of (0,0) if the view had no usable output. This is undesirable; we
should leave the existing (x,y) position unchanged in that case.

This reverts commit e6b5d91b63.
This commit is contained in:
John Lindgren 2026-01-04 12:46:12 -05:00
parent ab8f186ea4
commit 25be8b3757
3 changed files with 11 additions and 11 deletions

View file

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

View file

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

View file

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