2018-11-15 00:24:55 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2019-07-27 10:53:54 +02:00
|
|
|
#include <wayland-server-core.h>
|
2018-11-15 00:24:55 +01:00
|
|
|
#include <wlr/interfaces/wlr_switch.h>
|
|
|
|
#include <wlr/types/wlr_switch.h>
|
|
|
|
|
2019-03-19 23:41:20 +01:00
|
|
|
void wlr_switch_init(struct wlr_switch *switch_device,
|
2018-11-15 00:24:55 +01:00
|
|
|
struct wlr_switch_impl *impl) {
|
2019-03-19 23:41:20 +01:00
|
|
|
switch_device->impl = impl;
|
|
|
|
wl_signal_init(&switch_device->events.toggle);
|
2018-11-15 00:24:55 +01:00
|
|
|
}
|
|
|
|
|
2019-03-19 23:41:20 +01:00
|
|
|
void wlr_switch_destroy(struct wlr_switch *switch_device) {
|
|
|
|
if (!switch_device) {
|
2018-11-15 00:24:55 +01:00
|
|
|
return;
|
|
|
|
}
|
2019-03-19 23:41:20 +01:00
|
|
|
if (switch_device->impl && switch_device->impl->destroy) {
|
|
|
|
switch_device->impl->destroy(switch_device);
|
2018-11-15 00:24:55 +01:00
|
|
|
} else {
|
2019-03-19 23:41:20 +01:00
|
|
|
free(switch_device);
|
2018-11-15 00:24:55 +01:00
|
|
|
}
|
|
|
|
}
|