diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-08-29 18:21:48 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-08-29 18:21:48 +0200 |
| commit | 4feb8c7dab2b0a3492b8248ee12c3f0a475106f1 (patch) | |
| tree | f89a6389e24ab362cbdb21e1dbd4f96b404472fd /src/wl | |
| parent | ed0ec55697b11fa54ff661bc6c250398a096f85a (diff) | |
Use wayland.Context instead of *const wayland.Context
Diffstat (limited to 'src/wl')
| -rw-r--r-- | src/wl/buffer.zig | 2 | ||||
| -rw-r--r-- | src/wl/callback.zig | 6 | ||||
| -rw-r--r-- | src/wl/compositor.zig | 6 | ||||
| -rw-r--r-- | src/wl/display.zig | 16 | ||||
| -rw-r--r-- | src/wl/output/root.zig | 16 | ||||
| -rw-r--r-- | src/wl/registry.zig | 6 | ||||
| -rw-r--r-- | src/wl/shm/pool.zig | 6 | ||||
| -rw-r--r-- | src/wl/shm/root.zig | 8 | ||||
| -rw-r--r-- | src/wl/surface.zig | 12 |
9 files changed, 39 insertions, 39 deletions
diff --git a/src/wl/buffer.zig b/src/wl/buffer.zig index 6dd83be..fe69899 100644 --- a/src/wl/buffer.zig +++ b/src/wl/buffer.zig @@ -19,7 +19,7 @@ pub fn Buffer(fmt: wl.Shm.Format) type { pub fn init( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, width: usize, height: usize, data: []u8, diff --git a/src/wl/callback.zig b/src/wl/callback.zig index 24927b4..ad2d192 100644 --- a/src/wl/callback.zig +++ b/src/wl/callback.zig @@ -13,7 +13,7 @@ handle: wayland.Object.Ref, pub fn init( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, is_done: *bool, ) !void { self.is_done = is_done; @@ -25,11 +25,11 @@ pub fn init( } -pub fn deinit(self: *Self, ctx: *const wayland.Context) void { +pub fn deinit(self: *Self, ctx: wayland.Context) void { ctx.display.registry.disable_object(self.handle); } -fn done(self: *Self, ctx: *const wayland.Context, value: u32) void { +fn done(self: *Self, ctx: wayland.Context, value: u32) void { _ = value; _ = ctx; self.is_done.* = true; diff --git a/src/wl/compositor.zig b/src/wl/compositor.zig index ae8d15e..166430a 100644 --- a/src/wl/compositor.zig +++ b/src/wl/compositor.zig @@ -22,7 +22,7 @@ pub const handler: wl.Registry.GlobalHandler = .{ pub fn init( self: *Self, - ctx: *const wayland.Context + ctx: wayland.Context ) !void { self.* = .{ .handle = try ctx.display.registry.add_object( @@ -32,7 +32,7 @@ pub fn init( }; } -fn register(ctx: *const wayland.Context) ?wayland.Object.Ref { +fn register(ctx: wayland.Context) ?wayland.Object.Ref { const compositor = ctx.allocator.create(Self) catch return null; compositor.init(ctx) catch return null; @@ -55,7 +55,7 @@ pub fn format( pub fn create_surface( self: *Self, - ctx: *const wayland.Context + ctx: wayland.Context ) !*wl.Surface { const surface = try ctx.allocator.create(wl.Surface); errdefer ctx.allocator.destroy(surface); diff --git a/src/wl/display.zig b/src/wl/display.zig index d8b9e93..fed8bbd 100644 --- a/src/wl/display.zig +++ b/src/wl/display.zig @@ -164,7 +164,7 @@ pub fn request(self: *Self, object: anytype, args: @TypeOf(object.*).Request) !v return error.InvalidOpcode; } -fn read_event(self: *Self, ctx: *const wayland.Context) !void { +fn read_event(self: *Self, ctx: wayland.Context) !void { const endian = @import("builtin").target.cpu.arch.endian(); const reader = self.stream.reader(); @@ -192,7 +192,7 @@ fn read_event(self: *Self, ctx: *const wayland.Context) !void { } pub fn roundtrip(self: *Self, allocator: std.mem.Allocator) !void { - var context: wayland.Context = .{ + const context: wayland.Context = .{ .display = self, .allocator = allocator, }; @@ -200,21 +200,21 @@ pub fn roundtrip(self: *Self, allocator: std.mem.Allocator) !void { var done = false; var callback: wl.Callback = undefined; - try callback.init(&context, &done); - defer callback.deinit(&context); + try callback.init(context, &done); + defer callback.deinit(context); - errdefer self.read_event(&context) catch |e| { + errdefer self.read_event(context) catch |e| { log.err("cleanup error: {}", .{e}); }; while (!done) { - try self.read_event(&context); + try self.read_event(context); } } fn err( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, object: *wayland.Object, code: u32, message: []const u8, @@ -226,7 +226,7 @@ fn err( fn delete_id( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, id: u32, ) void { _ = ctx; diff --git a/src/wl/output/root.zig b/src/wl/output/root.zig index f4ca36d..61c1798 100644 --- a/src/wl/output/root.zig +++ b/src/wl/output/root.zig @@ -38,7 +38,7 @@ handle: wayland.Object.Ref, pub fn init( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, ) !void { self.* = .{ .handle = try ctx.display.registry.add_object( @@ -58,7 +58,7 @@ pub const handler: wl.Registry.GlobalHandler = .{ .handler = register, }; -fn register(ctx: *const wayland.Context) ?wayland.Object.Ref { +fn register(ctx: wayland.Context) ?wayland.Object.Ref { const output = ctx.allocator.create(Self) catch return null; output.init(ctx) catch return null; @@ -68,7 +68,7 @@ fn register(ctx: *const wayland.Context) ?wayland.Object.Ref { fn geometry( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, x: u32, y: u32, physical_width: u32, @@ -93,7 +93,7 @@ fn geometry( fn mode( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, flags: Mode.Kind, width: u32, height: u32, @@ -108,7 +108,7 @@ fn mode( }; } -fn done(self: *Self, ctx: *const wayland.Context) void { +fn done(self: *Self, ctx: wayland.Context) void { if (self.info) |info| { ctx.allocator.free(info.name); ctx.allocator.free(info.description); @@ -117,17 +117,17 @@ fn done(self: *Self, ctx: *const wayland.Context) void { self.info = self.staging; } -fn scale(self: *Self, ctx: *const wayland.Context, factor: u32) void { +fn scale(self: *Self, ctx: wayland.Context, factor: u32) void { _ = ctx; self.staging.scale = factor; } -fn name(self: *Self, ctx: *const wayland.Context, n: []const u8) !void { +fn name(self: *Self, ctx: wayland.Context, n: []const u8) !void { self.staging.name = try ctx.allocator.alloc(u8, n.len); @memcpy(@constCast(self.staging.name), n); } -fn description(self: *Self, ctx: *const wayland.Context, d: []const u8) !void { +fn description(self: *Self, ctx: wayland.Context, d: []const u8) !void { self.staging.description = try ctx.allocator.alloc(u8, d.len); @memcpy(@constCast(self.staging.description), d); } diff --git a/src/wl/registry.zig b/src/wl/registry.zig index 2c15c67..dedf89f 100644 --- a/src/wl/registry.zig +++ b/src/wl/registry.zig @@ -18,7 +18,7 @@ pub const Request = union(enum) { pub const GlobalHandler = struct { interface: []const u8, version: u32, - handler: *const fn (ctx: *const wayland.Context) ?wayland.Object.Ref, + handler: *const fn (ctx: wayland.Context) ?wayland.Object.Ref, }; objects: std.ArrayListUnmanaged(?wayland.Object) = .empty, @@ -83,7 +83,7 @@ pub fn get_by_id(self: *Self, id: u32) ?*wayland.Object { fn global( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, name: u32, interface: []const u8, version: u32, @@ -105,7 +105,7 @@ fn global( fn global_remove( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, name: u32, ) void { _ = self; diff --git a/src/wl/shm/pool.zig b/src/wl/shm/pool.zig index 40486d6..62b6c18 100644 --- a/src/wl/shm/pool.zig +++ b/src/wl/shm/pool.zig @@ -21,7 +21,7 @@ buffer: []u8, pub fn init( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, size: usize, ) !void { var file = try AnonymousFile.init_random(); @@ -38,7 +38,7 @@ pub fn init( }; } -pub fn deinit(self: *Self, ctx: *const wayland.Context) void { +pub fn deinit(self: *Self, ctx: wayland.Context) void { self.file.close(); std.posix.munmap(@alignCast(self.buffer)); ctx.display.registry.disable_object(self.handle); @@ -50,7 +50,7 @@ pub fn deinit(self: *Self, ctx: *const wayland.Context) void { pub fn create_buffer( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, offset: usize, width: usize, height: usize, diff --git a/src/wl/shm/root.zig b/src/wl/shm/root.zig index fd96727..741c7df 100644 --- a/src/wl/shm/root.zig +++ b/src/wl/shm/root.zig @@ -20,7 +20,7 @@ formats: std.EnumSet(Format) = .initEmpty(), pub fn init( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, ) !void { self.* = .{ .handle = try ctx.display.registry.add_object( @@ -30,7 +30,7 @@ pub fn init( }; } -fn announce_format(self: * Self, ctx: *const wayland.Context, fmt: Format) void { +fn announce_format(self: * Self, ctx: wayland.Context, fmt: Format) void { _ = ctx; self.formats.insert(fmt); } @@ -41,7 +41,7 @@ pub const handler: wl.Registry.GlobalHandler = .{ .handler = register, }; -fn register(ctx: *const wayland.Context) ?wayland.Object.Ref { +fn register(ctx: wayland.Context) ?wayland.Object.Ref { const shm = ctx.allocator.create(Self) catch return null; shm.init(ctx) catch return null; @@ -49,7 +49,7 @@ fn register(ctx: *const wayland.Context) ?wayland.Object.Ref { return shm.handle; } -pub fn create_pool(self: *Self, ctx: *const wayland.Context, size: usize) !*Pool { +pub fn create_pool(self: *Self, ctx: wayland.Context, size: usize) !*Pool { const pool = try ctx.allocator.create(Pool); errdefer ctx.allocator.destroy(pool); try pool.init(ctx, size); diff --git a/src/wl/surface.zig b/src/wl/surface.zig index 7b5116e..07cd80b 100644 --- a/src/wl/surface.zig +++ b/src/wl/surface.zig @@ -31,7 +31,7 @@ preferred_buffer_transform: wl.Output.Transform = .normal, pub fn init( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, ) !void { self.* = .{ .handle = try ctx.display.registry.add_object( @@ -43,14 +43,14 @@ pub fn init( pub fn deinit( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, ) void { ctx.display.registry.disable_object(self.handle); } fn enter( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, output: *wayland.Object, ) void { _ = self; @@ -61,7 +61,7 @@ fn enter( fn leave( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, output: *wayland.Object, ) void { _ = self; @@ -72,7 +72,7 @@ fn leave( fn preferred_buffer_scale_announced( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, factor: u32, ) void { _ = ctx; @@ -82,7 +82,7 @@ fn preferred_buffer_scale_announced( fn preferred_buffer_transform_announced( self: *Self, - ctx: *const wayland.Context, + ctx: wayland.Context, transform: wl.Output.Transform, ) void { _ = ctx; |