]> git.mdlowis.com Git - proto/labwc.git/commitdiff
desktop: show/hide `top` layer more smartly
authortokyo4j <hrak1529@gmail.com>
Mon, 13 May 2024 01:18:28 +0000 (10:18 +0900)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Tue, 14 May 2024 13:57:27 +0000 (15:57 +0200)
Before this commit, `top` layers were hidden whenever there is a
fullscreen window in the corresponding output.

With this commit, `top` layers are hidden only when there is a fullscreen
window without other windows above it in the corresponding output.

A caveat is that `bottom` layer is still always hidden by a fullscreen
window.

src/desktop.c
src/view.c

index 02843b7135abd60d97e132bc24c42d892051a67e..58f87a1f1b3de60adb25b1145f04c744540c414a 100644 (file)
@@ -229,17 +229,23 @@ desktop_update_top_layer_visiblity(struct server *server)
                wlr_scene_node_set_enabled(&output->layer_tree[top]->node, true);
        }
 
-       /* And disable them again when there is a view in fullscreen */
-       enum lab_view_criteria criteria =
-               LAB_VIEW_CRITERIA_CURRENT_WORKSPACE | LAB_VIEW_CRITERIA_FULLSCREEN;
-       for_each_view(view, &server->views, criteria) {
+       /*
+        * And disable them again when there is a fullscreen view without
+        * any views above it
+        */
+       uint64_t outputs_covered = 0;
+       for_each_view(view, &server->views, LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
                if (view->minimized) {
                        continue;
                }
                if (!output_is_usable(view->output)) {
                        continue;
                }
-               wlr_scene_node_set_enabled(&view->output->layer_tree[top]->node, false);
+               if (view->fullscreen && !(view->outputs & outputs_covered)) {
+                       wlr_scene_node_set_enabled(
+                               &view->output->layer_tree[top]->node, false);
+               }
+               outputs_covered |= view->outputs;
        }
 }
 
index 25180c1127c3c38dd25859c4b230064a544fc908..b10a39aed49d56d259e69eba49c405cd8c648f30 100644 (file)
@@ -387,16 +387,20 @@ view_update_outputs(struct view *view)
        struct output *output;
        struct wlr_output_layout *layout = view->server->output_layout;
 
-       view->outputs = 0;
+       uint64_t new_outputs = 0;
        wl_list_for_each(output, &view->server->outputs, link) {
                if (output_is_usable(output) && wlr_output_layout_intersects(
                                layout, output->wlr_output, &view->current)) {
-                       view->outputs |= (1ull << output->scene_output->index);
+                       new_outputs |= (1ull << output->scene_output->index);
                }
        }
 
-       if (view->toplevel.handle) {
-               foreign_toplevel_update_outputs(view);
+       if (new_outputs != view->outputs) {
+               view->outputs = new_outputs;
+               if (view->toplevel.handle) {
+                       foreign_toplevel_update_outputs(view);
+               }
+               desktop_update_top_layer_visiblity(view->server);
        }
 }
 
@@ -2037,6 +2041,7 @@ view_move_to_front(struct view *view)
        }
 
        cursor_update_focus(view->server);
+       desktop_update_top_layer_visiblity(view->server);
 }
 
 void
@@ -2050,6 +2055,7 @@ view_move_to_back(struct view *view)
        move_to_back(root);
 
        cursor_update_focus(view->server);
+       desktop_update_top_layer_visiblity(view->server);
 }
 
 struct view *