]> git.mdlowis.com Git - proto/labwc.git/commitdiff
view: update top layer visiblity at unmap instead of destroy
authorJohn Lindgren <john@jlindgren.net>
Fri, 7 Nov 2025 19:32:30 +0000 (14:32 -0500)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Sun, 9 Nov 2025 05:46:59 +0000 (06:46 +0100)
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
src/view.c

index df72fe62757b5aeed6cc129d6b5bf093731bf7db..efc749bfc7ea486a6e83721da71383b821163113 100644 (file)
@@ -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
index 87ef8566c44fa33edfd6a96566e23c8eff37b7c6..5dac1f94f393930007293e7ce19f954105958326 100644 (file)
@@ -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);
 
        /*