diff --git a/backend/headless/backend.c b/backend/headless/backend.c index e44595de..b14dda4a 100644 --- a/backend/headless/backend.c +++ b/backend/headless/backend.c @@ -1,6 +1,5 @@ #include #include -#include #include #include #include "backend/headless.h" diff --git a/backend/libinput/events.c b/backend/libinput/events.c index 67ca49d5..e8d99f25 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -4,7 +4,6 @@ #include #include #include -#include #include #include "backend/libinput.h" #include "util/array.h" @@ -63,7 +62,7 @@ static struct wlr_input_device *allocate_device( wl_list_insert(wlr_devices, &dev->link); dev->handle = libinput_dev; libinput_device_ref(libinput_dev); - wlr_input_device_init(wlr_dev, type, NULL, name); + wlr_input_device_init(wlr_dev, type, name); wlr_dev->vendor = libinput_device_get_id_vendor(libinput_dev); wlr_dev->product = libinput_device_get_id_product(libinput_dev); return wlr_dev; diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index a5b297ba..c0e99a22 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -13,7 +13,6 @@ #include #include -#include #include #include diff --git a/backend/wayland/seat.c b/backend/wayland/seat.c index ae669c4d..28466bb3 100644 --- a/backend/wayland/seat.c +++ b/backend/wayland/seat.c @@ -9,7 +9,6 @@ #include -#include #include #include #include @@ -494,7 +493,7 @@ struct wlr_wl_input_device *create_wl_input_device( char name[name_size]; (void) snprintf(name, name_size, "wayland-%s-%s", type_name, seat->name); - wlr_input_device_init(wlr_dev, type, NULL, name); + wlr_input_device_init(wlr_dev, type, name); wl_list_insert(&seat->backend->devices, &dev->link); return dev; } diff --git a/backend/wayland/tablet_v2.c b/backend/wayland/tablet_v2.c index d24bf340..95cdd119 100644 --- a/backend/wayland/tablet_v2.c +++ b/backend/wayland/tablet_v2.c @@ -10,7 +10,6 @@ #include #include #include -#include #include "util/signal.h" #include "util/time.h" diff --git a/backend/x11/backend.c b/backend/x11/backend.c index dbee4379..64bcf475 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -24,7 +24,6 @@ #include #include -#include #include #include #include diff --git a/backend/x11/input_device.c b/backend/x11/input_device.c index a2d7ef53..f87f53a0 100644 --- a/backend/x11/input_device.c +++ b/backend/x11/input_device.c @@ -10,7 +10,6 @@ #include #include -#include #include #include #include diff --git a/include/wlr/interfaces/wlr_input_device.h b/include/wlr/interfaces/wlr_input_device.h deleted file mode 100644 index ab314807..00000000 --- a/include/wlr/interfaces/wlr_input_device.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This an unstable interface of wlroots. No guarantees are made regarding the - * future consistency of this API. - */ -#ifndef WLR_USE_UNSTABLE -#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" -#endif - -#ifndef WLR_INTERFACES_WLR_INPUT_DEVICE_H -#define WLR_INTERFACES_WLR_INPUT_DEVICE_H - -#include - -struct wlr_input_device_impl { - void (*destroy)(struct wlr_input_device *wlr_device); -}; - -void wlr_input_device_init(struct wlr_input_device *wlr_device, - enum wlr_input_device_type type, const struct wlr_input_device_impl *impl, - const char *name); - -/** - * Cleans up all of the provided wlr_input_device resources and signals the - * destroy event. - */ -void wlr_input_device_finish(struct wlr_input_device *wlr_device); - -/** - * Calls the specialized input device destroy function. - * If the wlr_input_device is not owned by a specialized input device, the - * function will finish the wlr_input_device, and either call its implementation - * destroy function if one has been given, or free the wlr_input_device. - */ -void wlr_input_device_destroy(struct wlr_input_device *dev); - -#endif diff --git a/include/wlr/types/wlr_input_device.h b/include/wlr/types/wlr_input_device.h index cbc877df..1690a5b9 100644 --- a/include/wlr/types/wlr_input_device.h +++ b/include/wlr/types/wlr_input_device.h @@ -28,8 +28,6 @@ enum wlr_input_device_type { struct wlr_input_device_impl; struct wlr_input_device { - const struct wlr_input_device_impl *impl; - enum wlr_input_device_type type; unsigned int vendor, product; char *name; @@ -55,4 +53,19 @@ struct wlr_input_device { void *data; }; +void wlr_input_device_init(struct wlr_input_device *wlr_device, + enum wlr_input_device_type type, const char *name); + +/** + * Clean up all of the provided wlr_input_device resources + */ +void wlr_input_device_finish(struct wlr_input_device *wlr_device); + +/** + * Calls the specialized input device destroy function. + * If the wlr_input_device is not owned by a specialized input device, the + * function will finish the wlr_input_device and free it. + */ +void wlr_input_device_destroy(struct wlr_input_device *dev); + #endif diff --git a/include/wlr/types/wlr_virtual_keyboard_v1.h b/include/wlr/types/wlr_virtual_keyboard_v1.h index 8be6158d..a818f141 100644 --- a/include/wlr/types/wlr_virtual_keyboard_v1.h +++ b/include/wlr/types/wlr_virtual_keyboard_v1.h @@ -10,8 +10,7 @@ #define WLR_TYPES_WLR_VIRTUAL_KEYBOARD_V1_H #include -#include -#include +#include struct wlr_virtual_keyboard_manager_v1 { struct wl_global *global; diff --git a/types/wlr_input_device.c b/types/wlr_input_device.c index 8056556b..6897febe 100644 --- a/types/wlr_input_device.c +++ b/types/wlr_input_device.c @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include @@ -14,10 +13,8 @@ #include "util/signal.h" void wlr_input_device_init(struct wlr_input_device *dev, - enum wlr_input_device_type type, - const struct wlr_input_device_impl *impl, const char *name) { + enum wlr_input_device_type type, const char *name) { dev->type = type; - dev->impl = impl; dev->name = strdup(name); dev->vendor = 0; dev->product = 0; @@ -64,10 +61,6 @@ void wlr_input_device_destroy(struct wlr_input_device *dev) { } } else { wlr_input_device_finish(dev); - if (dev->impl && dev->impl->destroy) { - dev->impl->destroy(dev); - } else { - free(dev); - } + free(dev); } } diff --git a/types/wlr_keyboard.c b/types/wlr_keyboard.c index 062c08a0..afa689b1 100644 --- a/types/wlr_keyboard.c +++ b/types/wlr_keyboard.c @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include @@ -116,7 +115,7 @@ void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard, void wlr_keyboard_init(struct wlr_keyboard *kb, const struct wlr_keyboard_impl *impl, const char *name) { - wlr_input_device_init(&kb->base, WLR_INPUT_DEVICE_KEYBOARD, NULL, name); + wlr_input_device_init(&kb->base, WLR_INPUT_DEVICE_KEYBOARD, name); kb->base.keyboard = kb; kb->impl = impl; diff --git a/types/wlr_pointer.c b/types/wlr_pointer.c index d6237c73..caabec1b 100644 --- a/types/wlr_pointer.c +++ b/types/wlr_pointer.c @@ -1,13 +1,12 @@ #include #include #include -#include #include #include void wlr_pointer_init(struct wlr_pointer *pointer, const struct wlr_pointer_impl *impl, const char *name) { - wlr_input_device_init(&pointer->base, WLR_INPUT_DEVICE_POINTER, NULL, name); + wlr_input_device_init(&pointer->base, WLR_INPUT_DEVICE_POINTER, name); pointer->base.pointer = pointer; pointer->impl = impl; diff --git a/types/wlr_switch.c b/types/wlr_switch.c index 629fa5ee..42611da9 100644 --- a/types/wlr_switch.c +++ b/types/wlr_switch.c @@ -1,14 +1,12 @@ #include #include #include -#include #include #include void wlr_switch_init(struct wlr_switch *switch_device, const struct wlr_switch_impl *impl, const char *name) { - wlr_input_device_init(&switch_device->base, WLR_INPUT_DEVICE_SWITCH, NULL, - name); + wlr_input_device_init(&switch_device->base, WLR_INPUT_DEVICE_SWITCH, name); switch_device->base.switch_device = switch_device; switch_device->impl = impl; diff --git a/types/wlr_tablet_pad.c b/types/wlr_tablet_pad.c index 861d1add..663ccd39 100644 --- a/types/wlr_tablet_pad.c +++ b/types/wlr_tablet_pad.c @@ -1,13 +1,12 @@ #include #include #include -#include #include #include void wlr_tablet_pad_init(struct wlr_tablet_pad *pad, const struct wlr_tablet_pad_impl *impl, const char *name) { - wlr_input_device_init(&pad->base, WLR_INPUT_DEVICE_TABLET_PAD, NULL, name); + wlr_input_device_init(&pad->base, WLR_INPUT_DEVICE_TABLET_PAD, name); pad->base.tablet_pad = pad; pad->impl = impl; diff --git a/types/wlr_tablet_tool.c b/types/wlr_tablet_tool.c index 12278e93..e50d29d1 100644 --- a/types/wlr_tablet_tool.c +++ b/types/wlr_tablet_tool.c @@ -1,14 +1,12 @@ #include #include #include -#include #include #include void wlr_tablet_init(struct wlr_tablet *tablet, const struct wlr_tablet_impl *impl, const char *name) { - wlr_input_device_init(&tablet->base, WLR_INPUT_DEVICE_TABLET_TOOL, NULL, - name); + wlr_input_device_init(&tablet->base, WLR_INPUT_DEVICE_TABLET_TOOL, name); tablet->base.tablet = tablet; tablet->impl = impl; diff --git a/types/wlr_touch.c b/types/wlr_touch.c index a0949933..36619110 100644 --- a/types/wlr_touch.c +++ b/types/wlr_touch.c @@ -1,13 +1,12 @@ #include #include #include -#include #include #include void wlr_touch_init(struct wlr_touch *touch, const struct wlr_touch_impl *impl, const char *name) { - wlr_input_device_init(&touch->base, WLR_INPUT_DEVICE_TOUCH, NULL, name); + wlr_input_device_init(&touch->base, WLR_INPUT_DEVICE_TOUCH, name); touch->base.touch = touch; touch->impl = impl; diff --git a/types/wlr_virtual_keyboard_v1.c b/types/wlr_virtual_keyboard_v1.c index dc549aa7..07eeb367 100644 --- a/types/wlr_virtual_keyboard_v1.c +++ b/types/wlr_virtual_keyboard_v1.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include