git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit6c0d90bbdafbf339227a1835f5c0624efbf8c044
parent732ddee63f
authortiosgz <[email protected]>
date2023-08-06 13:59
Root: fix inflight_layout_demands counting

Not decreasing the counter caused a weird bug where disabling/removing
an output (curiously, it seems to apply only to last active output being
removed) would lock the user out of the session, not letting the
transaction to complete (therefore hiding all views on a newly added
output) and messing up focus.

Fixes https://github.com/riverwm/river/issues/830

 river/Root.zig | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/river/Root.zig b/river/Root.zig
index c41ef34..1b4b2e3 100644
--- a/river/Root.zig
+++ b/river/Root.zig
@@ -274,12 +274,6 @@ pub fn deactivateOutput(root: *Self, output: *Output) void {
         output.active_link.init();
     }
 
-    if (output.inflight.layout_demand) |layout_demand| {
-        layout_demand.deinit();
-        output.inflight.layout_demand = null;
-    }
-    while (output.layouts.first) |node| node.data.destroy();
-
     {
         var it = output.inflight.focus_stack.iterator(.forward);
         while (it.next()) |view| {
@@ -335,6 +329,13 @@ pub fn deactivateOutput(root: *Self, output: *Output) void {
 
     output.status.deinit();
     output.status.init();
+
+    if (output.inflight.layout_demand) |layout_demand| {
+        layout_demand.deinit();
+        output.inflight.layout_demand = null;
+        root.notifyLayoutDemandDone();
+    }
+    while (output.layouts.first) |node| node.data.destroy();
 }
 
 /// Add the output to root.active_outputs and the output layout if it has not