From 3f5e21a83f525586d1ee5b1bcd04cc2e50350403 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Sat, 25 Oct 2014 01:38:30 +0300 Subject: Cleanup wayland renderer and plugin support. --- lib/internal.h | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'lib/internal.h') diff --git a/lib/internal.h b/lib/internal.h index aa35ed8..fe392a1 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -1,9 +1,20 @@ +#ifndef _BEMENU_INTERNAL_H_ +#define _BEMENU_INTERNAL_H_ + #include "bemenu.h" +#if __GNUC__ +# define BM_LOG_ATTR(x, y) __attribute__((format(printf, x, y))) +#else +# define BM_LOG_ATTR(x, y) +#endif + #ifndef size_t # include /* for size_t */ #endif +#include + /** * Destructor function pointer for some list calls. */ @@ -59,6 +70,18 @@ struct render_api { * Tells underlying renderer to draw the menu. */ void (*render)(const struct bm_menu *menu); + + /** + * Version of the plugin. + * Should match BM_VERSION or failure. + */ + const char *version; + + /** + * Prioritory of the plugin. + * Terminal renderers should be first, then graphicals. + */ + enum bm_prioritory prioritory; }; /** @@ -80,6 +103,12 @@ struct bm_renderer { */ void *handle; + /** + * Data used by the renderer internally. + * Nobody else should touch this. + */ + void *internal; + /** * API */ @@ -117,7 +146,7 @@ struct bm_menu { /** * Underlying renderer access. */ - const struct bm_renderer *renderer; + struct bm_renderer *renderer; /** * Items contained in menu instance. @@ -202,9 +231,13 @@ bool list_add_item_at(struct list *list, void *item, uint32_t index); bool list_add_item(struct list *list, void *item); bool list_remove_item_at(struct list *list, uint32_t index); bool list_remove_item(struct list *list, const void *item); +void list_sort(struct list *list, int (*compar)(const void *a, const void *b)); /* util.c */ char* bm_strdup(const char *s); +bool bm_resize_buffer(char **in_out_buffer, size_t *in_out_size, size_t nsize); +BM_LOG_ATTR(1, 2) char* bm_dprintf(const char *fmt, ...); +bool bm_vrprintf(char **in_out_buffer, size_t *in_out_len, const char *fmt, va_list args); size_t bm_strip_token(char *string, const char *token, size_t *out_next); int bm_strupcmp(const char *hay, const char *needle); int bm_strnupcmp(const char *hay, const char *needle, size_t len); @@ -217,4 +250,6 @@ size_t bm_utf8_rune_remove(char *string, size_t start, size_t *out_rune_width); size_t bm_utf8_rune_insert(char **string, size_t *bufSize, size_t start, const char *rune, uint32_t u8len, size_t *out_rune_width); size_t bm_unicode_insert(char **string, size_t *bufSize, size_t start, uint32_t unicode, size_t *out_rune_width); +#endif /* _BEMENU_INTERNAL_H_ */ + /* vim: set ts=8 sw=4 tw=0 :*/ -- cgit v1.2.3-70-g09d2