]> git.mdlowis.com Git - proto/labwc.git/commitdiff
view: let `view_set_fallback_natural_geometry()` return wlr_box
authortokyo4j <hrak1529@gmail.com>
Mon, 1 Sep 2025 08:04:41 +0000 (17:04 +0900)
committerJohan Malm <johanmalm@users.noreply.github.com>
Mon, 1 Sep 2025 19:16:37 +0000 (20:16 +0100)
include/view.h
src/view.c
src/xwayland.c

index 9418101571f06a14524cd93589589f79cf1c4902..97fb2343b8db2591730e58021bca153c85ca6e96 100644 (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);
 
 /**
index 4173f64320169d329c61f0aa364404aa2d8beb98..f48169fa462bbd404c5e3b83bda017e1ae362083 100644 (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);
index 62c96831a7862e92dbabe07b820e9c547dfec6ba..0a39ffdcf6d6fef1114d37978f5ab0ec941cadd7 100644 (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);
        }
 }