aboutsummaryrefslogtreecommitdiff
path: root/backend/x11
diff options
context:
space:
mode:
authorSimon Zeni <simon@bl4ckb0ne.ca>2022-01-28 13:55:28 -0500
committerKirill Primak <vyivel@eclair.cafe>2022-02-21 17:11:32 +0000
commita1978b1299952586a2fd016aab682c7fdbe735ee (patch)
treeee5c7b99fb792954ebc06a223303f70d123f024f /backend/x11
parent130c3bcf6361a76a889790e1907b78c607053659 (diff)
types/wlr_keyboard: add base wlr_input_device
wlr_keyboard owns its base wlr_input_device. It will be initialized when the keyboard is initialized, and finished when the keyboard is destroyed.
Diffstat (limited to 'backend/x11')
-rw-r--r--backend/x11/backend.c9
-rw-r--r--backend/x11/input_device.c7
2 files changed, 9 insertions, 7 deletions
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;
+ }
}