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

commitdf53a79648c802980c714efe0600b4e8f6976378
parent4ee21c1c78
authorIsaac Freund <[email protected]>
date2026-04-30 09:39
Window: clear focus in makeInert() rather than unmap()

It was reported that the focus assertion in destroy() was hit.
I think this should fix it.

 river/Window.zig | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/river/Window.zig b/river/Window.zig
index fb91514..7b4ad00 100644
--- a/river/Window.zig
+++ b/river/Window.zig
@@ -573,6 +573,14 @@ fn handleDestroy(_: *river.WindowV1, window: *Window) void {
         var it = decorations.iterator(.forward);
         while (it.next()) |decoration| decoration.makeInert();
     }
+    {
+        var it = server.input_manager.seats.iterator(.forward);
+        while (it.next()) |seat| {
+            if (seat.focused == .window and seat.focused.window == window) {
+                seat.focus(.none);
+            }
+        }
+    }
 }
 
 fn handleRequest(
@@ -1180,15 +1188,6 @@ pub fn unmap(window: *Window) void {
         handle.destroy();
         window.wlr_toplevel_handle = null;
     }
-
-    {
-        var it = server.input_manager.seats.iterator(.forward);
-        while (it.next()) |seat| {
-            if (seat.focused == .window and seat.focused.window == window) {
-                seat.focus(.none);
-            }
-        }
-    }
 }
 
 pub fn notifyTitle(window: *Window) void {