backend/x11: remove wlr_input_device_impl

This commit is contained in:
Simon Zeni 2022-02-08 15:32:40 -05:00
parent 1acc931cf0
commit 19f7e5d2b4
4 changed files with 13 additions and 23 deletions

View File

@ -638,7 +638,7 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
} }
#endif #endif
wlr_keyboard_init(&x11->keyboard, &keyboard_impl, "x11-keyboard"); wlr_keyboard_init(&x11->keyboard, &x11_keyboard_impl, "x11-keyboard");
x11->display_destroy.notify = handle_display_destroy; x11->display_destroy.notify = handle_display_destroy;
wl_display_add_destroy_listener(display, &x11->display_destroy); wl_display_add_destroy_listener(display, &x11->display_destroy);

View File

@ -286,19 +286,11 @@ void handle_x11_xinput_event(struct wlr_x11_backend *x11,
} }
} }
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) { static void keyboard_destroy(struct wlr_keyboard *wlr_keyboard) {
// Don't free the keyboard, it's on the stack // Don't free the keyboard, it's on the stack
} }
const struct wlr_keyboard_impl keyboard_impl = { const struct wlr_keyboard_impl x11_keyboard_impl = {
.destroy = keyboard_destroy, .destroy = keyboard_destroy,
}; };
@ -306,7 +298,7 @@ static void pointer_destroy(struct wlr_pointer *wlr_pointer) {
// Don't free the pointer, it's on the stack // Don't free the pointer, it's on the stack
} }
const struct wlr_pointer_impl pointer_impl = { const struct wlr_pointer_impl x11_pointer_impl = {
.destroy = pointer_destroy, .destroy = pointer_destroy,
}; };
@ -314,7 +306,7 @@ static void touch_destroy(struct wlr_touch *wlr_touch) {
// Don't free the touch, it's on the stack // Don't free the touch, it's on the stack
} }
const struct wlr_touch_impl touch_impl = { const struct wlr_touch_impl x11_touch_impl = {
.destroy = touch_destroy, .destroy = touch_destroy,
}; };
@ -338,12 +330,12 @@ void update_x11_pointer_position(struct wlr_x11_output *output,
bool wlr_input_device_is_x11(struct wlr_input_device *wlr_dev) { bool wlr_input_device_is_x11(struct wlr_input_device *wlr_dev) {
switch (wlr_dev->type) { switch (wlr_dev->type) {
case WLR_INPUT_DEVICE_KEYBOARD: case WLR_INPUT_DEVICE_KEYBOARD:
return wlr_dev->keyboard->impl == &keyboard_impl; return wlr_dev->keyboard->impl == &x11_keyboard_impl;
case WLR_INPUT_DEVICE_POINTER: case WLR_INPUT_DEVICE_POINTER:
return wlr_dev->pointer->impl == &pointer_impl; return wlr_dev->pointer->impl == &x11_pointer_impl;
case WLR_INPUT_DEVICE_TOUCH: case WLR_INPUT_DEVICE_TOUCH:
return wlr_dev->touch->impl == &touch_impl; return wlr_dev->touch->impl == &x11_touch_impl;
default: default:
return wlr_dev->impl == &input_device_impl; return false;
} }
} }

View File

@ -573,10 +573,10 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
wlr_output_update_enabled(wlr_output, true); wlr_output_update_enabled(wlr_output, true);
wlr_pointer_init(&output->pointer, &pointer_impl, "x11-pointer"); wlr_pointer_init(&output->pointer, &x11_pointer_impl, "x11-pointer");
output->pointer.base.output_name = strdup(wlr_output->name); output->pointer.base.output_name = strdup(wlr_output->name);
wlr_touch_init(&output->touch, &touch_impl, "x11-touch"); wlr_touch_init(&output->touch, &x11_touch_impl, "x11-touch");
output->touch.base.output_name = strdup(wlr_output->name); output->touch.base.output_name = strdup(wlr_output->name);
wl_list_init(&output->touchpoints); wl_list_init(&output->touchpoints);

View File

@ -15,7 +15,6 @@
#include <pixman.h> #include <pixman.h>
#include <wlr/backend/x11.h> #include <wlr/backend/x11.h>
#include <wlr/interfaces/wlr_input_device.h>
#include <wlr/interfaces/wlr_keyboard.h> #include <wlr/interfaces/wlr_keyboard.h>
#include <wlr/interfaces/wlr_output.h> #include <wlr/interfaces/wlr_output.h>
#include <wlr/interfaces/wlr_touch.h> #include <wlr/interfaces/wlr_touch.h>
@ -127,10 +126,9 @@ struct wlr_x11_backend *get_x11_backend_from_backend(
struct wlr_x11_output *get_x11_output_from_window_id( struct wlr_x11_output *get_x11_output_from_window_id(
struct wlr_x11_backend *x11, xcb_window_t window); struct wlr_x11_backend *x11, xcb_window_t window);
extern const struct wlr_keyboard_impl keyboard_impl; extern const struct wlr_keyboard_impl x11_keyboard_impl;
extern const struct wlr_pointer_impl pointer_impl; extern const struct wlr_pointer_impl x11_pointer_impl;
extern const struct wlr_touch_impl touch_impl; extern const struct wlr_touch_impl x11_touch_impl;
extern const struct wlr_input_device_impl input_device_impl;
void handle_x11_xinput_event(struct wlr_x11_backend *x11, void handle_x11_xinput_event(struct wlr_x11_backend *x11,
xcb_ge_generic_event_t *event); xcb_ge_generic_event_t *event);