diff options
Diffstat (limited to 'backend')
-rw-r--r-- | backend/libinput/keyboard.c | 5 | ||||
-rw-r--r-- | backend/wayland/seat.c | 4 | ||||
-rw-r--r-- | backend/x11/backend.c | 9 | ||||
-rw-r--r-- | backend/x11/input_device.c | 7 |
4 files changed, 15 insertions, 10 deletions
diff --git a/backend/libinput/keyboard.c b/backend/libinput/keyboard.c index d5207f54..be5faf3e 100644 --- a/backend/libinput/keyboard.c +++ b/backend/libinput/keyboard.c @@ -49,7 +49,10 @@ struct wlr_keyboard *create_libinput_keyboard( libinput_device_ref(libinput_dev); libinput_device_led_update(libinput_dev, 0); struct wlr_keyboard *wlr_kb = &kb->wlr_keyboard; - wlr_keyboard_init(wlr_kb, &impl); + const char *name = libinput_device_get_name(libinput_dev); + wlr_keyboard_init(wlr_kb, &impl, name); + wlr_kb->base.vendor = libinput_device_get_id_vendor(libinput_dev); + wlr_kb->base.product = libinput_device_get_id_product(libinput_dev); return wlr_kb; } diff --git a/backend/wayland/seat.c b/backend/wayland/seat.c index d22d5e63..90a99950 100644 --- a/backend/wayland/seat.c +++ b/backend/wayland/seat.c @@ -785,14 +785,14 @@ void create_wl_keyboard(struct wlr_wl_seat *seat) { } struct wlr_input_device *wlr_dev = &dev->wlr_input_device; - wlr_dev->keyboard = calloc(1, sizeof(*wlr_dev->keyboard)); if (!wlr_dev->keyboard) { wlr_log_errno(WLR_ERROR, "Allocation failed"); wlr_input_device_destroy(wlr_dev); return; } - wlr_keyboard_init(wlr_dev->keyboard, NULL); + + wlr_keyboard_init(wlr_dev->keyboard, NULL, wlr_dev->name); wl_keyboard_add_listener(wl_keyboard, &keyboard_listener, wlr_dev); wlr_signal_emit_safe(&seat->backend->backend.events.new_input, wlr_dev); diff --git a/backend/x11/backend.c b/backend/x11/backend.c index 70fc0478..3f2a9f01 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -165,7 +165,7 @@ static bool backend_start(struct wlr_backend *backend) { wlr_log(WLR_INFO, "Starting X11 backend"); - wlr_signal_emit_safe(&x11->backend.events.new_input, &x11->keyboard_dev); + wlr_signal_emit_safe(&x11->backend.events.new_input, &x11->keyboard.base); for (size_t i = 0; i < x11->requested_outputs; ++i) { wlr_x11_output_create(&x11->backend); @@ -186,7 +186,7 @@ static void backend_destroy(struct wlr_backend *backend) { wlr_output_destroy(&output->wlr_output); } - wlr_input_device_destroy(&x11->keyboard_dev); + wlr_keyboard_destroy(&x11->keyboard); wlr_backend_finish(backend); @@ -638,10 +638,7 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display, } #endif - wlr_input_device_init(&x11->keyboard_dev, WLR_INPUT_DEVICE_KEYBOARD, - &input_device_impl, "X11 keyboard"); - wlr_keyboard_init(&x11->keyboard, &keyboard_impl); - x11->keyboard_dev.keyboard = &x11->keyboard; + wlr_keyboard_init(&x11->keyboard, &keyboard_impl, "x11-keyboard"); x11->display_destroy.notify = handle_display_destroy; wl_display_add_destroy_listener(display, &x11->display_destroy); diff --git a/backend/x11/input_device.c b/backend/x11/input_device.c index f9541b06..94b70524 100644 --- a/backend/x11/input_device.c +++ b/backend/x11/input_device.c @@ -336,5 +336,10 @@ void update_x11_pointer_position(struct wlr_x11_output *output, } bool wlr_input_device_is_x11(struct wlr_input_device *wlr_dev) { - return wlr_dev->impl == &input_device_impl; + switch (wlr_dev->type) { + case WLR_INPUT_DEVICE_KEYBOARD: + return wlr_dev->keyboard->impl == &keyboard_impl; + default: + return wlr_dev->impl == &input_device_impl; + } } |