mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-29 07:55:59 +01:00
types/wlr_input_device: default vendor and product id to 0
vendor and product id are set when needed by the libinput backend
This commit is contained in:
parent
7d560df90e
commit
71577e351e
8 changed files with 15 additions and 24 deletions
|
@ -48,8 +48,6 @@ static struct wlr_input_device *allocate_device(
|
||||||
struct wlr_libinput_backend *backend,
|
struct wlr_libinput_backend *backend,
|
||||||
struct libinput_device *libinput_dev, struct wl_list *wlr_devices,
|
struct libinput_device *libinput_dev, struct wl_list *wlr_devices,
|
||||||
enum wlr_input_device_type type) {
|
enum wlr_input_device_type type) {
|
||||||
int vendor = libinput_device_get_id_vendor(libinput_dev);
|
|
||||||
int product = libinput_device_get_id_product(libinput_dev);
|
|
||||||
const char *name = libinput_device_get_name(libinput_dev);
|
const char *name = libinput_device_get_name(libinput_dev);
|
||||||
struct wlr_libinput_input_device *dev =
|
struct wlr_libinput_input_device *dev =
|
||||||
calloc(1, sizeof(struct wlr_libinput_input_device));
|
calloc(1, sizeof(struct wlr_libinput_input_device));
|
||||||
|
@ -66,8 +64,9 @@ 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, &input_device_impl,
|
wlr_input_device_init(wlr_dev, type, &input_device_impl, name);
|
||||||
name, vendor, product);
|
wlr_dev->vendor = libinput_device_get_id_vendor(libinput_dev);
|
||||||
|
wlr_dev->product = libinput_device_get_id_product(libinput_dev);
|
||||||
return wlr_dev;
|
return wlr_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -466,8 +466,6 @@ struct wlr_wl_input_device *create_wl_input_device(
|
||||||
|
|
||||||
struct wlr_input_device *wlr_dev = &dev->wlr_input_device;
|
struct wlr_input_device *wlr_dev = &dev->wlr_input_device;
|
||||||
|
|
||||||
unsigned int vendor = 0, product = 0;
|
|
||||||
|
|
||||||
const char *type_name = "unknown";
|
const char *type_name = "unknown";
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -495,8 +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, &input_device_impl, name, vendor,
|
wlr_input_device_init(wlr_dev, type, &input_device_impl, name);
|
||||||
product);
|
|
||||||
wl_list_insert(&seat->backend->devices, &dev->link);
|
wl_list_insert(&seat->backend->devices, &dev->link);
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
|
@ -639,7 +639,7 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wlr_input_device_init(&x11->keyboard_dev, WLR_INPUT_DEVICE_KEYBOARD,
|
wlr_input_device_init(&x11->keyboard_dev, WLR_INPUT_DEVICE_KEYBOARD,
|
||||||
&input_device_impl, "X11 keyboard", 0, 0);
|
&input_device_impl, "X11 keyboard");
|
||||||
wlr_keyboard_init(&x11->keyboard, &keyboard_impl);
|
wlr_keyboard_init(&x11->keyboard, &keyboard_impl);
|
||||||
x11->keyboard_dev.keyboard = &x11->keyboard;
|
x11->keyboard_dev.keyboard = &x11->keyboard;
|
||||||
|
|
||||||
|
|
|
@ -574,13 +574,13 @@ 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_input_device_init(&output->pointer_dev, WLR_INPUT_DEVICE_POINTER,
|
wlr_input_device_init(&output->pointer_dev, WLR_INPUT_DEVICE_POINTER,
|
||||||
&input_device_impl, "X11 pointer", 0, 0);
|
&input_device_impl, "X11 pointer");
|
||||||
wlr_pointer_init(&output->pointer, &pointer_impl);
|
wlr_pointer_init(&output->pointer, &pointer_impl);
|
||||||
output->pointer_dev.pointer = &output->pointer;
|
output->pointer_dev.pointer = &output->pointer;
|
||||||
output->pointer_dev.output_name = strdup(wlr_output->name);
|
output->pointer_dev.output_name = strdup(wlr_output->name);
|
||||||
|
|
||||||
wlr_input_device_init(&output->touch_dev, WLR_INPUT_DEVICE_TOUCH,
|
wlr_input_device_init(&output->touch_dev, WLR_INPUT_DEVICE_TOUCH,
|
||||||
&input_device_impl, "X11 touch", 0, 0);
|
&input_device_impl, "X11 touch");
|
||||||
wlr_touch_init(&output->touch, &touch_impl);
|
wlr_touch_init(&output->touch, &touch_impl);
|
||||||
output->touch_dev.touch = &output->touch;
|
output->touch_dev.touch = &output->touch;
|
||||||
output->touch_dev.output_name = strdup(wlr_output->name);
|
output->touch_dev.output_name = strdup(wlr_output->name);
|
||||||
|
|
|
@ -15,11 +15,9 @@ struct wlr_input_device_impl {
|
||||||
void (*destroy)(struct wlr_input_device *wlr_device);
|
void (*destroy)(struct wlr_input_device *wlr_device);
|
||||||
};
|
};
|
||||||
|
|
||||||
void wlr_input_device_init(
|
void wlr_input_device_init(struct wlr_input_device *wlr_device,
|
||||||
struct wlr_input_device *wlr_device,
|
enum wlr_input_device_type type, const struct wlr_input_device_impl *impl,
|
||||||
enum wlr_input_device_type type,
|
const char *name);
|
||||||
const struct wlr_input_device_impl *impl,
|
|
||||||
const char *name, int vendor, int product);
|
|
||||||
void wlr_input_device_destroy(struct wlr_input_device *dev);
|
void wlr_input_device_destroy(struct wlr_input_device *dev);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,13 +15,12 @@
|
||||||
|
|
||||||
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 struct wlr_input_device_impl *impl,
|
const struct wlr_input_device_impl *impl, const char *name) {
|
||||||
const char *name, int vendor, int product) {
|
|
||||||
dev->type = type;
|
dev->type = type;
|
||||||
dev->impl = impl;
|
dev->impl = impl;
|
||||||
dev->name = strdup(name);
|
dev->name = strdup(name);
|
||||||
dev->vendor = vendor;
|
dev->vendor = 0;
|
||||||
dev->product = product;
|
dev->product = 0;
|
||||||
|
|
||||||
wl_signal_init(&dev->events.destroy);
|
wl_signal_init(&dev->events.destroy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,8 +207,7 @@ static void virtual_keyboard_manager_create_virtual_keyboard(
|
||||||
virtual_keyboard, virtual_keyboard_destroy_resource);
|
virtual_keyboard, virtual_keyboard_destroy_resource);
|
||||||
|
|
||||||
wlr_input_device_init(&virtual_keyboard->input_device,
|
wlr_input_device_init(&virtual_keyboard->input_device,
|
||||||
WLR_INPUT_DEVICE_KEYBOARD, &input_device_impl, "virtual keyboard",
|
WLR_INPUT_DEVICE_KEYBOARD, &input_device_impl, "virtual keyboard");
|
||||||
0x0, 0x0);
|
|
||||||
|
|
||||||
struct wlr_seat_client *seat_client = wlr_seat_client_from_resource(seat);
|
struct wlr_seat_client *seat_client = wlr_seat_client_from_resource(seat);
|
||||||
|
|
||||||
|
|
|
@ -270,8 +270,7 @@ static void virtual_pointer_manager_create_virtual_pointer_with_output(
|
||||||
virtual_pointer, virtual_pointer_destroy_resource);
|
virtual_pointer, virtual_pointer_destroy_resource);
|
||||||
|
|
||||||
wlr_input_device_init(&virtual_pointer->input_device,
|
wlr_input_device_init(&virtual_pointer->input_device,
|
||||||
WLR_INPUT_DEVICE_POINTER, &input_device_impl, "virtual pointer",
|
WLR_INPUT_DEVICE_POINTER, &input_device_impl, "virtual pointer");
|
||||||
0x0, 0x0);
|
|
||||||
|
|
||||||
struct wlr_virtual_pointer_v1_new_pointer_event event = {
|
struct wlr_virtual_pointer_v1_new_pointer_event event = {
|
||||||
.new_pointer = virtual_pointer,
|
.new_pointer = virtual_pointer,
|
||||||
|
|
Loading…
Reference in a new issue