diff options
author | Simon Glass <sjg@chromium.org> | 2023-06-01 10:22:53 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-07-14 12:54:51 -0400 |
commit | 2e59389704cd1e46101f7ffda2dac3f44f2fa332 (patch) | |
tree | 2ec4afe667eb58b3eca7be70ec4522af44ca068c /boot/expo.c | |
parent | 699b0acb522fd808b67b745b541bacf18c275d15 (diff) |
expo: Support simple themes
It is a pain to manually set the fonts of all objects to be consistent.
Some spacing settings are also better set globally than by manually
positioning each object.
Add a 'theme' to the expo, to hold this information. For now it includes
only the font size.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/expo.c')
-rw-r--r-- | boot/expo.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/boot/expo.c b/boot/expo.c index 67cae3c7e2..d5e935966b 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -231,3 +231,23 @@ int expo_action_get(struct expo *exp, struct expo_action *act) return act->type == EXPOACT_NONE ? -EAGAIN : 0; } + +int expo_apply_theme(struct expo *exp, ofnode node) +{ + struct scene *scn; + struct expo_theme *theme = &exp->theme; + int ret; + + log_debug("Applying theme %s\n", ofnode_get_name(node)); + + memset(theme, '\0', sizeof(struct expo_theme)); + ofnode_read_u32(node, "font-size", &theme->font_size); + + list_for_each_entry(scn, &exp->scene_head, sibling) { + ret = scene_apply_theme(scn, theme); + if (ret) + return log_msg_ret("app", ret); + } + + return 0; +} |