2018-11-05 22:51:23 +01:00
|
|
|
#define _POSIX_C_SOURCE 200809L
|
2022-03-02 22:48:57 +01:00
|
|
|
|
2017-06-09 23:31:21 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2022-03-03 15:43:38 +01:00
|
|
|
#include "interfaces/wlr_input_device.h"
|
2017-06-09 23:31:21 +02:00
|
|
|
|
2017-08-14 14:54:53 +02:00
|
|
|
void wlr_input_device_init(struct wlr_input_device *dev,
|
2022-02-09 22:14:56 +01:00
|
|
|
enum wlr_input_device_type type, const char *name) {
|
2022-04-26 09:43:54 +02:00
|
|
|
memset(dev, 0, sizeof(*dev));
|
2017-06-09 23:31:21 +02:00
|
|
|
dev->type = type;
|
|
|
|
dev->name = strdup(name);
|
2022-02-04 15:26:57 +01:00
|
|
|
dev->vendor = 0;
|
|
|
|
dev->product = 0;
|
2017-08-28 16:29:53 +02:00
|
|
|
|
|
|
|
wl_signal_init(&dev->events.destroy);
|
2017-06-09 23:31:21 +02:00
|
|
|
}
|
|
|
|
|
2022-02-08 17:20:44 +01:00
|
|
|
void wlr_input_device_finish(struct wlr_input_device *wlr_device) {
|
|
|
|
if (!wlr_device) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-08-18 13:16:16 +02:00
|
|
|
wl_signal_emit_mutable(&wlr_device->events.destroy, wlr_device);
|
2022-02-08 17:20:44 +01:00
|
|
|
|
2022-03-02 22:48:57 +01:00
|
|
|
wl_list_remove(&wlr_device->events.destroy.listener_list);
|
|
|
|
|
2022-02-08 17:20:44 +01:00
|
|
|
free(wlr_device->name);
|
|
|
|
}
|