aboutsummaryrefslogtreecommitdiff
path: root/backend/x11
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-04-28 12:55:36 +0100
committeremersion <contact@emersion.fr>2018-04-28 12:55:36 +0100
commitf8e0a034512d4c5a69dde4f5cd02df53af216b72 (patch)
tree971e4753e41819b218c3b2cbe6890c0c0de13796 /backend/x11
parent79da4c175eca6f2db5e167a9e3c40ef343d6cd87 (diff)
backend/x11: correctly destroy input devices
Diffstat (limited to 'backend/x11')
-rw-r--r--backend/x11/backend.c4
-rw-r--r--backend/x11/input_device.c24
2 files changed, 25 insertions, 3 deletions
diff --git a/backend/x11/backend.c b/backend/x11/backend.c
index f64515ca..f14bbbe6 100644
--- a/backend/x11/backend.c
+++ b/backend/x11/backend.c
@@ -317,12 +317,12 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
wlr_input_device_init(&x11->keyboard_dev, WLR_INPUT_DEVICE_KEYBOARD,
&input_device_impl, "X11 keyboard", 0, 0);
- wlr_keyboard_init(&x11->keyboard, NULL);
+ wlr_keyboard_init(&x11->keyboard, &keyboard_impl);
x11->keyboard_dev.keyboard = &x11->keyboard;
wlr_input_device_init(&x11->pointer_dev, WLR_INPUT_DEVICE_POINTER,
&input_device_impl, "X11 pointer", 0, 0);
- wlr_pointer_init(&x11->pointer, NULL);
+ wlr_pointer_init(&x11->pointer, &pointer_impl);
x11->pointer_dev.pointer = &x11->pointer;
x11->display_destroy.notify = handle_display_destroy;
diff --git a/backend/x11/input_device.c b/backend/x11/input_device.c
index 5de5b4c2..42b703cf 100644
--- a/backend/x11/input_device.c
+++ b/backend/x11/input_device.c
@@ -136,7 +136,29 @@ void handle_x11_input_event(struct wlr_x11_backend *x11,
}
}
-const struct wlr_input_device_impl input_device_impl = { 0 };
+static void input_device_destroy(struct wlr_input_device *wlr_device) {
+ // Don't free the input device, it's on the stack
+}
+
+const struct wlr_input_device_impl input_device_impl = {
+ .destroy = input_device_destroy,
+};
+
+static void keyboard_destroy(struct wlr_keyboard *wlr_keyboard) {
+ // Don't free the keyboard, it's on the stack
+}
+
+const struct wlr_keyboard_impl keyboard_impl = {
+ .destroy = keyboard_destroy,
+};
+
+static void pointer_destroy(struct wlr_pointer *wlr_pointer) {
+ // Don't free the pointer, it's on the stack
+}
+
+const struct wlr_pointer_impl pointer_impl = {
+ .destroy = pointer_destroy,
+};
void update_x11_pointer_position(struct wlr_x11_output *output,
xcb_timestamp_t time) {