aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Zeni <simon@bl4ckb0ne.ca>2022-02-04 09:26:57 -0500
committerKirill Primak <vyivel@eclair.cafe>2022-02-21 17:11:32 +0000
commit71577e351e7954467e2376ac7bb92edc4ce53159 (patch)
tree5251a9b8bdac59973d28f08892920ad02e05600c
parent7d560df90e7ee684dc26306f44a0b3c7f8cf2702 (diff)
types/wlr_input_device: default vendor and product id to 0
vendor and product id are set when needed by the libinput backend
-rw-r--r--backend/libinput/events.c7
-rw-r--r--backend/wayland/seat.c5
-rw-r--r--backend/x11/backend.c2
-rw-r--r--backend/x11/output.c4
-rw-r--r--include/wlr/interfaces/wlr_input_device.h8
-rw-r--r--types/wlr_input_device.c7
-rw-r--r--types/wlr_virtual_keyboard_v1.c3
-rw-r--r--types/wlr_virtual_pointer_v1.c3
8 files changed, 15 insertions, 24 deletions
diff --git a/backend/libinput/events.c b/backend/libinput/events.c
index 67598998..1f28b94a 100644
--- a/backend/libinput/events.c
+++ b/backend/libinput/events.c
@@ -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;
}
diff --git a/backend/wayland/seat.c b/backend/wayland/seat.c
index 76c25fe5..d22d5e63 100644
--- a/backend/wayland/seat.c
+++ b/backend/wayland/seat.c
@@ -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;
}
diff --git a/backend/x11/backend.c b/backend/x11/backend.c
index ae20559c..70fc0478 100644
--- a/backend/x11/backend.c
+++ b/backend/x11/backend.c
@@ -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;
diff --git a/backend/x11/output.c b/backend/x11/output.c
index b87b08dc..d500795f 100644
--- a/backend/x11/output.c
+++ b/backend/x11/output.c
@@ -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);
diff --git a/include/wlr/interfaces/wlr_input_device.h b/include/wlr/interfaces/wlr_input_device.h
index 05248bf6..04d5644f 100644
--- a/include/wlr/interfaces/wlr_input_device.h
+++ b/include/wlr/interfaces/wlr_input_device.h
@@ -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
diff --git a/types/wlr_input_device.c b/types/wlr_input_device.c
index 1364aa3d..7f9654e5 100644
--- a/types/wlr_input_device.c
+++ b/types/wlr_input_device.c
@@ -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);
}
diff --git a/types/wlr_virtual_keyboard_v1.c b/types/wlr_virtual_keyboard_v1.c
index db643ef3..3b195ab3 100644
--- a/types/wlr_virtual_keyboard_v1.c
+++ b/types/wlr_virtual_keyboard_v1.c
@@ -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);
diff --git a/types/wlr_virtual_pointer_v1.c b/types/wlr_virtual_pointer_v1.c
index a9d1fd7b..bb1b31dd 100644
--- a/types/wlr_virtual_pointer_v1.c
+++ b/types/wlr_virtual_pointer_v1.c
@@ -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,