fix(layout) fix missing layout recalculation on screen

This commit is contained in:
Gabor Kiss-Vamosi
2021-04-23 14:06:50 +02:00
parent a6ac99baa9
commit 9d6d0094f5
3 changed files with 8 additions and 5 deletions

View File

@@ -36,6 +36,8 @@ void lv_example_checkbox_1(void)
lv_obj_add_state(cb, LV_STATE_CHECKED | LV_STATE_DISABLED);
lv_checkbox_set_text(cb, "Melon");
lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL);
lv_obj_update_layout(cb);
}
#endif

View File

@@ -247,6 +247,7 @@ typedef struct _lv_obj_t {
lv_obj_flag_t flags;
lv_state_t state;
uint16_t layout_inv :1;
uint16_t scr_layout_inv :1;
uint16_t skip_trans :1;
uint16_t style_cnt :6;
uint16_t h_layout :1;

View File

@@ -277,7 +277,7 @@ void lv_obj_mark_layout_as_dirty(lv_obj_t * obj)
/*Mark the screen as dirty too to mark that there is an something to do on this screen*/
lv_obj_t * scr = lv_obj_get_screen(obj);
scr->layout_inv = 1;
scr->scr_layout_inv = 1;
/*Make the display refreshing*/
lv_disp_t * disp = lv_obj_get_disp(scr);
@@ -296,11 +296,11 @@ void lv_obj_update_layout(const lv_obj_t * obj)
lv_obj_t * scr = lv_obj_get_screen(obj);
/*Repeat until there where layout invalidations*/
while(scr->layout_inv) {
LV_LOG_INFO("Start layout update")
scr->layout_inv = 0;
while(scr->scr_layout_inv) {
LV_LOG_INFO("Layout update begin")
scr->scr_layout_inv = 0;
layout_update_core(scr);
LV_LOG_TRACE("Layout update finished")
LV_LOG_TRACE("Layout update end")
}
mutex = false;