forked from external/yambar
particle: remove cairo context from begin_expose()
This commit is contained in:
parent
54797ffbd8
commit
95385863ae
11 changed files with 19 additions and 19 deletions
|
@ -97,7 +97,7 @@ expose(const struct bar *_bar)
|
||||||
if (e != NULL)
|
if (e != NULL)
|
||||||
e->destroy(e);
|
e->destroy(e);
|
||||||
|
|
||||||
bar->left.exps[i] = module_begin_expose(m, bar->cairo);
|
bar->left.exps[i] = module_begin_expose(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < bar->center.count; i++) {
|
for (size_t i = 0; i < bar->center.count; i++) {
|
||||||
|
@ -107,7 +107,7 @@ expose(const struct bar *_bar)
|
||||||
if (e != NULL)
|
if (e != NULL)
|
||||||
e->destroy(e);
|
e->destroy(e);
|
||||||
|
|
||||||
bar->center.exps[i] = module_begin_expose(m, bar->cairo);
|
bar->center.exps[i] = module_begin_expose(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < bar->right.count; i++) {
|
for (size_t i = 0; i < bar->right.count; i++) {
|
||||||
|
@ -117,7 +117,7 @@ expose(const struct bar *_bar)
|
||||||
if (e != NULL)
|
if (e != NULL)
|
||||||
e->destroy(e);
|
e->destroy(e);
|
||||||
|
|
||||||
bar->right.exps[i] = module_begin_expose(m, bar->cairo);
|
bar->right.exps[i] = module_begin_expose(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
int left_width, center_width, right_width;
|
int left_width, center_width, right_width;
|
||||||
|
|
4
module.c
4
module.c
|
@ -20,9 +20,9 @@ module_default_destroy(struct module *mod)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct exposable *
|
struct exposable *
|
||||||
module_begin_expose(struct module *mod, cairo_t *cr)
|
module_begin_expose(struct module *mod)
|
||||||
{
|
{
|
||||||
struct exposable *e = mod->content(mod);
|
struct exposable *e = mod->content(mod);
|
||||||
e->begin_expose(e, cr);
|
e->begin_expose(e);
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
2
module.h
2
module.h
|
@ -30,7 +30,7 @@ struct module {
|
||||||
|
|
||||||
struct module *module_common_new(void);
|
struct module *module_common_new(void);
|
||||||
void module_default_destroy(struct module *mod);
|
void module_default_destroy(struct module *mod);
|
||||||
struct exposable *module_begin_expose(struct module *mod, cairo_t *cr);
|
struct exposable *module_begin_expose(struct module *mod);
|
||||||
|
|
||||||
/* List of attributes *all* modules implement */
|
/* List of attributes *all* modules implement */
|
||||||
#define MODULE_COMMON_ATTRS \
|
#define MODULE_COMMON_ATTRS \
|
||||||
|
|
|
@ -36,7 +36,7 @@ struct exposable {
|
||||||
char *on_click;
|
char *on_click;
|
||||||
|
|
||||||
void (*destroy)(struct exposable *exposable);
|
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,
|
void (*expose)(const struct exposable *exposable, cairo_t *cr,
|
||||||
int x, int y, int height);
|
int x, int y, int height);
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ dynlist_destroy(struct exposable *exposable)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dynlist_begin_expose(struct exposable *exposable, cairo_t *cr)
|
dynlist_begin_expose(struct exposable *exposable)
|
||||||
{
|
{
|
||||||
const struct private *e = exposable->private;
|
const struct private *e = exposable->private;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ dynlist_begin_expose(struct exposable *exposable, cairo_t *cr)
|
||||||
|
|
||||||
for (size_t i = 0; i < e->count; i++) {
|
for (size_t i = 0; i < e->count; i++) {
|
||||||
struct exposable *ee = e->exposables[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;
|
exposable->width += e->left_spacing + e->widths[i] + e->right_spacing;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "../plugin.h"
|
#include "../plugin.h"
|
||||||
|
|
||||||
static int
|
static int
|
||||||
begin_expose(struct exposable *exposable, cairo_t *cr)
|
begin_expose(struct exposable *exposable)
|
||||||
{
|
{
|
||||||
exposable->width = exposable->particle->left_margin +
|
exposable->width = exposable->particle->left_margin +
|
||||||
exposable->particle->right_margin;
|
exposable->particle->right_margin;
|
||||||
|
|
|
@ -36,7 +36,7 @@ exposable_destroy(struct exposable *exposable)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
begin_expose(struct exposable *exposable, cairo_t *cr)
|
begin_expose(struct exposable *exposable)
|
||||||
{
|
{
|
||||||
const struct eprivate *e = exposable->private;
|
const struct eprivate *e = exposable->private;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ begin_expose(struct exposable *exposable, cairo_t *cr)
|
||||||
|
|
||||||
for (size_t i = 0; i < e->count; i++) {
|
for (size_t i = 0; i < e->count; i++) {
|
||||||
struct exposable *ee = e->exposables[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;
|
exposable->width += e->left_spacing + e->widths[i] + e->right_spacing;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,13 +36,13 @@ exposable_destroy(struct exposable *exposable)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
begin_expose(struct exposable *exposable, cairo_t *cr)
|
begin_expose(struct exposable *exposable)
|
||||||
{
|
{
|
||||||
struct eprivate *e = exposable->private;
|
struct eprivate *e = exposable->private;
|
||||||
|
|
||||||
exposable->width = (
|
exposable->width = (
|
||||||
exposable->particle->left_margin +
|
exposable->particle->left_margin +
|
||||||
e->exposable->begin_expose(e->exposable, cr) +
|
e->exposable->begin_expose(e->exposable) +
|
||||||
exposable->particle->right_margin);
|
exposable->particle->right_margin);
|
||||||
|
|
||||||
return exposable->width;
|
return exposable->width;
|
||||||
|
|
|
@ -54,7 +54,7 @@ exposable_destroy(struct exposable *exposable)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
begin_expose(struct exposable *exposable, cairo_t *cr)
|
begin_expose(struct exposable *exposable)
|
||||||
{
|
{
|
||||||
struct eprivate *e = exposable->private;
|
struct eprivate *e = exposable->private;
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ begin_expose(struct exposable *exposable, cairo_t *cr)
|
||||||
|
|
||||||
/* Sub-exposables */
|
/* Sub-exposables */
|
||||||
for (size_t i = 0; i < e->count; i++)
|
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;
|
return exposable->width;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,13 +30,13 @@ exposable_destroy(struct exposable *exposable)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
begin_expose(struct exposable *exposable, cairo_t *cr)
|
begin_expose(struct exposable *exposable)
|
||||||
{
|
{
|
||||||
struct eprivate *e = exposable->private;
|
struct eprivate *e = exposable->private;
|
||||||
|
|
||||||
exposable->width = (
|
exposable->width = (
|
||||||
exposable->particle->left_margin +
|
exposable->particle->left_margin +
|
||||||
e->exposable->begin_expose(e->exposable, cr) +
|
e->exposable->begin_expose(e->exposable) +
|
||||||
exposable->particle->right_margin);
|
exposable->particle->right_margin);
|
||||||
|
|
||||||
return exposable->width;
|
return exposable->width;
|
||||||
|
|
|
@ -35,7 +35,7 @@ exposable_destroy(struct exposable *exposable)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
begin_expose(struct exposable *exposable, cairo_t *cr)
|
begin_expose(struct exposable *exposable)
|
||||||
{
|
{
|
||||||
struct eprivate *e = exposable->private;
|
struct eprivate *e = exposable->private;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue