forked from external/yambar
plugins: export a const function pointer interface struct
This commit is contained in:
parent
37266ae419
commit
452c4b6015
22 changed files with 255 additions and 230 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../decoration.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
struct private {
|
||||
struct rgba color;
|
||||
|
@ -40,15 +41,15 @@ background_new(struct rgba color)
|
|||
return deco;
|
||||
}
|
||||
|
||||
struct deco *
|
||||
background_from_conf(const struct yml_node *node)
|
||||
static struct deco *
|
||||
from_conf(const struct yml_node *node)
|
||||
{
|
||||
const struct yml_node *color = yml_get_value(node, "color");
|
||||
return background_new(conf_to_color(color));
|
||||
}
|
||||
|
||||
bool
|
||||
background_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
static bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
{"color", true, &conf_verify_color},
|
||||
|
@ -58,11 +59,11 @@ background_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct deco_iface deco_background_iface = {
|
||||
.verify_conf = &verify_conf,
|
||||
.from_conf = &from_conf,
|
||||
};
|
||||
|
||||
#if defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
|
||||
bool verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
__attribute__((weak, alias("background_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node)
|
||||
__attribute__((weak, alias("background_from_conf")));
|
||||
|
||||
extern const struct deco_iface iface __attribute__((weak, alias("deco_background_iface")));
|
||||
#endif
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../decoration.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
struct private {
|
||||
struct deco **decos;
|
||||
|
@ -47,8 +48,9 @@ stack_new(struct deco *decos[], size_t count)
|
|||
|
||||
return deco;
|
||||
}
|
||||
struct deco *
|
||||
stack_from_conf(const struct yml_node *node)
|
||||
|
||||
static struct deco *
|
||||
from_conf(const struct yml_node *node)
|
||||
{
|
||||
size_t count = yml_list_length(node);
|
||||
|
||||
|
@ -65,8 +67,8 @@ stack_from_conf(const struct yml_node *node)
|
|||
return stack_new(decos, count);
|
||||
}
|
||||
|
||||
bool
|
||||
stack_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
static bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
if (!yml_is_list(node)) {
|
||||
LOG_ERR("%s: must be a list of decorations", conf_err_prefix(chain, node));
|
||||
|
@ -84,11 +86,11 @@ stack_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return true;
|
||||
}
|
||||
|
||||
const struct deco_iface deco_stack_iface = {
|
||||
.verify_conf = &verify_conf,
|
||||
.from_conf = &from_conf,
|
||||
};
|
||||
|
||||
#if defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
|
||||
bool verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
__attribute__((weak, alias("stack_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node)
|
||||
__attribute__((weak, alias("stack_from_conf")));
|
||||
|
||||
extern const struct deco_iface iface __attribute__((weak, alias("deco_stack_iface")));
|
||||
#endif
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../decoration.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
struct private {
|
||||
int size;
|
||||
|
@ -42,16 +43,16 @@ underline_new(int size, struct rgba color)
|
|||
return deco;
|
||||
}
|
||||
|
||||
struct deco *
|
||||
underline_from_conf(const struct yml_node *node)
|
||||
static struct deco *
|
||||
from_conf(const struct yml_node *node)
|
||||
{
|
||||
const struct yml_node *size = yml_get_value(node, "size");
|
||||
const struct yml_node *color = yml_get_value(node, "color");
|
||||
return underline_new(yml_value_as_int(size), conf_to_color(color));
|
||||
}
|
||||
|
||||
bool
|
||||
underline_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
static bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
{"size", true, &conf_verify_int},
|
||||
|
@ -62,11 +63,11 @@ underline_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct deco_iface deco_underline_iface = {
|
||||
.verify_conf = &verify_conf,
|
||||
.from_conf = &from_conf,
|
||||
};
|
||||
|
||||
#if defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
|
||||
bool verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
__attribute__((weak, alias("underline_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node)
|
||||
__attribute__((weak, alias("underline_from_conf")));
|
||||
|
||||
extern const struct deco_iface iface __attribute__((weak, alias("deco_underline_iface")));
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue