diff options
| author | Isaac Freund <ifreund@ifreund.xyz> | 2020-06-11 01:19:59 +0200 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2020-06-11 01:19:59 +0200 |
| commit | 0ab2b3134e34ad1c701274ee622d2b837149d8dd (patch) | |
| tree | 7cd670cab396476d08a4d8c1876b2ed3403ae646 | |
| parent | 8839ae7335b3650e538e4671bd7aaae8b0adc0f8 (diff) | |
| download | river-0ab2b3134e34ad1c701274ee622d2b837149d8dd.tar.gz river-0ab2b3134e34ad1c701274ee622d2b837149d8dd.tar.xz | |
code: simplify view rendering
| -rw-r--r-- | river/View.zig | 2 | ||||
| -rw-r--r-- | river/render.zig | 29 |
2 files changed, 9 insertions, 22 deletions
diff --git a/river/View.zig b/river/View.zig index 9fdae5a..171d829 100644 --- a/river/View.zig +++ b/river/View.zig @@ -56,7 +56,7 @@ wlr_surface: ?*c.wlr_surface, /// If the view is floating or not floating: bool, -/// True if the view is currentlt focused by at lease one seat +/// True if the view is currently focused by at least one seat focused: bool, /// The current output-relative coordinates and dimensions of the view diff --git a/river/render.zig b/river/render.zig index aca8b85..19ad32d 100644 --- a/river/render.zig +++ b/river/render.zig @@ -39,7 +39,6 @@ const SurfaceRenderData = struct { pub fn renderOutput(output: *Output) void { const wlr_renderer = output.getRenderer(); - const input_manager = output.root.server.input_manager; var now: c.timespec = undefined; _ = c.clock_gettime(c.CLOCK_MONOTONIC, &now); @@ -68,17 +67,10 @@ pub fn renderOutput(output: *Output) void { // This check prevents a race condition when a frame is requested // between mapping of a view and the first configure being handled. - if (view.current_box.width == 0 or view.current_box.height == 0) { - continue; - } + if (view.current_box.width == 0 or view.current_box.height == 0) continue; // Focused views are rendered on top of normal views, skip them for now - var seat_it = input_manager.seats.first; - if (while (seat_it) |seat_node| : (seat_it = seat_node.next) { - if (seat_node.data.focused_view == view) break true; - } else false) { - continue; - } + if (view.focused) continue; renderView(output.*, view, &now); renderBorders(output.*, view, &now); @@ -88,19 +80,14 @@ pub fn renderOutput(output: *Output) void { it = ViewStack(View).reverseIterator(output.views.last, output.current_focused_tags); while (it.next()) |node| { const view = &node.view; + // This check prevents a race condition when a frame is requested // between mapping of a view and the first configure being handled. - if (view.current_box.width == 0 or view.current_box.height == 0) { - continue; - } - - // Skip unfocused views - var seat_it = input_manager.seats.first; - if (while (seat_it) |seat_node| : (seat_it = seat_node.next) { - if (seat_node.data.focused_view == view) break false; - } else true) { - continue; - } + if (view.current_box.width == 0 or view.current_box.height == 0) continue; + + // Skip unfocused views since we already rendered them + if (!view.focused) continue; + renderView(output.*, view, &now); renderBorders(output.*, view, &now); } |
