diff options
author | Simon Zeni <simon@bl4ckb0ne.ca> | 2022-02-09 16:14:56 -0500 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2022-02-22 14:23:46 -0500 |
commit | e279266f714c7122e9ad97d56d047313f78cfdbe (patch) | |
tree | 17b0a31f852cb41bed96d53a803ee641561624fe | |
parent | 91ba28e020092089eb9cc960530355de68c60a3d (diff) |
interfaces: remove wlr_input_device_impl
-rw-r--r-- | backend/headless/backend.c | 1 | ||||
-rw-r--r-- | backend/libinput/events.c | 3 | ||||
-rw-r--r-- | backend/wayland/backend.c | 1 | ||||
-rw-r--r-- | backend/wayland/seat.c | 3 | ||||
-rw-r--r-- | backend/wayland/tablet_v2.c | 1 | ||||
-rw-r--r-- | backend/x11/backend.c | 1 | ||||
-rw-r--r-- | backend/x11/input_device.c | 1 | ||||
-rw-r--r-- | include/wlr/interfaces/wlr_input_device.h | 36 | ||||
-rw-r--r-- | include/wlr/types/wlr_input_device.h | 17 | ||||
-rw-r--r-- | include/wlr/types/wlr_virtual_keyboard_v1.h | 3 | ||||
-rw-r--r-- | types/wlr_input_device.c | 11 | ||||
-rw-r--r-- | types/wlr_keyboard.c | 3 | ||||
-rw-r--r-- | types/wlr_pointer.c | 3 | ||||
-rw-r--r-- | types/wlr_switch.c | 4 | ||||
-rw-r--r-- | types/wlr_tablet_pad.c | 3 | ||||
-rw-r--r-- | types/wlr_tablet_tool.c | 4 | ||||
-rw-r--r-- | types/wlr_touch.c | 3 | ||||
-rw-r--r-- | types/wlr_virtual_keyboard_v1.c | 1 |
18 files changed, 27 insertions, 72 deletions
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 <assert.h> #include <stdlib.h> -#include <wlr/interfaces/wlr_input_device.h> #include <wlr/interfaces/wlr_output.h> #include <wlr/util/log.h> #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 <stdlib.h> #include <wayland-util.h> #include <wlr/backend/session.h> -#include <wlr/interfaces/wlr_input_device.h> #include <wlr/util/log.h> #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 <xf86drm.h> #include <wlr/backend/interface.h> -#include <wlr/interfaces/wlr_input_device.h> #include <wlr/interfaces/wlr_output.h> #include <wlr/util/log.h> 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 <wayland-client.h> -#include <wlr/interfaces/wlr_input_device.h> #include <wlr/interfaces/wlr_keyboard.h> #include <wlr/interfaces/wlr_output.h> #include <wlr/interfaces/wlr_pointer.h> @@ -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 <wlr/interfaces/wlr_tablet_pad.h> #include <wlr/interfaces/wlr_tablet_tool.h> #include <wlr/types/wlr_input_device.h> -#include <wlr/interfaces/wlr_input_device.h> #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 <wlr/backend/interface.h> #include <wlr/backend/x11.h> -#include <wlr/interfaces/wlr_input_device.h> #include <wlr/interfaces/wlr_keyboard.h> #include <wlr/interfaces/wlr_pointer.h> #include <wlr/util/log.h> 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 <xcb/xfixes.h> #include <xcb/xinput.h> -#include <wlr/interfaces/wlr_input_device.h> #include <wlr/interfaces/wlr_keyboard.h> #include <wlr/interfaces/wlr_pointer.h> #include <wlr/interfaces/wlr_touch.h> 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 <wlr/types/wlr_input_device.h> - -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 <wayland-server-core.h> -#include <wlr/interfaces/wlr_input_device.h> -#include <wlr/interfaces/wlr_keyboard.h> +#include <wlr/types/wlr_keyboard.h> 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 <stdlib.h> #include <string.h> #include <wayland-server-core.h> -#include <wlr/interfaces/wlr_input_device.h> #include <wlr/interfaces/wlr_keyboard.h> #include <wlr/interfaces/wlr_pointer.h> #include <wlr/interfaces/wlr_switch.h> @@ -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 <sys/mman.h> #include <unistd.h> #include <wayland-server-core.h> -#include <wlr/interfaces/wlr_input_device.h> #include <wlr/interfaces/wlr_keyboard.h> #include <wlr/types/wlr_keyboard.h> #include <wlr/util/log.h> @@ -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 <stdlib.h> #include <string.h> #include <wayland-server-core.h> -#include <wlr/interfaces/wlr_input_device.h> #include <wlr/interfaces/wlr_pointer.h> #include <wlr/types/wlr_pointer.h> 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 <stdlib.h> #include <string.h> #include <wayland-server-core.h> -#include <wlr/interfaces/wlr_input_device.h> #include <wlr/interfaces/wlr_switch.h> #include <wlr/types/wlr_switch.h> 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 <stdlib.h> #include <string.h> #include <wayland-server-core.h> -#include <wlr/interfaces/wlr_input_device.h> #include <wlr/interfaces/wlr_tablet_pad.h> #include <wlr/types/wlr_tablet_pad.h> 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 <stdlib.h> #include <string.h> #include <wayland-server-core.h> -#include <wlr/interfaces/wlr_input_device.h> #include <wlr/interfaces/wlr_tablet_tool.h> #include <wlr/types/wlr_tablet_tool.h> 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 <stdlib.h> #include <string.h> #include <wayland-server-core.h> -#include <wlr/interfaces/wlr_input_device.h> #include <wlr/interfaces/wlr_touch.h> #include <wlr/types/wlr_touch.h> 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 <stdlib.h> #include <unistd.h> #include <sys/mman.h> +#include <wlr/interfaces/wlr_keyboard.h> #include <wlr/types/wlr_seat.h> #include <wlr/types/wlr_virtual_keyboard_v1.h> #include <wlr/util/log.h> |