input-device: add output_name field, populate it from libinput

This commit is contained in:
emersion 2018-04-29 12:15:54 +01:00
parent a0f4903063
commit 2551ef8871
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
3 changed files with 9 additions and 2 deletions

View File

@ -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);

View File

@ -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 {

View File

@ -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 {