diff options
| author | Isaac Freund <ifreund@ifreund.xyz> | 2020-04-03 18:53:36 +0200 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2020-04-04 16:51:02 +0200 |
| commit | 6cb9f6ac04e1fc7716bd69707c714ae89599cccc (patch) | |
| tree | d2b2e846a5f191b25e1853a0d60e5776f05b57c6 /src/output.zig | |
| parent | 9ba295f12673f201b5d70fa3918e270ef41be9f7 (diff) | |
| download | river-6cb9f6ac04e1fc7716bd69707c714ae89599cccc.tar.gz river-6cb9f6ac04e1fc7716bd69707c714ae89599cccc.tar.xz | |
Add a data structure to manage the view stack
Diffstat (limited to 'src/output.zig')
| -rw-r--r-- | src/output.zig | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/output.zig b/src/output.zig index d3b3ffe..936ee51 100644 --- a/src/output.zig +++ b/src/output.zig @@ -4,6 +4,7 @@ const c = @import("c.zig"); const Root = @import("root.zig").Root; const Server = @import("server.zig").Server; const View = @import("view.zig").View; +const ViewStack = @import("view_stack.zig").ViewStack; const RenderData = struct { output: *c.wlr_output, @@ -79,22 +80,12 @@ pub const Output = struct { const color = [_]f32{ 0.3, 0.3, 0.3, 1.0 }; c.wlr_renderer_clear(renderer, &color); - // Each subsequent view is rendered on top of the last. // The first view in the list is "on top" so iterate in reverse. - var it = output.root.views.last; - while (it) |node| : (it = node.prev) { - const view = &node.data; - - // Only render currently visible views - if (view.current_tags & output.root.current_focused_tags == 0) { - continue; - } - - // TODO: remove this check and move unmaped views back to unmaped TailQueue - if (!view.mapped) { - // An unmapped view should not be rendered. - continue; - } + var it = ViewStack.reverseIterator( + output.root.views.first, + output.root.current_focused_tags, + ); + while (it.next()) |view| { output.renderView(view, &now); } |
