]> git.mdlowis.com Git - proto/labwc.git/commitdiff
view: restore initially-maximized window position after unplug/plug
authortokyo4j <hrak1529@gmail.com>
Mon, 1 Sep 2025 08:52:06 +0000 (17:52 +0900)
committerJohan Malm <johanmalm@users.noreply.github.com>
Mon, 1 Sep 2025 19:16:37 +0000 (20:16 +0100)
`update_last_layout_geometry()` stores `view->natural_geometry` in
`view->last_layout_geometry`, but it's empty for initially-maximized
windows, so their positions were not restored after outputs are
unplugged and plugged (also when VT switching in wlroots 0.19.0).

This commit sets the fallback natural geometry (at the center of the
output) so that initially-maximized windows reappears in the same output.

src/view.c

index f48169fa462bbd404c5e3b83bda017e1ae362083..54eb60390ebf467121dfc5c445f7398688ce9253 100644 (file)
@@ -1806,8 +1806,12 @@ update_last_layout_geometry(struct view *view)
 
        if (view_is_floating(view)) {
                view->last_layout_geometry = view->pending;
-       } else {
+       } else if (!wlr_box_empty(&view->natural_geometry)) {
                view->last_layout_geometry = view->natural_geometry;
+       } else {
+               /* e.g. initially-maximized window */
+               view->last_layout_geometry =
+                       view_get_fallback_natural_geometry(view);
        }
 }