module: begin_expose() and content() take a non-const module pointer

This commit is contained in:
Daniel Eklöf 2018-12-19 19:03:19 +01:00
parent b579f97db7
commit 7f0f096ba4
9 changed files with 15 additions and 15 deletions

6
bar.c
View file

@ -101,21 +101,21 @@ expose(const struct bar *_bar)
struct module_expose_context ctx_left[bar->left.count];
for (size_t i = 0; i < bar->left.count; i++) {
const struct module *m = bar->left.mods[i];
struct module *m = bar->left.mods[i];
ctx_left[i] = m->begin_expose(m, bar->cairo);
left_width += bar->left_spacing + ctx_left[i].width + bar->right_spacing;
}
struct module_expose_context ctx_center[bar->center.count];
for (size_t i = 0; i < bar->center.count; i++) {
const struct module *m = bar->center.mods[i];
struct module *m = bar->center.mods[i];
ctx_center[i] = m->begin_expose(m, bar->cairo);
center_width += bar->left_spacing + ctx_center[i].width + bar->right_spacing;
}
struct module_expose_context ctx_right[bar->right.count];
for (size_t i = 0; i < bar->right.count; i++) {
const struct module *m = bar->right.mods[i];
struct module *m = bar->right.mods[i];
ctx_right[i] = m->begin_expose(m, bar->cairo);
right_width += bar->left_spacing + ctx_right[i].width + bar->right_spacing;
}

View file

@ -25,7 +25,7 @@ module_default_destroy(struct module *mod)
}
struct module_expose_context
module_default_begin_expose(const struct module *mod, cairo_t *cr)
module_default_begin_expose(struct module *mod, cairo_t *cr)
{
struct exposable *e = mod->content(mod);
return (struct module_expose_context){

View file

@ -29,8 +29,8 @@ struct module {
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);
struct exposable *(*content)(struct module *mod);
struct module_expose_context (*begin_expose)(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);
@ -42,7 +42,7 @@ struct module *module_common_new(void);
void module_default_destroy(struct module *mod);
struct module_expose_context module_default_begin_expose(
const struct module *mod, cairo_t *cr);
struct module *mod, cairo_t *cr);
void module_default_expose(
const struct module *mod,

View file

@ -49,11 +49,11 @@ destroy(struct module *mod)
}
static struct exposable *
content(const struct module *mod)
content(struct module *mod)
{
const struct private *m = mod->private;
mtx_lock(&((struct module *)mod)->lock);
mtx_lock(&mod->lock);
assert(m->state == STATE_FULL ||
m->state == STATE_CHARGING ||
@ -92,7 +92,7 @@ content(const struct module *mod)
.count = 6,
};
mtx_unlock(&((struct module *)mod)->lock);
mtx_unlock(&mod->lock);
struct exposable *exposable = m->label->instantiate(m->label, &tags);

View file

@ -21,7 +21,7 @@ destroy(struct module *mod)
}
static struct exposable *
content(const struct module *mod)
content(struct module *mod)
{
const struct private *m = mod->private;
time_t t = time(NULL);

View file

@ -397,7 +397,7 @@ destroy(struct module *mod)
}
static struct exposable *
content(const struct module *mod)
content(struct module *mod)
{
struct private *m = mod->private;

View file

@ -19,7 +19,7 @@ destroy(struct module *mod)
}
static struct exposable *
content(const struct module *mod)
content(struct module *mod)
{
const struct private *m = mod->private;
return m->label->instantiate(m->label, NULL);

View file

@ -52,7 +52,7 @@ destroy(struct module *mod)
}
static struct exposable *
content(const struct module *mod)
content(struct module *mod)
{
const struct private *m = mod->private;

View file

@ -255,7 +255,7 @@ run(struct module_run_context *ctx)
}
static struct exposable *
content(const struct module *mod)
content(struct module *mod)
{
struct private *m = mod->private;