From 0cc930b738064cdab99fe4a34e07e0ae7d726b42 Mon Sep 17 00:00:00 2001 From: tiosgz Date: Sun, 6 Aug 2023 13:59:28 +0000 Subject: [PATCH] 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