diff options
| author | Isaac Freund <ifreund@ifreund.xyz> | 2020-06-11 00:09:42 +0200 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2020-06-11 00:09:42 +0200 |
| commit | ff219c7d8d33838bd004b99c3ab246e7be1776db (patch) | |
| tree | 0b61007bdef3fb1258382a42877ff589ca41cd10 | |
| parent | 1b7c1c7b2cc1a410ccc63cbd91df71e1ae1ea53b (diff) | |
| download | river-ff219c7d8d33838bd004b99c3ab246e7be1776db.tar.gz river-ff219c7d8d33838bd004b99c3ab246e7be1776db.tar.xz | |
render: floating as normal, focused views on top
This means that floating views can be (partially) obscured by normal
views if they are low in the stack, and that the "full" layout will
work a little nicer as the focused view is always the top rendered.
| -rw-r--r-- | river/render.zig | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/river/render.zig b/river/render.zig index fd87e51..aca8b85 100644 --- a/river/render.zig +++ b/river/render.zig @@ -39,6 +39,7 @@ 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); @@ -64,20 +65,26 @@ pub fn renderOutput(output: *Output) void { var 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; } - // Floating views are rendered on top of normal views - if (view.floating) { + + // 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; } + renderView(output.*, view, &now); renderBorders(output.*, view, &now); } - // Render floating views + // Render focused views it = ViewStack(View).reverseIterator(output.views.last, output.current_focused_tags); while (it.next()) |node| { const view = &node.view; @@ -86,7 +93,12 @@ pub fn renderOutput(output: *Output) void { if (view.current_box.width == 0 or view.current_box.height == 0) { continue; } - if (!view.floating) { + + // 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; } renderView(output.*, view, &now); |
