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