Improve naming consistency

This commit is contained in:
Isaac Freund 2020-04-28 19:19:58 +02:00
parent d962e6a9a5
commit 490e79eed4
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -8,16 +8,16 @@ pub const Keyboard = struct {
const Self = @This(); const Self = @This();
seat: *Seat, seat: *Seat,
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,
listen_modifiers: c.wl_listener, listen_modifiers: c.wl_listener,
pub fn init(self: *Self, seat: *Seat, 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.seat = seat;
self.device = device; self.wlr_input_device = wlr_input_device;
self.wlr_keyboard = @field(device, c.wlr_input_device_union).keyboard; self.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").
@ -116,7 +116,7 @@ pub const Keyboard = struct {
if (!handled) { if (!handled) {
// Otherwise, we pass it along to the client. // Otherwise, we pass it along to the client.
const wlr_seat = self.seat.wlr_seat; const wlr_seat = self.seat.wlr_seat;
c.wlr_seat_set_keyboard(wlr_seat, self.device); c.wlr_seat_set_keyboard(wlr_seat, self.wlr_input_device);
c.wlr_seat_keyboard_notify_key( c.wlr_seat_keyboard_notify_key(
wlr_seat, wlr_seat,
event.time_msec, event.time_msec,
@ -135,7 +135,7 @@ pub const Keyboard = struct {
// Wayland protocol - not wlroots. We assign all connected keyboards to the // Wayland protocol - not wlroots. We assign all connected keyboards to the
// same seat. You can swap out the underlying wlr_keyboard like this and // same seat. You can swap out the underlying wlr_keyboard like this and
// wlr_seat handles this transparently. // wlr_seat handles this transparently.
c.wlr_seat_set_keyboard(self.seat.wlr_seat, self.device); c.wlr_seat_set_keyboard(self.seat.wlr_seat, self.wlr_input_device);
// Send modifiers to the client. // Send modifiers to the client.
c.wlr_seat_keyboard_notify_modifiers( c.wlr_seat_keyboard_notify_modifiers(