aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-04-29 12:15:54 +0100
committeremersion <contact@emersion.fr>2018-04-29 14:30:09 +0100
commit2551ef8871d78a43acbbbac765919ea4f48821f9 (patch)
treeacc9861ab6d5dde94999924fdbd58a19eba6e2a3
parenta0f490306395ac3705c00ecc85b4a0bba721886e (diff)
input-device: add output_name field, populate it from libinput
-rw-r--r--backend/libinput/events.c5
-rw-r--r--include/wlr/types/wlr_input_device.h5
-rw-r--r--types/wlr_input_device.c1
3 files changed, 9 insertions, 2 deletions
diff --git a/backend/libinput/events.c b/backend/libinput/events.c
index ace21a89..2e4b7f84 100644
--- a/backend/libinput/events.c
+++ b/backend/libinput/events.c
@@ -1,3 +1,4 @@
+#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <libinput.h>
#include <stdlib.h>
@@ -48,6 +49,10 @@ static struct wlr_input_device *allocate_device(
struct wlr_input_device *wlr_dev = &wlr_libinput_dev->wlr_input_device;
libinput_device_get_size(libinput_dev,
&wlr_dev->width_mm, &wlr_dev->height_mm);
+ const char *output_name = libinput_device_get_output_name(libinput_dev);
+ if (output_name != NULL) {
+ wlr_dev->output_name = strdup(output_name);
+ }
wl_list_insert(wlr_devices, &wlr_dev->link);
wlr_libinput_dev->handle = libinput_dev;
libinput_device_ref(libinput_dev);
diff --git a/include/wlr/types/wlr_input_device.h b/include/wlr/types/wlr_input_device.h
index d65172c1..5cf26b65 100644
--- a/include/wlr/types/wlr_input_device.h
+++ b/include/wlr/types/wlr_input_device.h
@@ -11,7 +11,7 @@ enum wlr_input_device_type {
WLR_INPUT_DEVICE_POINTER,
WLR_INPUT_DEVICE_TOUCH,
WLR_INPUT_DEVICE_TABLET_TOOL,
- WLR_INPUT_DEVICE_TABLET_PAD
+ WLR_INPUT_DEVICE_TABLET_PAD,
};
/* Note: these are circular dependencies */
@@ -27,10 +27,11 @@ struct wlr_input_device {
const struct wlr_input_device_impl *impl;
enum wlr_input_device_type type;
- int vendor, product;
+ unsigned int vendor, product;
char *name;
// Or 0 if not applicable to this device
double width_mm, height_mm;
+ char *output_name;
/* wlr_input_device.type determines which of these is valid */
union {
diff --git a/types/wlr_input_device.c b/types/wlr_input_device.c
index 713d911a..3056c0f4 100644
--- a/types/wlr_input_device.c
+++ b/types/wlr_input_device.c
@@ -56,6 +56,7 @@ void wlr_input_device_destroy(struct wlr_input_device *dev) {
}
}
free(dev->name);
+ free(dev->output_name);
if (dev->impl && dev->impl->destroy) {
dev->impl->destroy(dev);
} else {