diff options
| author | Isaac Freund <mail@isaacfreund.com> | 2024-01-09 13:03:55 -0600 |
|---|---|---|
| committer | Isaac Freund <mail@isaacfreund.com> | 2024-01-09 13:03:55 -0600 |
| commit | c38e7e2d879ef6508f7cb77aec8a52f90d832a3c (patch) | |
| tree | 866a6d3b9feb4560c2b1a80eca3e680ea2c52367 | |
| parent | 5947f04408c5f7d578054d40e2c1a3bbb7051bd0 (diff) | |
| download | river-c38e7e2d879ef6508f7cb77aec8a52f90d832a3c.tar.gz river-c38e7e2d879ef6508f7cb77aec8a52f90d832a3c.tar.xz | |
Root: remove unneeded fallback.inflight lists
| -rw-r--r-- | river/Root.zig | 25 | ||||
| -rw-r--r-- | river/View.zig | 19 |
2 files changed, 19 insertions, 25 deletions
diff --git a/river/Root.zig b/river/Root.zig index 8831203..ef2bb65 100644 --- a/river/Root.zig +++ b/river/Root.zig @@ -71,6 +71,9 @@ hidden: struct { /// This is used to store views and tags when no actual outputs are available. /// This must be separate from hidden to ensure we don't mix views that are /// in the process of being mapped/unmapped with the mapped views in these lists. +/// There is no need for inflight lists, instead the inflight links of views are +/// remove()'d from their current list and init()'d so they may be remove()'d again +/// when an output becomes available and they are moved to the output's inflight lists. fallback: struct { tags: u32 = 1 << 0, @@ -78,11 +81,6 @@ fallback: struct { focus_stack: wl.list.Head(View, .pending_focus_stack_link), wm_stack: wl.list.Head(View, .pending_wm_stack_link), }, - - inflight: struct { - focus_stack: wl.list.Head(View, .inflight_focus_stack_link), - wm_stack: wl.list.Head(View, .inflight_wm_stack_link), - }, }, views: wl.list.Head(View, .link), @@ -172,10 +170,6 @@ pub fn init(self: *Self) !void { .focus_stack = undefined, .wm_stack = undefined, }, - .inflight = .{ - .focus_stack = undefined, - .wm_stack = undefined, - }, }, .views = undefined, .output_layout = output_layout, @@ -193,8 +187,6 @@ pub fn init(self: *Self) !void { self.fallback.pending.focus_stack.init(); self.fallback.pending.wm_stack.init(); - self.fallback.inflight.focus_stack.init(); - self.fallback.inflight.wm_stack.init(); self.views.init(); self.all_outputs.init(); @@ -284,15 +276,20 @@ pub fn deactivateOutput(root: *Self, output: *Output) void { output.active_link.init(); { - var it = output.inflight.focus_stack.iterator(.forward); + var it = output.inflight.focus_stack.safeIterator(.forward); while (it.next()) |view| { view.inflight.output = null; view.current.output = null; + view.tree.node.reparent(root.hidden.tree); view.popup_tree.node.reparent(root.hidden.tree); + + view.inflight_focus_stack_link.remove(); + view.inflight_focus_stack_link.init(); + + view.inflight_wm_stack_link.remove(); + view.inflight_wm_stack_link.init(); } - root.fallback.inflight.focus_stack.prependList(&output.inflight.focus_stack); - root.fallback.inflight.wm_stack.prependList(&output.inflight.wm_stack); } // Use the first output in the list as fallback. If the last real output // is being removed, store the views in Root.fallback. diff --git a/river/View.zig b/river/View.zig index f22cc43..8ca0186 100644 --- a/river/View.zig +++ b/river/View.zig @@ -529,21 +529,18 @@ pub fn map(view: *Self) !void { view.pending_wm_stack_link.remove(); view.pending_focus_stack_link.remove(); - view.inflight_wm_stack_link.remove(); - view.inflight_focus_stack_link.remove(); switch (server.config.attach_mode) { - .top => { - server.root.fallback.pending.wm_stack.prepend(view); - server.root.fallback.inflight.wm_stack.prepend(view); - }, - .bottom => { - server.root.fallback.pending.wm_stack.append(view); - server.root.fallback.inflight.wm_stack.append(view); - }, + .top => server.root.fallback.pending.wm_stack.prepend(view), + .bottom => server.root.fallback.pending.wm_stack.append(view), } server.root.fallback.pending.focus_stack.prepend(view); - server.root.fallback.inflight.focus_stack.prepend(view); + + view.inflight_wm_stack_link.remove(); + view.inflight_wm_stack_link.init(); + + view.inflight_focus_stack_link.remove(); + view.inflight_focus_stack_link.init(); } view.float_box = view.pending.box; |
