From c7c1934b70f074bd15ca59b795aa998d8397469a Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Fri, 21 Aug 2020 19:57:10 +0200 Subject: [PATCH] Keyboard: clean up initialization --- river/Keyboard.zig | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/river/Keyboard.zig b/river/Keyboard.zig index 0054e4f..cb8dc12 100644 --- a/river/Keyboard.zig +++ b/river/Keyboard.zig @@ -29,13 +29,15 @@ seat: *Seat, wlr_input_device: *c.wlr_input_device, wlr_keyboard: *c.wlr_keyboard, -listen_key: c.wl_listener, -listen_modifiers: c.wl_listener, +listen_key: c.wl_listener = undefined, +listen_modifiers: c.wl_listener = undefined, pub fn init(self: *Self, seat: *Seat, wlr_input_device: *c.wlr_input_device) !void { - self.seat = seat; - self.wlr_input_device = wlr_input_device; - self.wlr_keyboard = @field(wlr_input_device, c.wlr_input_device_union).keyboard; + self.* = .{ + .seat = seat, + .wlr_input_device = wlr_input_device, + .wlr_keyboard = @field(wlr_input_device, c.wlr_input_device_union).keyboard, + }; // We need to prepare an XKB keymap and assign it to the keyboard. This // assumes the defaults (e.g. layout = "us").