input-device: add output_name field, populate it from libinput
This commit is contained in:
parent
a0f4903063
commit
2551ef8871
|
@ -1,3 +1,4 @@
|
||||||
|
#define _POSIX_C_SOURCE 200809L
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <libinput.h>
|
#include <libinput.h>
|
||||||
#include <stdlib.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;
|
struct wlr_input_device *wlr_dev = &wlr_libinput_dev->wlr_input_device;
|
||||||
libinput_device_get_size(libinput_dev,
|
libinput_device_get_size(libinput_dev,
|
||||||
&wlr_dev->width_mm, &wlr_dev->height_mm);
|
&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);
|
wl_list_insert(wlr_devices, &wlr_dev->link);
|
||||||
wlr_libinput_dev->handle = libinput_dev;
|
wlr_libinput_dev->handle = libinput_dev;
|
||||||
libinput_device_ref(libinput_dev);
|
libinput_device_ref(libinput_dev);
|
||||||
|
|
|
@ -11,7 +11,7 @@ enum wlr_input_device_type {
|
||||||
WLR_INPUT_DEVICE_POINTER,
|
WLR_INPUT_DEVICE_POINTER,
|
||||||
WLR_INPUT_DEVICE_TOUCH,
|
WLR_INPUT_DEVICE_TOUCH,
|
||||||
WLR_INPUT_DEVICE_TABLET_TOOL,
|
WLR_INPUT_DEVICE_TABLET_TOOL,
|
||||||
WLR_INPUT_DEVICE_TABLET_PAD
|
WLR_INPUT_DEVICE_TABLET_PAD,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Note: these are circular dependencies */
|
/* Note: these are circular dependencies */
|
||||||
|
@ -27,10 +27,11 @@ struct wlr_input_device {
|
||||||
const struct wlr_input_device_impl *impl;
|
const struct wlr_input_device_impl *impl;
|
||||||
|
|
||||||
enum wlr_input_device_type type;
|
enum wlr_input_device_type type;
|
||||||
int vendor, product;
|
unsigned int vendor, product;
|
||||||
char *name;
|
char *name;
|
||||||
// Or 0 if not applicable to this device
|
// Or 0 if not applicable to this device
|
||||||
double width_mm, height_mm;
|
double width_mm, height_mm;
|
||||||
|
char *output_name;
|
||||||
|
|
||||||
/* wlr_input_device.type determines which of these is valid */
|
/* wlr_input_device.type determines which of these is valid */
|
||||||
union {
|
union {
|
||||||
|
|
|
@ -56,6 +56,7 @@ void wlr_input_device_destroy(struct wlr_input_device *dev) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(dev->name);
|
free(dev->name);
|
||||||
|
free(dev->output_name);
|
||||||
if (dev->impl && dev->impl->destroy) {
|
if (dev->impl && dev->impl->destroy) {
|
||||||
dev->impl->destroy(dev);
|
dev->impl->destroy(dev);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue