mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-23 20:35:42 +02:00
module/particle: remove cairo context from begin_expose()
This commit is contained in:
parent
f6977417e0
commit
558f75a54b
10 changed files with 19 additions and 19 deletions
6
bar.c
6
bar.c
|
@ -147,7 +147,7 @@ expose(const struct bar *_bar)
|
|||
if (e->exposable != NULL)
|
||||
m->end_expose(m, e);
|
||||
|
||||
*e = m->begin_expose(m, bar->cairo);
|
||||
*e = m->begin_expose(m);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < bar->center.count; i++) {
|
||||
|
@ -157,7 +157,7 @@ expose(const struct bar *_bar)
|
|||
if (e->exposable != NULL)
|
||||
m->end_expose(m, e);
|
||||
|
||||
*e = m->begin_expose(m, bar->cairo);
|
||||
*e = m->begin_expose(m);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < bar->right.count; i++) {
|
||||
|
@ -167,7 +167,7 @@ expose(const struct bar *_bar)
|
|||
if (e->exposable != NULL)
|
||||
m->end_expose(m, e);
|
||||
|
||||
*e = m->begin_expose(m, bar->cairo);
|
||||
*e = m->begin_expose(m);
|
||||
}
|
||||
|
||||
int left_width, center_width, right_width;
|
||||
|
|
4
module.c
4
module.c
|
@ -38,12 +38,12 @@ module_signal_ready(struct module_run_context *ctx)
|
|||
}
|
||||
|
||||
struct module_expose_context
|
||||
module_default_begin_expose(struct module *mod, cairo_t *cr)
|
||||
module_default_begin_expose(struct module *mod)
|
||||
{
|
||||
struct exposable *e = mod->content(mod);
|
||||
return (struct module_expose_context){
|
||||
.exposable = e,
|
||||
.width = e->begin_expose(e, cr),
|
||||
.width = e->begin_expose(e),
|
||||
.private = NULL,
|
||||
};
|
||||
}
|
||||
|
|
4
module.h
4
module.h
|
@ -60,7 +60,7 @@ struct module {
|
|||
* (module_default_*) is good enough. In this case, implement
|
||||
* 'content()' instead (see above).
|
||||
*/
|
||||
struct module_expose_context (*begin_expose)(struct module *mod, cairo_t *cr);
|
||||
struct module_expose_context (*begin_expose)(struct module *mod);
|
||||
void (*expose)(const struct module *mod,
|
||||
const struct module_expose_context *ctx,
|
||||
cairo_t *cr, int x, int y, int height);
|
||||
|
@ -74,7 +74,7 @@ void module_signal_ready(struct module_run_context *ctx);
|
|||
void module_default_destroy(struct module *mod);
|
||||
|
||||
struct module_expose_context module_default_begin_expose(
|
||||
struct module *mod, cairo_t *cr);
|
||||
struct module *mod);
|
||||
|
||||
void module_default_expose(
|
||||
const struct module *mod,
|
||||
|
|
|
@ -35,7 +35,7 @@ struct exposable {
|
|||
char *on_click;
|
||||
|
||||
void (*destroy)(struct exposable *exposable);
|
||||
int (*begin_expose)(struct exposable *exposable, cairo_t *cr);
|
||||
int (*begin_expose)(struct exposable *exposable);
|
||||
void (*expose)(const struct exposable *exposable, cairo_t *cr,
|
||||
int x, int y, int height);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ dynlist_destroy(struct exposable *exposable)
|
|||
}
|
||||
|
||||
static int
|
||||
dynlist_begin_expose(struct exposable *exposable, cairo_t *cr)
|
||||
dynlist_begin_expose(struct exposable *exposable)
|
||||
{
|
||||
const struct private *e = exposable->private;
|
||||
|
||||
|
@ -38,7 +38,7 @@ dynlist_begin_expose(struct exposable *exposable, cairo_t *cr)
|
|||
|
||||
for (size_t i = 0; i < e->count; i++) {
|
||||
struct exposable *ee = e->exposables[i];
|
||||
e->widths[i] = ee->begin_expose(ee, cr);
|
||||
e->widths[i] = ee->begin_expose(ee);
|
||||
|
||||
exposable->width += e->left_spacing + e->widths[i] + e->right_spacing;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
static int
|
||||
begin_expose(struct exposable *exposable, cairo_t *cr)
|
||||
begin_expose(struct exposable *exposable)
|
||||
{
|
||||
exposable->width = exposable->particle->left_margin +
|
||||
exposable->particle->right_margin;
|
||||
|
|
|
@ -33,7 +33,7 @@ exposable_destroy(struct exposable *exposable)
|
|||
}
|
||||
|
||||
static int
|
||||
begin_expose(struct exposable *exposable, cairo_t *cr)
|
||||
begin_expose(struct exposable *exposable)
|
||||
{
|
||||
const struct eprivate *e = exposable->private;
|
||||
|
||||
|
@ -41,7 +41,7 @@ begin_expose(struct exposable *exposable, cairo_t *cr)
|
|||
|
||||
for (size_t i = 0; i < e->count; i++) {
|
||||
struct exposable *ee = e->exposables[i];
|
||||
e->widths[i] = ee->begin_expose(ee, cr);
|
||||
e->widths[i] = ee->begin_expose(ee);
|
||||
|
||||
exposable->width += e->left_spacing + e->widths[i] + e->right_spacing;
|
||||
}
|
||||
|
|
|
@ -26,13 +26,13 @@ exposable_destroy(struct exposable *exposable)
|
|||
}
|
||||
|
||||
static int
|
||||
begin_expose(struct exposable *exposable, cairo_t *cr)
|
||||
begin_expose(struct exposable *exposable)
|
||||
{
|
||||
struct eprivate *e = exposable->private;
|
||||
|
||||
exposable->width = (
|
||||
exposable->particle->left_margin +
|
||||
e->exposable->begin_expose(e->exposable, cr) +
|
||||
e->exposable->begin_expose(e->exposable) +
|
||||
exposable->particle->right_margin);
|
||||
|
||||
return exposable->width;
|
||||
|
|
|
@ -52,7 +52,7 @@ exposable_destroy(struct exposable *exposable)
|
|||
}
|
||||
|
||||
static int
|
||||
begin_expose(struct exposable *exposable, cairo_t *cr)
|
||||
begin_expose(struct exposable *exposable)
|
||||
{
|
||||
struct eprivate *e = exposable->private;
|
||||
|
||||
|
@ -62,7 +62,7 @@ begin_expose(struct exposable *exposable, cairo_t *cr)
|
|||
|
||||
/* Sub-exposables */
|
||||
for (size_t i = 0; i < e->count; i++)
|
||||
exposable->width += e->exposables[i]->begin_expose(e->exposables[i], cr);
|
||||
exposable->width += e->exposables[i]->begin_expose(e->exposables[i]);
|
||||
|
||||
return exposable->width;
|
||||
}
|
||||
|
|
|
@ -27,13 +27,13 @@ exposable_destroy(struct exposable *exposable)
|
|||
}
|
||||
|
||||
static int
|
||||
begin_expose(struct exposable *exposable, cairo_t *cr)
|
||||
begin_expose(struct exposable *exposable)
|
||||
{
|
||||
struct eprivate *e = exposable->private;
|
||||
|
||||
exposable->width = (
|
||||
exposable->particle->left_margin +
|
||||
e->exposable->begin_expose(e->exposable, cr) +
|
||||
e->exposable->begin_expose(e->exposable) +
|
||||
exposable->particle->right_margin);
|
||||
|
||||
return exposable->width;
|
||||
|
|
Loading…
Add table
Reference in a new issue