Root: migrate {all,active}_outputs to wl.list

As discussed with ifreund on irc. This avoids extra allocation in case
of all_outputs and confusion in case of active_outputs (because with the
Output embedded in the Node, i thought its value was copied instead of
its pointer).
This commit is contained in:
tiosgz
2023-08-06 13:36:33 +00:00
parent 8966f95e72
commit 4726a6b0f1
8 changed files with 88 additions and 85 deletions

View File

@ -258,9 +258,9 @@ pub fn setTheme(self: *Self, theme: ?[*:0]const u8, _size: ?u32) !void {
self.xcursor_manager = try wlr.XcursorManager.create(theme, size);
// For each output, ensure a theme of the proper scale is loaded
var it = server.root.active_outputs.first;
while (it) |node| : (it = node.next) {
const wlr_output = node.data.wlr_output;
var it = server.root.active_outputs.iterator(.forward);
while (it.next()) |output| {
const wlr_output = output.wlr_output;
self.xcursor_manager.load(wlr_output.scale) catch
log.err("failed to load xcursor theme '{?s}' at scale {}", .{ theme, wlr_output.scale });
}