#pragma once #include "hash.h" #include "vec.h" #include "window.h" #include "wlstate.h" enum event_kind_e { EVENT_KIND_CLOSE, }; struct event_s { enum event_kind_e kind; struct window_s *window; }; #define WAYC_EVENT_INIT(kind, window) {kind, window} #define WAYC_EVENT_CLOSE(window) WAYC_EVENT_INIT(EVENT_KIND_CLOSE, window) struct eventloop_s; typedef void (*event_handler_t)(struct eventloop_s *loop, struct event_s *event); struct eventloop_s { window_id_t winid; struct wlstate_s state; struct vec_s events; struct hashmap_s windows; event_handler_t handler; bool running; }; bool wayc_eventloop_init(struct eventloop_s *loop, event_handler_t handler); void wayc_eventloop_deinit(struct eventloop_s *loop); window_id_t wayc_eventloop_register(struct eventloop_s *loop, struct window_s *window); void wayc_eventloop_unregister(struct eventloop_s *loop, window_id_t winid); bool wayc_eventloop_running(struct eventloop_s *loop); void wayc_eventloop_update(struct eventloop_s *loop);