#include <errno.h>
#include <stdlib.h>
+#include "kmscon_module.h"
#include "tsm_screen.h"
#include "uterm.h"
struct kmscon_font_ops {
const char *name;
+ struct kmscon_module *owner;
int (*init) (struct kmscon_font *out,
const struct kmscon_font_attr *attr);
void (*destroy) (struct kmscon_font *font);
const struct kmscon_glyph **out);
int (*render_inval) (struct kmscon_font *font,
const struct kmscon_glyph **out);
- void (*finalize) (void);
};
int kmscon_font_register(const struct kmscon_font_ops *ops);
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
+#include "kmscon_module.h"
#include "log.h"
#include "shl_dlist.h"
#include "shl_register.h"
{
const struct kmscon_font_ops *ops = data;
- if (ops->finalize)
- ops->finalize();
+ kmscon_module_unref(ops->owner);
}
/**
return ret;
}
+ kmscon_module_ref(ops->owner);
return 0;
}
struct kmscon_font_ops kmscon_font_8x16_ops = {
.name = "8x16",
+ .owner = NULL,
.init = kmscon_font_8x16_init,
.destroy = kmscon_font_8x16_destroy,
.render = kmscon_font_8x16_render,
.render_empty = kmscon_font_8x16_render_empty,
.render_inval = kmscon_font_8x16_render_inval,
- .finalize = NULL,
};
static const struct kmscon_glyph kmscon_font_8x16_glyphs[256] = {
struct kmscon_font_ops kmscon_font_freetype2_ops = {
.name = "freetype2",
+ .owner = NULL,
.init = kmscon_font_freetype2_init,
.destroy = kmscon_font_freetype2_destroy,
.render = kmscon_font_freetype2_render,
.render_empty = kmscon_font_freetype2_render_empty,
.render_inval = kmscon_font_freetype2_render_inval,
- .finalize = NULL,
};
struct kmscon_font_ops kmscon_font_pango_ops = {
.name = "pango",
+ .owner = NULL,
.init = kmscon_font_pango_init,
.destroy = kmscon_font_pango_destroy,
.render = kmscon_font_pango_render,
.render_empty = kmscon_font_pango_render_empty,
.render_inval = kmscon_font_pango_render_inval,
- .finalize = NULL,
};
struct kmscon_font_ops kmscon_font_unifont_ops = {
.name = "unifont",
+ .owner = NULL,
.init = kmscon_font_unifont_init,
.destroy = kmscon_font_unifont_destroy,
.render = kmscon_font_unifont_render,
.render_empty = kmscon_font_unifont_render_empty,
.render_inval = kmscon_font_unifont_render_inval,
- .finalize = NULL,
};