From 25be8b3757440bf005c76ee1f97f8156ddcc1eca Mon Sep 17 00:00:00 2001 From: John Lindgren Date: Sun, 4 Jan 2026 12:46:12 -0500 Subject: [PATCH] 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 e6b5d91b638de9447a5e36fd11ee0d93abf5cda2. --- include/view.h | 2 +- src/view.c | 18 +++++++++--------- src/xwayland.c | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/view.h b/include/view.h index d2ff5ddf..dda8ed71 100644 --- a/include/view.h +++ b/include/view.h @@ -476,7 +476,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); -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); /** diff --git a/src/view.c b/src/view.c index 884b6d0a..a73102ef 100644 --- a/src/view.c +++ b/src/view.c @@ -894,16 +894,16 @@ adjust_floating_geometry(struct view *view, struct wlr_box *geometry, &geometry->x, &geometry->y); } -struct wlr_box -view_get_fallback_natural_geometry(struct view *view) +void +view_set_fallback_natural_geometry(struct view *view) { - struct wlr_box box = { - .width = VIEW_FALLBACK_WIDTH, - .height = VIEW_FALLBACK_HEIGHT, - }; + view->natural_geometry.width = VIEW_FALLBACK_WIDTH; + view->natural_geometry.height = VIEW_FALLBACK_HEIGHT; view_compute_centered_position(view, NULL, - box.width, box.height, &box.x, &box.y); - return box; + view->natural_geometry.width, + view->natural_geometry.height, + &view->natural_geometry.x, + &view->natural_geometry.y); } void @@ -1428,7 +1428,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->natural_geometry = view_get_fallback_natural_geometry(view); + view_set_fallback_natural_geometry(view); } view_set_maximized(view, axis); diff --git a/src/xwayland.c b/src/xwayland.c index 5984a31b..1f93fbc4 100644 --- a/src/xwayland.c +++ b/src/xwayland.c @@ -723,7 +723,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->natural_geometry = view_get_fallback_natural_geometry(view); + view_set_fallback_natural_geometry(view); } }