mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
There are now three hook priorities: low, normal, high. High priority hooks are executed *first*. Normal next, and last the low priority hooks. The renderer's terminal refresh hook now runs as a normal priority hook.
30 lines
888 B
C
30 lines
888 B
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
|
|
struct fdm;
|
|
|
|
typedef bool (*fdm_handler_t)(struct fdm *fdm, int fd, int events, void *data);
|
|
typedef void (*fdm_hook_t)(struct fdm *fdm, void *data);
|
|
|
|
enum fdm_hook_priority {
|
|
FDM_HOOK_PRIORITY_LOW,
|
|
FDM_HOOK_PRIORITY_NORMAL,
|
|
FDM_HOOK_PRIORITY_HIGH
|
|
};
|
|
|
|
struct fdm *fdm_init(void);
|
|
void fdm_destroy(struct fdm *fdm);
|
|
|
|
bool fdm_add(struct fdm *fdm, int fd, int events, fdm_handler_t handler, void *data);
|
|
bool fdm_del(struct fdm *fdm, int fd);
|
|
bool fdm_del_no_close(struct fdm *fdm, int fd);
|
|
|
|
bool fdm_event_add(struct fdm *fdm, int fd, int events);
|
|
bool fdm_event_del(struct fdm *fdm, int fd, int events);
|
|
|
|
bool fdm_hook_add(struct fdm *fdm, fdm_hook_t hook, void *data,
|
|
enum fdm_hook_priority priority);
|
|
bool fdm_hook_del(struct fdm *fdm, fdm_hook_t hook, enum fdm_hook_priority priority);
|
|
|
|
bool fdm_poll(struct fdm *fdm);
|