diff --git a/include/view.h b/include/view.h index 94181015..97fb2343 100644 --- a/include/view.h +++ b/include/view.h @@ -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); /** diff --git a/src/view.c b/src/view.c index 4173f643..f48169fa 100644 --- a/src/view.c +++ b/src/view.c @@ -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); diff --git a/src/xwayland.c b/src/xwayland.c index 62c96831..0a39ffdc 100644 --- a/src/xwayland.c +++ b/src/xwayland.c @@ -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); } }