aboutsummaryrefslogtreecommitdiff
path: root/fdm.h
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-01-04 22:26:27 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-01-04 22:26:27 +0000
commit6534f64e6a1dfa21d8d99a195122035d741f7d65 (patch)
tree29baba0c727c3c1d725253ad058d853c451ece5c /fdm.h
parentrender: throttle xcursor updates (diff)
fdm: add hook priorities
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.
Diffstat (limited to 'fdm.h')
-rw-r--r--fdm.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/fdm.h b/fdm.h
index 62f7616f..8661c580 100644
--- a/fdm.h
+++ b/fdm.h
@@ -7,6 +7,12 @@ 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);
@@ -17,7 +23,8 @@ 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);
-bool fdm_hook_del(struct fdm *fdm, fdm_hook_t hook);
+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);