diff options
Diffstat (limited to 'include/swaybar/event_loop.h')
-rw-r--r-- | include/swaybar/event_loop.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/swaybar/event_loop.h b/include/swaybar/event_loop.h new file mode 100644 index 00000000..a0cde07f --- /dev/null +++ b/include/swaybar/event_loop.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef _SWAYBAR_EVENT_LOOP_H | ||
2 | #define _SWAYBAR_EVENT_LOOP_H | ||
3 | |||
4 | #include <stdbool.h> | ||
5 | #include <time.h> | ||
6 | |||
7 | void add_event(int fd, short mask, | ||
8 | void(*cb)(int fd, short mask, void *data), | ||
9 | void *data); | ||
10 | |||
11 | // Not guaranteed to notify cb immediately | ||
12 | void add_timer(timer_t timer, | ||
13 | void(*cb)(timer_t timer, void *data), | ||
14 | void *data); | ||
15 | |||
16 | // Returns false if nothing exists, true otherwise | ||
17 | bool remove_event(int fd); | ||
18 | |||
19 | // Returns false if nothing exists, true otherwise | ||
20 | bool remove_timer(timer_t timer); | ||
21 | |||
22 | // Blocks and returns after sending callbacks | ||
23 | void event_loop_poll(); | ||
24 | |||
25 | void init_event_loop(); | ||
26 | #endif /*_SWAYBAR_EVENT_LOOP_H */ | ||