forked from external/yambar
allow plugins to be compiled into the f00bar main binary
This commit is contained in:
parent
00679dbeeb
commit
0d591fe5a1
25 changed files with 400 additions and 72 deletions
|
@ -8,9 +8,17 @@ set(CMAKE_SHARED_MODULE_PREFIX decoration_)
|
|||
|
||||
set(decorations background stack underline)
|
||||
|
||||
if (CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
set(lib_type MODULE)
|
||||
else()
|
||||
set(lib_type STATIC)
|
||||
endif ()
|
||||
|
||||
foreach (deco ${decorations})
|
||||
add_library(${deco} MODULE ${deco}.c)
|
||||
add_library(${deco} ${lib_type} ${deco}.c)
|
||||
target_link_libraries(${deco} decoration-sdk)
|
||||
endforeach ()
|
||||
|
||||
install(TARGETS ${decorations} DESTINATION lib/f00bar)
|
||||
if (CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
install(TARGETS ${decorations} DESTINATION lib/f00bar)
|
||||
endif ()
|
||||
|
|
|
@ -41,14 +41,14 @@ background_new(struct rgba color)
|
|||
}
|
||||
|
||||
struct deco *
|
||||
from_conf(const struct yml_node *node)
|
||||
background_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
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
background_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
{"color", true, &conf_verify_color},
|
||||
|
@ -57,3 +57,12 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
|
||||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
#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")));
|
||||
|
||||
#endif
|
||||
|
|
|
@ -48,7 +48,7 @@ stack_new(struct deco *decos[], size_t count)
|
|||
return deco;
|
||||
}
|
||||
struct deco *
|
||||
from_conf(const struct yml_node *node)
|
||||
stack_from_conf(const struct yml_node *node)
|
||||
{
|
||||
size_t count = yml_list_length(node);
|
||||
|
||||
|
@ -66,7 +66,7 @@ from_conf(const struct yml_node *node)
|
|||
}
|
||||
|
||||
bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
stack_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));
|
||||
|
@ -83,3 +83,12 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
#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")));
|
||||
|
||||
#endif
|
||||
|
|
|
@ -43,7 +43,7 @@ underline_new(int size, struct rgba color)
|
|||
}
|
||||
|
||||
struct deco *
|
||||
from_conf(const struct yml_node *node)
|
||||
underline_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");
|
||||
|
@ -51,7 +51,7 @@ from_conf(const struct yml_node *node)
|
|||
}
|
||||
|
||||
bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
underline_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
{"size", true, &conf_verify_int},
|
||||
|
@ -61,3 +61,12 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
|
||||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
#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")));
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue