diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2014-10-25 01:38:30 +0300 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2014-10-25 01:38:30 +0300 |
commit | 3f5e21a83f525586d1ee5b1bcd04cc2e50350403 (patch) | |
tree | 226cb57348ae89bc62df34cfd7ee2afe43f03c45 /lib/internal.h | |
parent | f8d97efb8f1bc5a7e764e1bb14f0e97ac36de68d (diff) | |
download | bemenu-3f5e21a83f525586d1ee5b1bcd04cc2e50350403.tar.gz bemenu-3f5e21a83f525586d1ee5b1bcd04cc2e50350403.tar.bz2 bemenu-3f5e21a83f525586d1ee5b1bcd04cc2e50350403.zip |
Cleanup wayland renderer and plugin support.
Diffstat (limited to 'lib/internal.h')
-rw-r--r-- | lib/internal.h | 37 |
1 files changed, 36 insertions, 1 deletions
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 <stddef.h> /* for size_t */ #endif +#include <stdarg.h> + /** * 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; }; /** @@ -81,6 +104,12 @@ struct bm_renderer { void *handle; /** + * Data used by the renderer internally. + * Nobody else should touch this. + */ + void *internal; + + /** * API */ struct render_api 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 :*/ |