mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 04:45:58 +01:00
interfaces: remove wlr_input_device_impl
This commit is contained in:
parent
91ba28e020
commit
e279266f71
18 changed files with 27 additions and 72 deletions
|
@ -1,6 +1,5 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <wlr/interfaces/wlr_input_device.h>
|
|
||||||
#include <wlr/interfaces/wlr_output.h>
|
#include <wlr/interfaces/wlr_output.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include "backend/headless.h"
|
#include "backend/headless.h"
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <wayland-util.h>
|
#include <wayland-util.h>
|
||||||
#include <wlr/backend/session.h>
|
#include <wlr/backend/session.h>
|
||||||
#include <wlr/interfaces/wlr_input_device.h>
|
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include "backend/libinput.h"
|
#include "backend/libinput.h"
|
||||||
#include "util/array.h"
|
#include "util/array.h"
|
||||||
|
@ -63,7 +62,7 @@ static struct wlr_input_device *allocate_device(
|
||||||
wl_list_insert(wlr_devices, &dev->link);
|
wl_list_insert(wlr_devices, &dev->link);
|
||||||
dev->handle = libinput_dev;
|
dev->handle = libinput_dev;
|
||||||
libinput_device_ref(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->vendor = libinput_device_get_id_vendor(libinput_dev);
|
||||||
wlr_dev->product = libinput_device_get_id_product(libinput_dev);
|
wlr_dev->product = libinput_device_get_id_product(libinput_dev);
|
||||||
return wlr_dev;
|
return wlr_dev;
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include <xf86drm.h>
|
#include <xf86drm.h>
|
||||||
|
|
||||||
#include <wlr/backend/interface.h>
|
#include <wlr/backend/interface.h>
|
||||||
#include <wlr/interfaces/wlr_input_device.h>
|
|
||||||
#include <wlr/interfaces/wlr_output.h>
|
#include <wlr/interfaces/wlr_output.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.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_pointer.h>
|
#include <wlr/interfaces/wlr_pointer.h>
|
||||||
|
@ -494,7 +493,7 @@ struct wlr_wl_input_device *create_wl_input_device(
|
||||||
char name[name_size];
|
char name[name_size];
|
||||||
(void) snprintf(name, name_size, "wayland-%s-%s", type_name, seat->name);
|
(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);
|
wl_list_insert(&seat->backend->devices, &dev->link);
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include <wlr/interfaces/wlr_tablet_pad.h>
|
#include <wlr/interfaces/wlr_tablet_pad.h>
|
||||||
#include <wlr/interfaces/wlr_tablet_tool.h>
|
#include <wlr/interfaces/wlr_tablet_tool.h>
|
||||||
#include <wlr/types/wlr_input_device.h>
|
#include <wlr/types/wlr_input_device.h>
|
||||||
#include <wlr/interfaces/wlr_input_device.h>
|
|
||||||
|
|
||||||
#include "util/signal.h"
|
#include "util/signal.h"
|
||||||
#include "util/time.h"
|
#include "util/time.h"
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
#include <wlr/backend/interface.h>
|
#include <wlr/backend/interface.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_pointer.h>
|
#include <wlr/interfaces/wlr_pointer.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include <xcb/xfixes.h>
|
#include <xcb/xfixes.h>
|
||||||
#include <xcb/xinput.h>
|
#include <xcb/xinput.h>
|
||||||
|
|
||||||
#include <wlr/interfaces/wlr_input_device.h>
|
|
||||||
#include <wlr/interfaces/wlr_keyboard.h>
|
#include <wlr/interfaces/wlr_keyboard.h>
|
||||||
#include <wlr/interfaces/wlr_pointer.h>
|
#include <wlr/interfaces/wlr_pointer.h>
|
||||||
#include <wlr/interfaces/wlr_touch.h>
|
#include <wlr/interfaces/wlr_touch.h>
|
||||||
|
|
|
@ -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
|
|
|
@ -28,8 +28,6 @@ enum wlr_input_device_type {
|
||||||
struct wlr_input_device_impl;
|
struct wlr_input_device_impl;
|
||||||
|
|
||||||
struct wlr_input_device {
|
struct wlr_input_device {
|
||||||
const struct wlr_input_device_impl *impl;
|
|
||||||
|
|
||||||
enum wlr_input_device_type type;
|
enum wlr_input_device_type type;
|
||||||
unsigned int vendor, product;
|
unsigned int vendor, product;
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -55,4 +53,19 @@ struct wlr_input_device {
|
||||||
void *data;
|
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
|
#endif
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
#define WLR_TYPES_WLR_VIRTUAL_KEYBOARD_V1_H
|
#define WLR_TYPES_WLR_VIRTUAL_KEYBOARD_V1_H
|
||||||
|
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/interfaces/wlr_input_device.h>
|
#include <wlr/types/wlr_keyboard.h>
|
||||||
#include <wlr/interfaces/wlr_keyboard.h>
|
|
||||||
|
|
||||||
struct wlr_virtual_keyboard_manager_v1 {
|
struct wlr_virtual_keyboard_manager_v1 {
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/interfaces/wlr_input_device.h>
|
|
||||||
#include <wlr/interfaces/wlr_keyboard.h>
|
#include <wlr/interfaces/wlr_keyboard.h>
|
||||||
#include <wlr/interfaces/wlr_pointer.h>
|
#include <wlr/interfaces/wlr_pointer.h>
|
||||||
#include <wlr/interfaces/wlr_switch.h>
|
#include <wlr/interfaces/wlr_switch.h>
|
||||||
|
@ -14,10 +13,8 @@
|
||||||
#include "util/signal.h"
|
#include "util/signal.h"
|
||||||
|
|
||||||
void wlr_input_device_init(struct wlr_input_device *dev,
|
void wlr_input_device_init(struct wlr_input_device *dev,
|
||||||
enum wlr_input_device_type type,
|
enum wlr_input_device_type type, const char *name) {
|
||||||
const struct wlr_input_device_impl *impl, const char *name) {
|
|
||||||
dev->type = type;
|
dev->type = type;
|
||||||
dev->impl = impl;
|
|
||||||
dev->name = strdup(name);
|
dev->name = strdup(name);
|
||||||
dev->vendor = 0;
|
dev->vendor = 0;
|
||||||
dev->product = 0;
|
dev->product = 0;
|
||||||
|
@ -64,10 +61,6 @@ void wlr_input_device_destroy(struct wlr_input_device *dev) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wlr_input_device_finish(dev);
|
wlr_input_device_finish(dev);
|
||||||
if (dev->impl && dev->impl->destroy) {
|
free(dev);
|
||||||
dev->impl->destroy(dev);
|
|
||||||
} else {
|
|
||||||
free(dev);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/interfaces/wlr_input_device.h>
|
|
||||||
#include <wlr/interfaces/wlr_keyboard.h>
|
#include <wlr/interfaces/wlr_keyboard.h>
|
||||||
#include <wlr/types/wlr_keyboard.h>
|
#include <wlr/types/wlr_keyboard.h>
|
||||||
#include <wlr/util/log.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,
|
void wlr_keyboard_init(struct wlr_keyboard *kb,
|
||||||
const struct wlr_keyboard_impl *impl, const char *name) {
|
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->base.keyboard = kb;
|
||||||
|
|
||||||
kb->impl = impl;
|
kb->impl = impl;
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/interfaces/wlr_input_device.h>
|
|
||||||
#include <wlr/interfaces/wlr_pointer.h>
|
#include <wlr/interfaces/wlr_pointer.h>
|
||||||
#include <wlr/types/wlr_pointer.h>
|
#include <wlr/types/wlr_pointer.h>
|
||||||
|
|
||||||
void wlr_pointer_init(struct wlr_pointer *pointer,
|
void wlr_pointer_init(struct wlr_pointer *pointer,
|
||||||
const struct wlr_pointer_impl *impl, const char *name) {
|
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->base.pointer = pointer;
|
||||||
|
|
||||||
pointer->impl = impl;
|
pointer->impl = impl;
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/interfaces/wlr_input_device.h>
|
|
||||||
#include <wlr/interfaces/wlr_switch.h>
|
#include <wlr/interfaces/wlr_switch.h>
|
||||||
#include <wlr/types/wlr_switch.h>
|
#include <wlr/types/wlr_switch.h>
|
||||||
|
|
||||||
void wlr_switch_init(struct wlr_switch *switch_device,
|
void wlr_switch_init(struct wlr_switch *switch_device,
|
||||||
const struct wlr_switch_impl *impl, const char *name) {
|
const struct wlr_switch_impl *impl, const char *name) {
|
||||||
wlr_input_device_init(&switch_device->base, WLR_INPUT_DEVICE_SWITCH, NULL,
|
wlr_input_device_init(&switch_device->base, WLR_INPUT_DEVICE_SWITCH, name);
|
||||||
name);
|
|
||||||
switch_device->base.switch_device = switch_device;
|
switch_device->base.switch_device = switch_device;
|
||||||
|
|
||||||
switch_device->impl = impl;
|
switch_device->impl = impl;
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/interfaces/wlr_input_device.h>
|
|
||||||
#include <wlr/interfaces/wlr_tablet_pad.h>
|
#include <wlr/interfaces/wlr_tablet_pad.h>
|
||||||
#include <wlr/types/wlr_tablet_pad.h>
|
#include <wlr/types/wlr_tablet_pad.h>
|
||||||
|
|
||||||
void wlr_tablet_pad_init(struct wlr_tablet_pad *pad,
|
void wlr_tablet_pad_init(struct wlr_tablet_pad *pad,
|
||||||
const struct wlr_tablet_pad_impl *impl, const char *name) {
|
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->base.tablet_pad = pad;
|
||||||
|
|
||||||
pad->impl = impl;
|
pad->impl = impl;
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/interfaces/wlr_input_device.h>
|
|
||||||
#include <wlr/interfaces/wlr_tablet_tool.h>
|
#include <wlr/interfaces/wlr_tablet_tool.h>
|
||||||
#include <wlr/types/wlr_tablet_tool.h>
|
#include <wlr/types/wlr_tablet_tool.h>
|
||||||
|
|
||||||
void wlr_tablet_init(struct wlr_tablet *tablet,
|
void wlr_tablet_init(struct wlr_tablet *tablet,
|
||||||
const struct wlr_tablet_impl *impl, const char *name) {
|
const struct wlr_tablet_impl *impl, const char *name) {
|
||||||
wlr_input_device_init(&tablet->base, WLR_INPUT_DEVICE_TABLET_TOOL, NULL,
|
wlr_input_device_init(&tablet->base, WLR_INPUT_DEVICE_TABLET_TOOL, name);
|
||||||
name);
|
|
||||||
tablet->base.tablet = tablet;
|
tablet->base.tablet = tablet;
|
||||||
|
|
||||||
tablet->impl = impl;
|
tablet->impl = impl;
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/interfaces/wlr_input_device.h>
|
|
||||||
#include <wlr/interfaces/wlr_touch.h>
|
#include <wlr/interfaces/wlr_touch.h>
|
||||||
#include <wlr/types/wlr_touch.h>
|
#include <wlr/types/wlr_touch.h>
|
||||||
|
|
||||||
void wlr_touch_init(struct wlr_touch *touch,
|
void wlr_touch_init(struct wlr_touch *touch,
|
||||||
const struct wlr_touch_impl *impl, const char *name) {
|
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->base.touch = touch;
|
||||||
|
|
||||||
touch->impl = impl;
|
touch->impl = impl;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#include <wlr/interfaces/wlr_keyboard.h>
|
||||||
#include <wlr/types/wlr_seat.h>
|
#include <wlr/types/wlr_seat.h>
|
||||||
#include <wlr/types/wlr_virtual_keyboard_v1.h>
|
#include <wlr/types/wlr_virtual_keyboard_v1.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
|
Loading…
Reference in a new issue