module: remove module->begin_expose()

Replace with module_begin_expose()
This commit is contained in:
Daniel Eklöf 2019-01-13 14:57:26 +01:00
parent 4c577766d1
commit 825b0a16f8
3 changed files with 6 additions and 26 deletions

6
bar.c
View file

@ -148,7 +148,7 @@ expose(const struct bar *_bar)
if (e != NULL)
e->destroy(e);
bar->left.exps[i] = m->begin_expose(m);
bar->left.exps[i] = module_begin_expose(m);
}
for (size_t i = 0; i < bar->center.count; i++) {
@ -158,7 +158,7 @@ expose(const struct bar *_bar)
if (e != NULL)
e->destroy(e);
bar->center.exps[i] = m->begin_expose(m);
bar->center.exps[i] = module_begin_expose(m);
}
for (size_t i = 0; i < bar->right.count; i++) {
@ -168,7 +168,7 @@ expose(const struct bar *_bar)
if (e != NULL)
e->destroy(e);
bar->right.exps[i] = m->begin_expose(m);
bar->right.exps[i] = module_begin_expose(m);
}
int left_width, center_width, right_width;

View file

@ -10,9 +10,7 @@ module_common_new(void)
mod->bar = NULL;
mtx_init(&mod->lock, mtx_plain);
mod->private = NULL;
mod->destroy = &module_default_destroy;
mod->begin_expose = &module_default_begin_expose;
/* No defaults for these; must be provided by implementation */
mod->run = NULL;
@ -36,7 +34,7 @@ module_signal_ready(struct module_run_context *ctx)
}
struct exposable *
module_default_begin_expose(struct module *mod)
module_begin_expose(struct module *mod)
{
struct exposable *e = mod->content(mod);
e->begin_expose(e);

View file

@ -38,7 +38,7 @@ struct module {
void (*destroy)(struct module *module);
/*
* Called by module_default_begin_expose(). Should return an
* Called by module_begin_expose(). Should return an
* exposable (an instantiated particle).
*
* You may also choose to implement begin_expose(), expose() and
@ -50,28 +50,10 @@ struct module {
/* refresh_in() should schedule a module content refresh after the
* specified number of milliseconds */
bool (*refresh_in)(struct module *mod, long milli_seconds);
/*
* Called by bar when it needs to refresh
*
* begin_expose() should return a module_expose_context, where the
* 'exposable' member is an instantiated particle, 'width' is the
* total width of the module, and 'private' is context data for
* the module (i.e. it's not touched by the bar).
*
* expose() should render the exposable
*
* end_expose() performs cleanup (destroy exposable etc)
*
* Note that for most modules, using the default implementations
* (module_default_*) is good enough. In this case, implement
* 'content()' instead (see above).
*/
struct exposable *(*begin_expose)(struct module *mod);
};
struct module *module_common_new(void);
void module_default_destroy(struct module *mod);
void module_signal_ready(struct module_run_context *ctx);
struct exposable *module_default_begin_expose(struct module *mod);
struct exposable *module_begin_expose(struct module *mod);