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.
This commit is contained in:
Daniel Eklöf 2020-01-04 23:26:27 +01:00
parent 5ec447697c
commit 6534f64e6a
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 70 additions and 18 deletions

View file

@ -45,7 +45,9 @@ render_init(struct fdm *fdm, struct wayland *wayl)
.wayl = wayl,
};
if (!fdm_hook_add(fdm, &fdm_hook_refresh_pending_terminals, renderer)) {
if (!fdm_hook_add(fdm, &fdm_hook_refresh_pending_terminals, renderer,
FDM_HOOK_PRIORITY_NORMAL))
{
LOG_ERR("failed to register FDM hook");
free(renderer);
return NULL;
@ -60,7 +62,8 @@ render_destroy(struct renderer *renderer)
if (renderer == NULL)
return;
fdm_hook_del(renderer->fdm, &fdm_hook_refresh_pending_terminals);
fdm_hook_del(renderer->fdm, &fdm_hook_refresh_pending_terminals,
FDM_HOOK_PRIORITY_NORMAL);
}
static void __attribute__((destructor))