wlroots-hyprland/types/wlr_input_device.c

30 lines
664 B
C
Raw Normal View History

2018-11-05 22:51:23 +01:00
#define _POSIX_C_SOURCE 200809L
2017-06-09 23:31:21 +02:00
#include <stdlib.h>
#include <string.h>
2018-02-12 21:29:23 +01:00
#include <wlr/types/wlr_input_device.h>
2018-02-12 19:45:58 +01:00
#include "util/signal.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,
enum wlr_input_device_type type, const char *name) {
2017-06-09 23:31:21 +02:00
dev->type = type;
dev->name = strdup(name);
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
}
void wlr_input_device_finish(struct wlr_input_device *wlr_device) {
if (!wlr_device) {
return;
}
wlr_signal_emit_safe(&wlr_device->events.destroy, wlr_device);
wl_list_remove(&wlr_device->events.destroy.listener_list);
free(wlr_device->name);
free(wlr_device->output_name);
}