do not create uninitialized sway_keyboard

It's not good to create a uninitialized struct, because it might become
a possible error in future. I actually got hit by this while working on
https://github.com/swaywm/sway/pull/3155

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
This commit is contained in:
Konstantin Kharlamov 2018-11-25 18:16:40 +03:00
parent 827e5513e0
commit d527960f9d
2 changed files with 4 additions and 1 deletions

View file

@ -403,6 +403,7 @@ struct sway_keyboard *sway_keyboard_create(struct sway_seat *seat,
keyboard->key_repeat_source = wl_event_loop_add_timer(server.wl_event_loop,
handle_keyboard_repeat, keyboard);
sway_keyboard_configure(device->keyboard);
return keyboard;
}

View file

@ -443,10 +443,12 @@ static void seat_configure_keyboard(struct sway_seat *seat,
struct sway_seat_device *seat_device) {
if (!seat_device->keyboard) {
sway_keyboard_create(seat, seat_device);
} else {
sway_keyboard_configure(seat_device->keyboard);
}
struct wlr_keyboard *wlr_keyboard =
seat_device->input_device->wlr_device->keyboard;
sway_keyboard_configure(seat_device->keyboard);
wlr_seat_set_keyboard(seat->wlr_seat,
seat_device->input_device->wlr_device);
struct sway_node *focus = seat_get_focus(seat);