aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput
diff options
context:
space:
mode:
Diffstat (limited to 'backend/libinput')
-rw-r--r--backend/libinput/backend.c10
-rw-r--r--backend/libinput/keyboard.c2
-rw-r--r--backend/libinput/pointer.c2
-rw-r--r--backend/libinput/switch.c2
-rw-r--r--backend/libinput/tablet_pad.c2
-rw-r--r--backend/libinput/tablet_tool.c2
-rw-r--r--backend/libinput/touch.c2
7 files changed, 16 insertions, 6 deletions
diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c
index 97f17244..bea999fd 100644
--- a/backend/libinput/backend.c
+++ b/backend/libinput/backend.c
@@ -233,3 +233,13 @@ struct libinput_device *wlr_libinput_get_device_handle(
uint32_t usec_to_msec(uint64_t usec) {
return (uint32_t)(usec / 1000);
}
+
+const char *get_libinput_device_name(struct libinput_device *device) {
+ // libinput guarantees that the name is non-NULL, and an empty string if
+ // unset. However wlroots uses NULL to indicate that the name is unset.
+ const char *name = libinput_device_get_name(device);
+ if (name[0] == '\0') {
+ return NULL;
+ }
+ return name;
+}
diff --git a/backend/libinput/keyboard.c b/backend/libinput/keyboard.c
index 2e5e6ef1..9cdc72af 100644
--- a/backend/libinput/keyboard.c
+++ b/backend/libinput/keyboard.c
@@ -23,7 +23,7 @@ const struct wlr_keyboard_impl libinput_keyboard_impl = {
};
void init_device_keyboard(struct wlr_libinput_input_device *dev) {
- const char *name = libinput_device_get_name(dev->handle);
+ const char *name = get_libinput_device_name(dev->handle);
struct wlr_keyboard *wlr_kb = &dev->keyboard;
wlr_keyboard_init(wlr_kb, &libinput_keyboard_impl, name);
wlr_kb->base.vendor = libinput_device_get_id_vendor(dev->handle);
diff --git a/backend/libinput/pointer.c b/backend/libinput/pointer.c
index f808e1f0..0c55695f 100644
--- a/backend/libinput/pointer.c
+++ b/backend/libinput/pointer.c
@@ -8,7 +8,7 @@ const struct wlr_pointer_impl libinput_pointer_impl = {
};
void init_device_pointer(struct wlr_libinput_input_device *dev) {
- const char *name = libinput_device_get_name(dev->handle);
+ const char *name = get_libinput_device_name(dev->handle);
struct wlr_pointer *wlr_pointer = &dev->pointer;
wlr_pointer_init(wlr_pointer, &libinput_pointer_impl, name);
wlr_pointer->base.vendor = libinput_device_get_id_vendor(dev->handle);
diff --git a/backend/libinput/switch.c b/backend/libinput/switch.c
index 61bb887f..56ad77de 100644
--- a/backend/libinput/switch.c
+++ b/backend/libinput/switch.c
@@ -8,7 +8,7 @@ const struct wlr_switch_impl libinput_switch_impl = {
};
void init_device_switch(struct wlr_libinput_input_device *dev) {
- const char *name = libinput_device_get_name(dev->handle);
+ const char *name = get_libinput_device_name(dev->handle);
struct wlr_switch *wlr_switch = &dev->switch_device;
wlr_switch_init(wlr_switch, &libinput_switch_impl, name);
wlr_switch->base.vendor = libinput_device_get_id_vendor(dev->handle);
diff --git a/backend/libinput/tablet_pad.c b/backend/libinput/tablet_pad.c
index 3cf7f142..864fcf88 100644
--- a/backend/libinput/tablet_pad.c
+++ b/backend/libinput/tablet_pad.c
@@ -90,7 +90,7 @@ group_fail:
void init_device_tablet_pad(struct wlr_libinput_input_device *dev) {
struct libinput_device *handle = dev->handle;
- const char *name = libinput_device_get_name(handle);
+ const char *name = get_libinput_device_name(handle);
struct wlr_tablet_pad *wlr_tablet_pad = &dev->tablet_pad;
wlr_tablet_pad_init(wlr_tablet_pad, &libinput_tablet_pad_impl, name);
wlr_tablet_pad->base.vendor = libinput_device_get_id_vendor(handle);
diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c
index f3266c28..9747c758 100644
--- a/backend/libinput/tablet_tool.c
+++ b/backend/libinput/tablet_tool.c
@@ -17,7 +17,7 @@ const struct wlr_tablet_impl libinput_tablet_impl = {
};
void init_device_tablet(struct wlr_libinput_input_device *dev) {
- const char *name = libinput_device_get_name(dev->handle);
+ const char *name = get_libinput_device_name(dev->handle);
struct wlr_tablet *wlr_tablet = &dev->tablet;
wlr_tablet_init(wlr_tablet, &libinput_tablet_impl, name);
wlr_tablet->base.vendor = libinput_device_get_id_vendor(dev->handle);
diff --git a/backend/libinput/touch.c b/backend/libinput/touch.c
index 14713b5b..ceb21679 100644
--- a/backend/libinput/touch.c
+++ b/backend/libinput/touch.c
@@ -8,7 +8,7 @@ const struct wlr_touch_impl libinput_touch_impl = {
};
void init_device_touch(struct wlr_libinput_input_device *dev) {
- const char *name = libinput_device_get_name(dev->handle);
+ const char *name = get_libinput_device_name(dev->handle);
struct wlr_touch *wlr_touch = &dev->touch;
wlr_touch_init(wlr_touch, &libinput_touch_impl, name);
wlr_touch->base.vendor = libinput_device_get_id_vendor(dev->handle);