Use Self = @This() in all structs

This seems to be the idiomatic way to do things.
This commit is contained in:
Isaac Freund
2020-03-24 20:48:38 +01:00
parent 45c7e27935
commit 46fe1baa96
6 changed files with 42 additions and 30 deletions

View File

@ -4,6 +4,8 @@ const c = @import("c.zig").c;
const Seat = @import("seat.zig").Seat;
pub const Keyboard = struct {
const Self = @This();
seat: *Seat,
device: *c.wlr_input_device,
wlr_keyboard: *c.wlr_keyboard,
@ -11,7 +13,7 @@ pub const Keyboard = struct {
listen_modifiers: c.wl_listener,
listen_key: c.wl_listener,
pub fn init(self: *@This(), seat: *Seat, device: *c.wlr_input_device) !void {
pub fn init(self: *Self, seat: *Seat, device: *c.wlr_input_device) !void {
self.seat = seat;
self.device = device;
self.wlr_keyboard = device.unnamed_37.keyboard;