aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.zig4
-rw-r--r--river/Config.zig4
-rw-r--r--river/Control.zig4
-rw-r--r--river/InputManager.zig2
-rw-r--r--river/Output.zig8
-rw-r--r--river/Root.zig8
-rw-r--r--river/Seat.zig8
-rw-r--r--river/View.zig2
-rw-r--r--river/command/enter_mode.zig2
-rw-r--r--river/command/map.zig2
-rw-r--r--river/log.zig20
-rw-r--r--river/main.zig2
-rw-r--r--river/util.zig2
-rw-r--r--river/view_stack.zig2
14 files changed, 35 insertions, 35 deletions
diff --git a/build.zig b/build.zig
index 23aa3e6..cca6b87 100644
--- a/build.zig
+++ b/build.zig
@@ -139,7 +139,7 @@ const ScanProtocolsStep = struct {
fn init(builder: *std.build.Builder) ScanProtocolsStep {
return ScanProtocolsStep{
.builder = builder,
- .step = std.build.Step.init("Scan Protocols", builder.allocator, make),
+ .step = std.build.Step.init(.Custom, "Scan Protocols", builder.allocator, make),
};
}
@@ -234,7 +234,7 @@ const ScdocStep = struct {
fn init(builder: *std.build.Builder) ScdocStep {
return ScdocStep{
.builder = builder,
- .step = std.build.Step.init("Generate man pages", builder.allocator, make),
+ .step = std.build.Step.init(.Custom, "Generate man pages", builder.allocator, make),
};
}
diff --git a/river/Config.zig b/river/Config.zig
index 334c21d..bb9b7a6 100644
--- a/river/Config.zig
+++ b/river/Config.zig
@@ -83,9 +83,9 @@ pub fn init() !Self {
return self;
}
-pub fn deinit(self: Self) void {
+pub fn deinit(self: *Self) void {
var it = self.mode_to_id.iterator();
- while (it.next()) |kv| util.gpa.free(kv.key);
+ while (it.next()) |e| util.gpa.free(e.key);
self.mode_to_id.deinit();
for (self.modes.items) |mode| mode.deinit();
diff --git a/river/Control.zig b/river/Control.zig
index ee61794..23ea98b 100644
--- a/river/Control.zig
+++ b/river/Control.zig
@@ -104,7 +104,7 @@ fn addArgument(wl_client: ?*c.wl_client, wl_resource: ?*c.wl_resource, arg: ?[*:
return;
};
- self.args_map.get(id).?.value.append(owned_slice) catch {
+ self.args_map.getEntry(id).?.value.append(owned_slice) catch {
c.wl_client_post_no_memory(wl_client);
util.gpa.free(owned_slice);
return;
@@ -133,7 +133,7 @@ fn runCommand(
};
c.wl_resource_set_implementation(callback_resource, null, null, null);
- const args = self.args_map.get(c.wl_resource_get_id(wl_resource)).?.value.items;
+ const args = self.args_map.get(c.wl_resource_get_id(wl_resource)).?.items;
var out: ?[]const u8 = null;
defer if (out) |s| util.gpa.free(s);
diff --git a/river/InputManager.zig b/river/InputManager.zig
index 9482cfe..55de3b2 100644
--- a/river/InputManager.zig
+++ b/river/InputManager.zig
@@ -35,7 +35,7 @@ server: *Server,
wlr_idle: *c.wlr_idle,
wlr_input_inhibit_manager: *c.wlr_input_inhibit_manager,
-seats: std.TailQueue(Seat) = std.TailQueue(Seat).init(),
+seats: std.TailQueue(Seat) = .{},
exclusive_client: ?*c.wl_client = null,
diff --git a/river/Output.zig b/river/Output.zig
index 8a5acc9..3ce8da8 100644
--- a/river/Output.zig
+++ b/river/Output.zig
@@ -42,7 +42,7 @@ root: *Root,
wlr_output: *c.wlr_output,
/// All layer surfaces on the output, indexed by the layer enum.
-layers: [4]std.TailQueue(LayerSurface) = [1]std.TailQueue(LayerSurface){std.TailQueue(LayerSurface).init()} ** 4,
+layers: [4]std.TailQueue(LayerSurface) = [1]std.TailQueue(LayerSurface){.{}} ** 4,
/// The area left for views and other layer surfaces after applying the
/// exclusive zones of exclusive layer surfaces.
@@ -50,7 +50,7 @@ layers: [4]std.TailQueue(LayerSurface) = [1]std.TailQueue(LayerSurface){std.Tail
usable_box: Box,
/// The top of the stack is the "most important" view.
-views: ViewStack(View) = ViewStack(View){},
+views: ViewStack(View) = .{},
/// The double-buffered state of the output.
current: State = State{ .tags = 1 << 0 },
@@ -71,7 +71,7 @@ layout: []const u8,
attach_mode: AttachMode = .top,
/// List of status tracking objects relaying changes to this output to clients.
-status_trackers: std.SinglyLinkedList(OutputStatus) = std.SinglyLinkedList(OutputStatus).init(),
+status_trackers: std.SinglyLinkedList(OutputStatus) = .{},
// All listeners for this output, in alphabetical order
listen_destroy: c.wl_listener = undefined,
@@ -240,7 +240,7 @@ fn layoutExternal(self: *Self, visible_count: u32) !void {
std.os.execveZ("/bin/sh", &cmd, std.c.environ) catch c._exit(1);
}
std.os.close(stdout_pipe[1]);
- const stdout = std.fs.File{ .handle = stdout_pipe[0], .io_mode = std.io.mode };
+ const stdout = std.fs.File{ .handle = stdout_pipe[0] };
defer stdout.close();
// TODO abort after a timeout
diff --git a/river/Root.zig b/river/Root.zig
index a128319..5705ea3 100644
--- a/river/Root.zig
+++ b/river/Root.zig
@@ -35,20 +35,20 @@ const DragIcon = @import("DragIcon.zig");
server: *Server,
wlr_output_layout: *c.wlr_output_layout,
-outputs: std.TailQueue(Output) = std.TailQueue(Output).init(),
+outputs: std.TailQueue(Output) = .{},
/// This output is used internally when no real outputs are available.
/// It is not advertised to clients.
noop_output: Output = undefined,
-drag_icons: std.SinglyLinkedList(DragIcon) = std.SinglyLinkedList(DragIcon).init(),
+drag_icons: std.SinglyLinkedList(DragIcon) = .{},
/// This list stores all unmanaged Xwayland windows. This needs to be in root
/// since X is like the wild west and who knows where these things will go.
xwayland_unmanaged_views: if (build_options.xwayland)
std.TailQueue(XwaylandUnmanaged)
else
- void = if (build_options.xwayland) std.TailQueue(XwaylandUnmanaged).init(),
+ void = if (build_options.xwayland) .{},
/// Number of pending configures sent in the current transaction.
/// A value of 0 means there is no current transaction.
@@ -92,7 +92,7 @@ pub fn deinit(self: *Self) void {
}
pub fn addOutput(self: *Self, wlr_output: *c.wlr_output) void {
- const node = self.outputs.allocateNode(util.gpa) catch {
+ const node = util.gpa.create(std.TailQueue(Output).Node) catch {
c.wlr_output_destroy(wlr_output);
return;
};
diff --git a/river/Seat.zig b/river/Seat.zig
index 59f9eab..77bfed8 100644
--- a/river/Seat.zig
+++ b/river/Seat.zig
@@ -48,7 +48,7 @@ wlr_seat: *c.wlr_seat,
cursor: Cursor = undefined,
/// Mulitple keyboards are handled separately
-keyboards: std.TailQueue(Keyboard) = std.TailQueue(Keyboard).init(),
+keyboards: std.TailQueue(Keyboard) = .{},
/// ID of the current keymap mode
mode_id: usize = 0,
@@ -61,10 +61,10 @@ focused: FocusTarget = .none,
/// Stack of views in most recently focused order
/// If there is a currently focused view, it is on top.
-focus_stack: ViewStack(*View) = ViewStack(*View){},
+focus_stack: ViewStack(*View) = .{},
/// List of status tracking objects relaying changes to this seat to clients.
-status_trackers: std.SinglyLinkedList(SeatStatus) = std.SinglyLinkedList(SeatStatus).init(),
+status_trackers: std.SinglyLinkedList(SeatStatus) = .{},
listen_request_set_selection: c.wl_listener = undefined,
listen_request_start_drag: c.wl_listener = undefined,
@@ -307,7 +307,7 @@ pub fn addDevice(self: *Self, device: *c.wlr_input_device) void {
}
fn addKeyboard(self: *Self, device: *c.wlr_input_device) !void {
- const node = try self.keyboards.allocateNode(util.gpa);
+ const node = try util.gpa.create(std.TailQueue(Keyboard).Node);
node.data.init(self, device) catch |err| {
switch (err) {
error.XkbContextFailed => log.err(.keyboard, "Failed to create XKB context", .{}),
diff --git a/river/View.zig b/river/View.zig
index ddb0445..3bcc684 100644
--- a/river/View.zig
+++ b/river/View.zig
@@ -111,7 +111,7 @@ float_box: Box = undefined,
draw_borders: bool = true,
-pub fn init(self: *Self, output: *Output, tags: u32, surface: var) void {
+pub fn init(self: *Self, output: *Output, tags: u32, surface: anytype) void {
self.* = .{
.output = output,
.current = .{ .tags = tags },
diff --git a/river/command/enter_mode.zig b/river/command/enter_mode.zig
index da79856..c60dcf9 100644
--- a/river/command/enter_mode.zig
+++ b/river/command/enter_mode.zig
@@ -32,7 +32,7 @@ pub fn enterMode(
const config = seat.input_manager.server.config;
const target_mode = args[1];
- seat.mode_id = config.mode_to_id.getValue(target_mode) orelse {
+ seat.mode_id = config.mode_to_id.get(target_mode) orelse {
out.* = try std.fmt.allocPrint(
allocator,
"cannot enter non-existant mode '{}'",
diff --git a/river/command/map.zig b/river/command/map.zig
index 5eff26d..42f834b 100644
--- a/river/command/map.zig
+++ b/river/command/map.zig
@@ -149,7 +149,7 @@ pub fn mapPointer(
fn modeNameToId(allocator: *std.mem.Allocator, seat: *Seat, mode_name: []const u8, out: *?[]const u8) !usize {
const config = seat.input_manager.server.config;
- return config.mode_to_id.getValue(mode_name) orelse {
+ return config.mode_to_id.get(mode_name) orelse {
out.* = try std.fmt.allocPrint(
allocator,
"cannot add mapping to non-existant mode '{}p'",
diff --git a/river/log.zig b/river/log.zig
index 1874630..3c4930b 100644
--- a/river/log.zig
+++ b/river/log.zig
@@ -55,12 +55,12 @@ fn log(
comptime message_level: Level,
comptime scope: @TypeOf(.foobar),
comptime format: []const u8,
- args: var,
+ args: anytype,
) void {
if (@enumToInt(message_level) <= @enumToInt(level)) {
// Don't store/log messages in release small mode to save space
if (std.builtin.mode != .ReleaseSmall) {
- const stderr = std.debug.getStderrStream();
+ const stderr = std.io.getStdErr().writer();
stderr.print(@tagName(message_level) ++ ": (" ++ @tagName(scope) ++ ") " ++
format ++ "\n", args) catch return;
}
@@ -72,7 +72,7 @@ fn log(
pub fn emerg(
comptime scope: @TypeOf(.foobar),
comptime format: []const u8,
- args: var,
+ args: anytype,
) void {
@setCold(true);
log(.emerg, scope, format, args);
@@ -83,7 +83,7 @@ pub fn emerg(
pub fn alert(
comptime scope: @TypeOf(.foobar),
comptime format: []const u8,
- args: var,
+ args: anytype,
) void {
@setCold(true);
log(.alert, scope, format, args);
@@ -95,7 +95,7 @@ pub fn alert(
pub fn crit(
comptime scope: @TypeOf(.foobar),
comptime format: []const u8,
- args: var,
+ args: anytype,
) void {
@setCold(true);
log(.crit, scope, format, args);
@@ -106,7 +106,7 @@ pub fn crit(
pub fn err(
comptime scope: @TypeOf(.foobar),
comptime format: []const u8,
- args: var,
+ args: anytype,
) void {
@setCold(true);
log(.err, scope, format, args);
@@ -118,7 +118,7 @@ pub fn err(
pub fn warn(
comptime scope: @TypeOf(.foobar),
comptime format: []const u8,
- args: var,
+ args: anytype,
) void {
log(.warn, scope, format, args);
}
@@ -128,7 +128,7 @@ pub fn warn(
pub fn notice(
comptime scope: @TypeOf(.foobar),
comptime format: []const u8,
- args: var,
+ args: anytype,
) void {
log(.notice, scope, format, args);
}
@@ -138,7 +138,7 @@ pub fn notice(
pub fn info(
comptime scope: @TypeOf(.foobar),
comptime format: []const u8,
- args: var,
+ args: anytype,
) void {
log(.info, scope, format, args);
}
@@ -148,7 +148,7 @@ pub fn info(
pub fn debug(
comptime scope: @TypeOf(.foobar),
comptime format: []const u8,
- args: var,
+ args: anytype,
) void {
log(.debug, scope, format, args);
}
diff --git a/river/main.zig b/river/main.zig
index 7e47ec4..7b7eeb8 100644
--- a/river/main.zig
+++ b/river/main.zig
@@ -94,7 +94,7 @@ pub fn main() anyerror!void {
log.info(.server, "shutting down", .{});
}
-fn printErrorExit(comptime format: []const u8, args: var) noreturn {
+fn printErrorExit(comptime format: []const u8, args: anytype) noreturn {
const stderr = std.io.getStdErr().outStream();
stderr.print(format ++ "\n", args) catch std.os.exit(1);
std.os.exit(1);
diff --git a/river/util.zig b/river/util.zig
index 64b4b30..5029ce3 100644
--- a/river/util.zig
+++ b/river/util.zig
@@ -23,7 +23,7 @@ pub const gpa = std.heap.c_allocator;
/// Take a pointer to c_void and cast it to a pointer to T. This function
/// exists to avoid having the verbosity of the required alignment casts all
/// over the code.
-pub fn voidCast(comptime T: type, ptr: var) *T {
+pub fn voidCast(comptime T: type, ptr: anytype) *T {
// See https://github.com/ziglang/zig/issues/5618
if (@TypeOf(ptr) != *c_void)
@compileError("voidCast takes *c_void but " ++ @typeName(@TypeOf(ptr)) ++ " was provided");
diff --git a/river/view_stack.zig b/river/view_stack.zig
index 25f453e..98ddc8e 100644
--- a/river/view_stack.zig
+++ b/river/view_stack.zig
@@ -140,7 +140,7 @@ pub fn ViewStack(comptime T: type) type {
pub fn iter(
start: ?*Node,
dir: Direction,
- context: var,
+ context: anytype,
filter: fn (*View, @TypeOf(context)) bool,
) Iter(@TypeOf(context)) {
return .{ .it = start, .dir = dir, .context = context, .filter = filter };