mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-28 04:35:41 +02:00
Populate fields: top_margin, bottom_margin
This commit is contained in:
parent
0ab621c82b
commit
2f7c5ce463
3 changed files with 18 additions and 8 deletions
19
config.c
19
config.c
|
@ -182,7 +182,7 @@ particle_simple_list_from_config(const struct yml_node *node,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct particle *common = particle_common_new(
|
struct particle *common = particle_common_new(
|
||||||
0, 0, NULL, fcft_clone(inherited.font), inherited.font_shaping,
|
0, 0, 0, 0, NULL, fcft_clone(inherited.font), inherited.font_shaping,
|
||||||
inherited.foreground, NULL);
|
inherited.foreground, NULL);
|
||||||
|
|
||||||
return particle_list_new(common, parts, count, false, 0, 2);
|
return particle_list_new(common, parts, count, false, 0, 2);
|
||||||
|
@ -200,16 +200,23 @@ conf_to_particle(const struct yml_node *node, struct conf_inherit inherited)
|
||||||
const struct yml_node *margin = yml_get_value(pair.value, "margin");
|
const struct yml_node *margin = yml_get_value(pair.value, "margin");
|
||||||
const struct yml_node *left_margin = yml_get_value(pair.value, "left-margin");
|
const struct yml_node *left_margin = yml_get_value(pair.value, "left-margin");
|
||||||
const struct yml_node *right_margin = yml_get_value(pair.value, "right-margin");
|
const struct yml_node *right_margin = yml_get_value(pair.value, "right-margin");
|
||||||
|
const struct yml_node *top_margin = yml_get_value(pair.value, "top-margin");
|
||||||
|
const struct yml_node *bottom_margin = yml_get_value(pair.value, "bottom-margin");
|
||||||
const struct yml_node *on_click = yml_get_value(pair.value, "on-click");
|
const struct yml_node *on_click = yml_get_value(pair.value, "on-click");
|
||||||
const struct yml_node *font_node = yml_get_value(pair.value, "font");
|
const struct yml_node *font_node = yml_get_value(pair.value, "font");
|
||||||
const struct yml_node *font_shaping_node = yml_get_value(pair.value, "font-shaping");
|
const struct yml_node *font_shaping_node = yml_get_value(pair.value, "font-shaping");
|
||||||
const struct yml_node *foreground_node = yml_get_value(pair.value, "foreground");
|
const struct yml_node *foreground_node = yml_get_value(pair.value, "foreground");
|
||||||
const struct yml_node *deco_node = yml_get_value(pair.value, "deco");
|
const struct yml_node *deco_node = yml_get_value(pair.value, "deco");
|
||||||
|
|
||||||
int left = margin != NULL ? yml_value_as_int(margin) :
|
int left, right, top, bottom;
|
||||||
left_margin != NULL ? yml_value_as_int(left_margin) : 0;
|
|
||||||
int right = margin != NULL ? yml_value_as_int(margin) :
|
left = right = top = bottom =
|
||||||
right_margin != NULL ? yml_value_as_int(right_margin) : 0;
|
margin != NULL ? yml_value_as_int(margin) : 0;
|
||||||
|
|
||||||
|
left = left_margin != NULL ? yml_value_as_int(left_margin) : left;
|
||||||
|
right = right_margin != NULL ? yml_value_as_int(right_margin) : right;
|
||||||
|
top = top_margin != NULL ? yml_value_as_int(top_margin) : top;
|
||||||
|
bottom = bottom_margin != NULL ? yml_value_as_int(bottom_margin) : bottom;
|
||||||
|
|
||||||
const char *on_click_templates[MOUSE_BTN_COUNT] = {NULL};
|
const char *on_click_templates[MOUSE_BTN_COUNT] = {NULL};
|
||||||
if (on_click != NULL) {
|
if (on_click != NULL) {
|
||||||
|
@ -266,7 +273,7 @@ conf_to_particle(const struct yml_node *node, struct conf_inherit inherited)
|
||||||
|
|
||||||
/* Instantiate base/common particle */
|
/* Instantiate base/common particle */
|
||||||
struct particle *common = particle_common_new(
|
struct particle *common = particle_common_new(
|
||||||
left, right, on_click_templates, font, font_shaping, foreground, deco);
|
left, right, top, bottom, on_click_templates, font, font_shaping, foreground, deco);
|
||||||
|
|
||||||
const struct particle_iface *iface = plugin_load_particle(type);
|
const struct particle_iface *iface = plugin_load_particle(type);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ particle_default_destroy(struct particle *particle)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct particle *
|
struct particle *
|
||||||
particle_common_new(int left_margin, int right_margin,
|
particle_common_new(int left_margin, int right_margin, int top_margin, int bottom_margin,
|
||||||
const char **on_click_templates,
|
const char **on_click_templates,
|
||||||
struct fcft_font *font, enum font_shaping font_shaping,
|
struct fcft_font *font, enum font_shaping font_shaping,
|
||||||
pixman_color_t foreground, struct deco *deco)
|
pixman_color_t foreground, struct deco *deco)
|
||||||
|
@ -37,6 +37,8 @@ particle_common_new(int left_margin, int right_margin,
|
||||||
struct particle *p = calloc(1, sizeof(*p));
|
struct particle *p = calloc(1, sizeof(*p));
|
||||||
p->left_margin = left_margin;
|
p->left_margin = left_margin;
|
||||||
p->right_margin = right_margin;
|
p->right_margin = right_margin;
|
||||||
|
p->top_margin = top_margin;
|
||||||
|
p->bottom_margin = bottom_margin;
|
||||||
p->foreground = foreground;
|
p->foreground = foreground;
|
||||||
p->font = font;
|
p->font = font;
|
||||||
p->font_shaping = font_shaping;
|
p->font_shaping = font_shaping;
|
||||||
|
|
|
@ -68,7 +68,8 @@ struct exposable {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct particle *particle_common_new(
|
struct particle *particle_common_new(
|
||||||
int left_margin, int right_margin, const char *on_click_templates[],
|
int left_margin, int right_margin, int top_margin, int bottom_margin,
|
||||||
|
const char *on_click_templates[],
|
||||||
struct fcft_font *font, enum font_shaping font_shaping,
|
struct fcft_font *font, enum font_shaping font_shaping,
|
||||||
pixman_color_t foreground, struct deco *deco);
|
pixman_color_t foreground, struct deco *deco);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue