1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

fix(disp) set default theme also for non-default displays (#2596)

* feat(theme) add getter function for default theme

* fix(disp) set default theme also for non-default displays

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
This commit is contained in:
Francesco Valla 2021-09-29 11:24:13 +02:00 committed by GitHub
parent e6e98abbc2
commit fc4fdb1e2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 0 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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);
/**********************

View File

@ -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