forked from external/yambar
exposable: add a "common" constructor and default destructor
This commit is contained in:
parent
acda1a4b21
commit
e8d8bf70d3
6 changed files with 59 additions and 33 deletions
|
@ -2,12 +2,6 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
static void
|
||||
exposable_destroy(struct exposable *exposable)
|
||||
{
|
||||
free(exposable);
|
||||
}
|
||||
|
||||
static int
|
||||
begin_expose(struct exposable *exposable, cairo_t *cr)
|
||||
{
|
||||
|
@ -27,9 +21,7 @@ expose(const struct exposable *exposable, cairo_t *cr, int x, int y, int height)
|
|||
static struct exposable *
|
||||
instantiate(const struct particle *particle, const struct tag_set *tags)
|
||||
{
|
||||
struct exposable *exposable = malloc(sizeof(*exposable));
|
||||
exposable->particle = particle;
|
||||
exposable->destroy = &exposable_destroy;
|
||||
struct exposable *exposable = exposable_common_new(particle, NULL);
|
||||
exposable->begin_expose = &begin_expose;
|
||||
exposable->expose = &expose;
|
||||
return exposable;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue