view: restore initially-maximized window position after unplug/plug

`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.
This commit is contained in:
tokyo4j 2025-09-01 17:52:06 +09:00
parent 7e70c9f75b
commit 909652feb5

View file

@ -1810,8 +1810,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);
}
}