From 6de18b9afde9349952ceb1226ccfaa02d56619a2 Mon Sep 17 00:00:00 2001 From: John Lindgren Date: Fri, 7 Nov 2025 14:32:30 -0500 Subject: [PATCH] view: update top layer visiblity at unmap instead of destroy It's possible for a fullscreen xwayland view to be unmapped without being destroyed. In this case, we need to update top layer visibility, otherwise panels and the like will remain hidden. Since unmap is always called before destroy, it's sufficient to do the update only in view_impl_unmap() and not in view_destroy(). Adaptive sync logic needs work still, but I tried to minimize changes to it since I don't have hardware to test it. --- src/view-impl-common.c | 18 ++++++++++++++++++ src/view.c | 14 -------------- 2 files changed, 18 insertions(+), 14 deletions(-) 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); /*