aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput/backend.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend/libinput/backend.c')
-rw-r--r--backend/libinput/backend.c10
1 files changed, 10 insertions, 0 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;
+}