mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-12-16 08:56:26 -05:00
Handle input device removal
This commit is contained in:
parent
efadbf8424
commit
10240af6ea
4 changed files with 21 additions and 2 deletions
|
|
@ -42,6 +42,7 @@ static void keyboard_key_notify(struct wl_listener *listener, void *data) {
|
|||
|
||||
void keyboard_add(struct wlr_input_device *device, struct roots_input *input) {
|
||||
struct roots_keyboard *keyboard = calloc(sizeof(struct roots_keyboard), 1);
|
||||
device->data = keyboard;
|
||||
keyboard->device = device;
|
||||
keyboard->input = input;
|
||||
wl_list_init(&keyboard->key.link);
|
||||
|
|
@ -64,3 +65,11 @@ void keyboard_add(struct wlr_input_device *device, struct roots_input *input) {
|
|||
xkb_context_unref(context);
|
||||
wlr_seat_attach_keyboard(input->wl_seat, device);
|
||||
}
|
||||
|
||||
void keyboard_remove(struct wlr_input_device *device, struct roots_input *input) {
|
||||
struct roots_keyboard *keyboard = device->data;
|
||||
wlr_seat_detach_keyboard(input->wl_seat, device->keyboard);
|
||||
wl_list_remove(&keyboard->key.link);
|
||||
wl_list_remove(&keyboard->link);
|
||||
free(keyboard);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue