yambar/module.c
Daniel Eklöf 5a155d1a8d module: add a 'private' member to expose context
This allows modules that override begin/end_context to supply their
own auxiliary data.
2018-11-17 17:14:53 +01:00

28 lines
738 B
C

#include "module.h"
#include <stdlib.h>
struct module_expose_context
module_default_begin_expose(const struct module *mod, cairo_t *cr)
{
struct exposable *e = mod->content(mod);
return (struct module_expose_context){
.exposable = e,
.width = e->begin_expose(e, cr),
.private = NULL,
};
}
void
module_default_expose(const struct module *mod,
const struct module_expose_context *ctx, cairo_t *cr,
int x, int y, int height)
{
ctx->exposable->expose(ctx->exposable, cr, x, y, height);
}
void
module_default_end_expose(const struct module *mod,
struct module_expose_context *ctx)
{
ctx->exposable->destroy(ctx->exposable);
}