Keyboard: clean up initialization

This commit is contained in:
Isaac Freund 2020-08-21 19:57:10 +02:00
parent 163fa47822
commit c7c1934b70
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -29,13 +29,15 @@ seat: *Seat,
wlr_input_device: *c.wlr_input_device, wlr_input_device: *c.wlr_input_device,
wlr_keyboard: *c.wlr_keyboard, wlr_keyboard: *c.wlr_keyboard,
listen_key: c.wl_listener, listen_key: c.wl_listener = undefined,
listen_modifiers: c.wl_listener, listen_modifiers: c.wl_listener = undefined,
pub fn init(self: *Self, seat: *Seat, wlr_input_device: *c.wlr_input_device) !void { pub fn init(self: *Self, seat: *Seat, wlr_input_device: *c.wlr_input_device) !void {
self.seat = seat; self.* = .{
self.wlr_input_device = wlr_input_device; .seat = seat,
self.wlr_keyboard = @field(wlr_input_device, c.wlr_input_device_union).keyboard; .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 // We need to prepare an XKB keymap and assign it to the keyboard. This
// assumes the defaults (e.g. layout = "us"). // assumes the defaults (e.g. layout = "us").