Root: rename field outputs to active_outputs

Although this list only including active outputs was already documented,
making this explicit in its name reduces confusion and debugging
overhead.
This commit is contained in:
tiosgz
2023-08-03 15:12:56 +00:00
parent bbd21c1637
commit 57186fced3
6 changed files with 30 additions and 30 deletions

View File

@ -38,7 +38,7 @@ pub fn focusOutput(
// If the fallback pseudo-output is focused, there are no other outputs to switch to
if (seat.focused_output == null) {
assert(server.root.outputs.len == 0);
assert(server.root.active_outputs.len == 0);
return;
}
@ -62,7 +62,7 @@ pub fn sendToOutput(
// If the fallback pseudo-output is focused, there is nowhere to send the view
if (seat.focused_output == null) {
assert(server.root.outputs.len == 0);
assert(server.root.active_outputs.len == 0);
return;
}
@ -89,8 +89,8 @@ fn getOutput(seat: *Seat, str: []const u8) !?*Output {
// Return the next/prev output in the list if there is one, else wrap
const focused_node = @fieldParentPtr(std.TailQueue(Output).Node, "data", seat.focused_output.?);
return switch (direction) {
.next => if (focused_node.next) |node| &node.data else &server.root.outputs.first.?.data,
.previous => if (focused_node.prev) |node| &node.data else &server.root.outputs.last.?.data,
.next => if (focused_node.next) |node| &node.data else &server.root.active_outputs.first.?.data,
.previous => if (focused_node.prev) |node| &node.data else &server.root.active_outputs.last.?.data,
};
} else if (std.meta.stringToEnum(wlr.OutputLayout.Direction, str)) |direction| { // Spacial direction
var focus_box: wlr.Box = undefined;
@ -106,7 +106,7 @@ fn getOutput(seat: *Seat, str: []const u8) !?*Output {
return @intToPtr(*Output, wlr_output.data);
} else {
// Check if an output matches by name
var it = server.root.outputs.first;
var it = server.root.active_outputs.first;
while (it) |node| : (it = node.next) {
if (mem.eql(u8, mem.span(node.data.wlr_output.name), str)) {
return &node.data;