diff --git a/src/view-impl-common.c b/src/view-impl-common.c index df72fe62..efc749bf 100644 --- a/src/view-impl-common.c +++ b/src/view-impl-common.c @@ -1,8 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-only /* view-impl-common.c: common code for shell view->impl functions */ #include "view-impl-common.h" +#include "config/rcxml.h" #include "foreign-toplevel/foreign.h" #include "labwc.h" +#include "output.h" +#include "output-state.h" #include "view.h" #include "window-rules.h" @@ -52,6 +55,21 @@ view_impl_unmap(struct view *view) if (view == server->active_view || !server->active_view) { desktop_focus_topmost_view(server); } + + desktop_update_top_layer_visibility(view->server); + + /* + * We may need to disable adaptive sync if view was fullscreen. + * + * FIXME: this logic doesn't account for multiple fullscreen + * views. It should probably be combined with the existing + * logic in desktop_update_top_layer_visibility(). + */ + if (view->fullscreen && rc.adaptive_sync == LAB_ADAPTIVE_SYNC_FULLSCREEN + && output_is_usable(view->output)) { + output_enable_adaptive_sync(view->output, false); + output_state_commit(view->output); + } } static bool diff --git a/src/view.c b/src/view.c index 87ef8566..5dac1f94 100644 --- a/src/view.c +++ b/src/view.c @@ -2626,20 +2626,6 @@ view_destroy(struct view *view) undecorate(view); view_set_icon(view, NULL, NULL); - - /* - * The layer-shell top-layer is disabled when an application is running - * in fullscreen mode, so if that's the case, we may have to re-enable - * it here. - */ - if (view->fullscreen && view->output) { - view->fullscreen = false; - desktop_update_top_layer_visibility(server); - if (rc.adaptive_sync == LAB_ADAPTIVE_SYNC_FULLSCREEN) { - set_adaptive_sync_fullscreen(view); - } - } - menu_on_view_destroy(view); /*