view: Rediscover output in view_adjust_for_layout_change()

This commit is contained in:
John Lindgren 2023-02-20 12:53:00 -05:00
parent d83e99ff66
commit f018ca708d

View file

@ -740,21 +740,28 @@ void
view_adjust_for_layout_change(struct view *view)
{
assert(view);
if (view->fullscreen) {
if (output_is_usable(view->output)) {
/* recompute fullscreen geometry */
view_apply_fullscreen_geometry(view);
} else {
/* output is gone, exit fullscreen */
view_set_fullscreen(view, false, NULL);
/* Exit fullscreen if output is lost */
bool was_fullscreen = view->fullscreen;
if (was_fullscreen && !output_is_usable(view->output)) {
set_fullscreen(view, false);
}
} else if (!view_apply_special_geometry(view)) {
/* Rediscover nearest output as it may have changed */
view_discover_output(view);
if (!view_apply_special_geometry(view)) {
if (was_fullscreen) {
view_apply_natural_geometry(view);
} else {
/* reposition view if it's offscreen */
if (!wlr_output_layout_intersects(view->server->output_layout,
if (!wlr_output_layout_intersects(
view->server->output_layout,
NULL, &view->pending)) {
view_center(view, NULL, NULL);
}
}
}
if (view->toplevel.handle) {
foreign_toplevel_update_outputs(view);
}