1#ifndef SWC_EVENT_H
2#define SWC_EVENT_H
3
4#include <stdint.h>
5#include <wayland-server.h>
6
7/**
8 * An event is the data passed to the listeners of the event_signals of various
9 * objects.
10 */
11struct event {
12 /**
13 * The type of event that was sent.
14 *
15 * The meaning of this field depends on the type of object containing the
16 * event_signal that passed this event.
17 */
18 uint32_t type;
19
20 /**
21 * Data specific to the event type.
22 *
23 * Unless explicitly stated in the description of the event type, this value
24 * is undefined.
25 */
26 void *data;
27};
28
29static inline void
30send_event(struct wl_signal *signal, uint32_t type, void *event_data)
31{
32 struct event event = {.type = type, .data = event_data};
33 wl_signal_emit(signal, &event);
34}
35
36#endif