mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-21 22:52:20 +00: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
@ -48,8 +48,6 @@ static struct wlr_input_device *allocate_device(
|
||||
struct wlr_libinput_backend *backend,
|
||||
struct libinput_device *libinput_dev, struct wl_list *wlr_devices,
|
||||
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);
|
||||
struct wlr_libinput_input_device *dev =
|
||||
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);
|
||||
dev->handle = libinput_dev;
|
||||
libinput_device_ref(libinput_dev);
|
||||
wlr_input_device_init(wlr_dev, type, &input_device_impl,
|
||||
name, vendor, product);
|
||||
wlr_input_device_init(wlr_dev, type, &input_device_impl, name);
|
||||
wlr_dev->vendor = libinput_device_get_id_vendor(libinput_dev);
|
||||
wlr_dev->product = libinput_device_get_id_product(libinput_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;
|
||||
|
||||
unsigned int vendor = 0, product = 0;
|
||||
|
||||
const char *type_name = "unknown";
|
||||
|
||||
switch (type) {
|
||||
@ -495,8 +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, &input_device_impl, name, vendor,
|
||||
product);
|
||||
wlr_input_device_init(wlr_dev, type, &input_device_impl, name);
|
||||
wl_list_insert(&seat->backend->devices, &dev->link);
|
||||
return dev;
|
||||
}
|
||||
|
@ -639,7 +639,7 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
|
||||
#endif
|
||||
|
||||
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);
|
||||
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_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);
|
||||
output->pointer_dev.pointer = &output->pointer;
|
||||
output->pointer_dev.output_name = strdup(wlr_output->name);
|
||||
|
||||
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);
|
||||
output->touch_dev.touch = &output->touch;
|
||||
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 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, int vendor, int product);
|
||||
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);
|
||||
void wlr_input_device_destroy(struct wlr_input_device *dev);
|
||||
|
||||
#endif
|
||||
|
@ -15,13 +15,12 @@
|
||||
|
||||
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, int vendor, int product) {
|
||||
const struct wlr_input_device_impl *impl, const char *name) {
|
||||
dev->type = type;
|
||||
dev->impl = impl;
|
||||
dev->name = strdup(name);
|
||||
dev->vendor = vendor;
|
||||
dev->product = product;
|
||||
dev->vendor = 0;
|
||||
dev->product = 0;
|
||||
|
||||
wl_signal_init(&dev->events.destroy);
|
||||
}
|
||||
|
@ -207,8 +207,7 @@ static void virtual_keyboard_manager_create_virtual_keyboard(
|
||||
virtual_keyboard, virtual_keyboard_destroy_resource);
|
||||
|
||||
wlr_input_device_init(&virtual_keyboard->input_device,
|
||||
WLR_INPUT_DEVICE_KEYBOARD, &input_device_impl, "virtual keyboard",
|
||||
0x0, 0x0);
|
||||
WLR_INPUT_DEVICE_KEYBOARD, &input_device_impl, "virtual keyboard");
|
||||
|
||||
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);
|
||||
|
||||
wlr_input_device_init(&virtual_pointer->input_device,
|
||||
WLR_INPUT_DEVICE_POINTER, &input_device_impl, "virtual pointer",
|
||||
0x0, 0x0);
|
||||
WLR_INPUT_DEVICE_POINTER, &input_device_impl, "virtual pointer");
|
||||
|
||||
struct wlr_virtual_pointer_v1_new_pointer_event event = {
|
||||
.new_pointer = virtual_pointer,
|
||||
|
Loading…
Reference in New Issue
Block a user