diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 773246c25..c88cebc16 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -35,6 +35,7 @@ - feat(msgbox): add function to get selected button index - fix(btnmatrix): make ORed values work correctly with lv_btnmatrix_has_btn_ctrl - fix(snapshot): snapshot is affected by parent's style because of wrong coordinates. +- fix(disp) set default theme also for non-default displays - feat(btnmatrix/keyboard): add option to show popovers on button press ## v8.0.2 (16.07.2021) diff --git a/src/extra/themes/default/lv_theme_default.c b/src/extra/themes/default/lv_theme_default.c index 00cbe5563..04a2442a4 100644 --- a/src/extra/themes/default/lv_theme_default.c +++ b/src/extra/themes/default/lv_theme_default.c @@ -603,6 +603,13 @@ lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_t color_primary, l return (lv_theme_t *)&theme; } +lv_theme_t * lv_theme_default_get(void) +{ + if(!inited) return NULL; + + return (lv_theme_t *)&theme; +} + bool lv_theme_default_is_inited(void) { return inited; diff --git a/src/extra/themes/default/lv_theme_default.h b/src/extra/themes/default/lv_theme_default.h index e3d854205..5b1fd9186 100644 --- a/src/extra/themes/default/lv_theme_default.h +++ b/src/extra/themes/default/lv_theme_default.h @@ -39,7 +39,16 @@ extern "C" { lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_t color_primary, lv_color_t color_secondary, bool dark, const lv_font_t * font); +/** + * Get default theme + * @return a pointer to default theme, or NULL if this is not initialized + */ +lv_theme_t * lv_theme_default_get(void); +/** + * Check if default theme is initialized + * @return true if default theme is initialized, false otherwise + */ bool lv_theme_default_is_inited(void); /********************** diff --git a/src/hal/lv_hal_disp.c b/src/hal/lv_hal_disp.c index 7d19e7ae8..233d0df84 100644 --- a/src/hal/lv_hal_disp.c +++ b/src/hal/lv_hal_disp.c @@ -153,6 +153,8 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver) if(lv_theme_default_is_inited() == false) { disp->theme = lv_theme_default_init(disp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), LV_THEME_DEFAULT_DARK, LV_FONT_DEFAULT); + } else { + disp->theme = lv_theme_default_get(); } #endif