From 3e08ee471618c5ece0b03ead3d48f886e4ddc64a Mon Sep 17 00:00:00 2001 From: Vladimir Stoiakin Date: Thu, 24 Apr 2025 15:34:12 +0300 Subject: [PATCH] buffyboard: disable unused LVGL widgets --- buffyboard/lv_conf.defaults | 9 ++++----- buffyboard/lv_conf.h | 10 +++++----- shared/theme.c | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/buffyboard/lv_conf.defaults b/buffyboard/lv_conf.defaults index ef35890..8ee24e7 100644 --- a/buffyboard/lv_conf.defaults +++ b/buffyboard/lv_conf.defaults @@ -60,13 +60,13 @@ LV_WIDGETS_HAS_DEFAULT_VALUE 0 LV_USE_ANIMIMG 0 LV_USE_ARC 0 LV_USE_BAR 0 -LV_USE_BUTTON 1 +LV_USE_BUTTON 0 LV_USE_BUTTONMATRIX 1 LV_USE_CALENDAR 0 LV_USE_CANVAS 0 LV_USE_CHART 0 LV_USE_CHECKBOX 0 -LV_USE_DROPDOWN 1 +LV_USE_DROPDOWN 0 LV_USE_IMAGE 1 LV_USE_IMAGEBUTTON 0 LV_USE_KEYBOARD 1 @@ -78,7 +78,7 @@ LV_USE_LINE 0 LV_USE_LIST 0 LV_USE_LOTTIE 0 LV_USE_MENU 0 -LV_USE_MSGBOX 1 +LV_USE_MSGBOX 0 LV_USE_ROLLER 0 LV_USE_SCALE 0 LV_USE_SLIDER 0 @@ -87,7 +87,6 @@ LV_USE_SPINBOX 0 LV_USE_SPINNER 0 LV_USE_SWITCH 0 LV_USE_TEXTAREA 1 -LV_TEXTAREA_DEF_PWD_SHOW_TIME 0 /*ms*/ LV_USE_TABLE 0 LV_USE_TABVIEW 0 LV_USE_TILEVIEW 0 @@ -97,7 +96,7 @@ LV_USE_THEME_DEFAULT 0 LV_USE_THEME_SIMPLE 0 LV_USE_THEME_MONO 0 -LV_USE_FLEX 1 +LV_USE_FLEX 0 LV_USE_GRID 0 LV_USE_LINUX_FBDEV 1 diff --git a/buffyboard/lv_conf.h b/buffyboard/lv_conf.h index b8ceb27..670fef9 100644 --- a/buffyboard/lv_conf.h +++ b/buffyboard/lv_conf.h @@ -585,7 +585,7 @@ #define LV_USE_BAR 0 -#define LV_USE_BUTTON 1 +#define LV_USE_BUTTON 0 #define LV_USE_BUTTONMATRIX 1 @@ -610,7 +610,7 @@ #define LV_USE_CHECKBOX 0 -#define LV_USE_DROPDOWN 1 +#define LV_USE_DROPDOWN 0 #define LV_USE_IMAGE 1 @@ -635,7 +635,7 @@ #define LV_USE_MENU 0 -#define LV_USE_MSGBOX 1 +#define LV_USE_MSGBOX 0 #define LV_USE_ROLLER 0 @@ -657,7 +657,7 @@ #define LV_USE_TEXTAREA 1 #if LV_USE_TEXTAREA != 0 - #define LV_TEXTAREA_DEF_PWD_SHOW_TIME 0 /*ms*/ + #define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ #endif #define LV_USE_TABLE 0 @@ -697,7 +697,7 @@ *==================*/ /*A layout similar to Flexbox in CSS.*/ -#define LV_USE_FLEX 1 +#define LV_USE_FLEX 0 /*A layout similar to Grid in CSS.*/ #define LV_USE_GRID 0 diff --git a/shared/theme.c b/shared/theme.c index 73fa4dc..6637953 100644 --- a/shared/theme.c +++ b/shared/theme.c @@ -22,19 +22,25 @@ static struct { lv_style_t header; lv_style_t keyboard; lv_style_t key; +#if LV_USE_BUTTON lv_style_t button; lv_style_t button_pressed; +#endif lv_style_t textarea; lv_style_t textarea_placeholder; lv_style_t textarea_cursor; +#if LV_USE_DROPDOWN lv_style_t dropdown; lv_style_t dropdown_pressed; lv_style_t dropdown_list; lv_style_t dropdown_list_selected; +#endif lv_style_t label; +#if LV_USE_MSGBOX lv_style_t msgbox; lv_style_t msgbox_label; lv_style_t msgbox_background; +#endif } styles; static bool are_styles_initialised = false; @@ -110,6 +116,7 @@ static void init_styles(const bbx_theme *theme) { lv_style_set_border_width(&(styles.key), lv_dpx(theme->keyboard.keys.border_width)); lv_style_set_radius(&(styles.key), lv_dpx(theme->keyboard.keys.corner_radius)); +#if LV_USE_BUTTON reset_style(&(styles.button)); lv_style_set_text_color(&(styles.button), lv_color_hex(theme->button.normal.fg_color)); lv_style_set_bg_opa(&(styles.button), LV_OPA_COVER); @@ -124,6 +131,7 @@ static void init_styles(const bbx_theme *theme) { lv_style_set_text_color(&(styles.button_pressed), lv_color_hex(theme->button.pressed.fg_color)); lv_style_set_bg_color(&(styles.button_pressed), lv_color_hex(theme->button.pressed.bg_color)); lv_style_set_border_color(&(styles.button_pressed), lv_color_hex(theme->button.pressed.border_color)); +#endif reset_style(&(styles.textarea)); lv_style_set_text_color(&(styles.textarea), lv_color_hex(theme->textarea.fg_color)); @@ -144,6 +152,7 @@ static void init_styles(const bbx_theme *theme) { lv_style_set_border_color(&(styles.textarea_cursor), lv_color_hex(theme->textarea.cursor.color)); lv_style_set_anim_duration(&(styles.textarea_cursor), theme->textarea.cursor.period); +#if LV_USE_DROPDOWN reset_style(&(styles.dropdown)); lv_style_set_text_color(&(styles.dropdown), lv_color_hex(theme->dropdown.button.normal.fg_color)); lv_style_set_bg_opa(&(styles.dropdown), LV_OPA_COVER); @@ -173,10 +182,12 @@ static void init_styles(const bbx_theme *theme) { lv_style_set_text_color(&(styles.dropdown_list_selected), lv_color_hex(theme->dropdown.list.selection_fg_color)); lv_style_set_bg_opa(&(styles.dropdown_list_selected), LV_OPA_COVER); lv_style_set_bg_color(&(styles.dropdown_list_selected), lv_color_hex(theme->dropdown.list.selection_bg_color)); +#endif reset_style(&(styles.label)); lv_style_set_text_color(&(styles.label), lv_color_hex(theme->label.fg_color)); +#if LV_USE_MSGBOX reset_style(&(styles.msgbox)); lv_style_set_text_color(&(styles.msgbox), lv_color_hex(theme->msgbox.fg_color)); lv_style_set_bg_opa(&(styles.msgbox), LV_OPA_COVER); @@ -194,6 +205,7 @@ static void init_styles(const bbx_theme *theme) { reset_style(&(styles.msgbox_background)); lv_style_set_bg_color(&(styles.msgbox_background), lv_color_hex(theme->msgbox.dimming.color)); lv_style_set_bg_opa(&(styles.msgbox_background), theme->msgbox.dimming.opacity); +#endif are_styles_initialised = true; } @@ -227,6 +239,7 @@ static void apply_theme_cb(lv_theme_t *theme, lv_obj_t *obj) { return; } +#if LV_USE_BUTTON if (lv_obj_check_type(obj, &lv_button_class)) { lv_obj_add_style(obj, &(styles.button), 0); lv_obj_add_style(obj, &(styles.button_pressed), LV_STATE_PRESSED); @@ -236,6 +249,7 @@ static void apply_theme_cb(lv_theme_t *theme, lv_obj_t *obj) { if (lv_obj_check_type(obj, &lv_label_class) && lv_obj_check_type(lv_obj_get_parent(obj), &lv_button_class)) { return; /* Inherit styling from button */ } +#endif if (lv_obj_check_type(obj, &lv_textarea_class)) { lv_obj_add_style(obj, &(styles.textarea), 0); @@ -248,6 +262,7 @@ static void apply_theme_cb(lv_theme_t *theme, lv_obj_t *obj) { return; /* Inherit styling from textarea */ } +#if LV_USE_DROPDOWN if (lv_obj_check_type(obj, &lv_dropdown_class)) { lv_obj_add_style(obj, &(styles.dropdown), 0); lv_obj_add_style(obj, &(styles.dropdown_pressed), LV_STATE_PRESSED); @@ -264,7 +279,9 @@ static void apply_theme_cb(lv_theme_t *theme, lv_obj_t *obj) { if (lv_obj_check_type(obj, &lv_label_class) && lv_obj_check_type(lv_obj_get_parent(obj), &lv_dropdownlist_class)) { return; /* Inherit styling from dropdown list */ } +#endif +#if LV_USE_MSGBOX if (lv_obj_check_type(obj, &lv_msgbox_class)) { lv_obj_add_style(obj, &(styles.msgbox), 0); return; @@ -289,6 +306,7 @@ static void apply_theme_cb(lv_theme_t *theme, lv_obj_t *obj) { lv_obj_add_style(obj, &(styles.msgbox_background), 0); return; } +#endif if (lv_obj_check_type(obj, &lv_label_class)) { lv_obj_add_style(obj, &(styles.label), 0);