yambar/module.h
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

47 lines
1.2 KiB
C

#pragma once
#include <cairo.h>
#include "particle.h"
#include "tag.h"
struct bar;
struct module;
struct module_run_context {
struct module *module;
int abort_fd;
};
struct module_expose_context {
struct exposable *exposable;
int width;
void *private;
};
struct module {
const struct bar *bar;
void *private;
int (*run)(struct module_run_context *ctx);
void (*destroy)(struct module *module);
struct exposable *(*content)(const struct module *mod);
struct module_expose_context (*begin_expose)(const struct module *mod, cairo_t *cr);
void (*expose)(const struct module *mod,
const struct module_expose_context *ctx,
cairo_t *cr, int x, int y, int height);
void (*end_expose)(const struct module *mod, struct module_expose_context *ctx);
};
struct module_expose_context module_default_begin_expose(
const struct module *mod, cairo_t *cr);
void module_default_expose(
const struct module *mod,
const struct module_expose_context *ctx, cairo_t *cr,
int x, int y, int height);
void module_default_end_expose(
const struct module *mod, struct module_expose_context *ctx);