mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
input-device: add output_name field, populate it from libinput
This commit is contained in:
parent
a0f4903063
commit
2551ef8871
3 changed files with 9 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue