diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index c15e0086e..15791c948 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -674,6 +674,9 @@ bool lv_obj_hit_test(lv_obj_t * obj, const lv_point_t * point) */ static bool refr_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h) { + lv_obj_t * parent = lv_obj_get_parent(obj); + if(parent == NULL) return false; + /* If the size is managed by the layout don't let to overwrite it.*/ if(obj->w_set == LV_SIZE_LAYOUT) w = lv_obj_get_width(obj); if(obj->h_set == LV_SIZE_LAYOUT) h = lv_obj_get_height(obj); @@ -691,8 +694,6 @@ static bool refr_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h) lv_area_t ori; lv_obj_get_coords(obj, &ori); - lv_obj_t * parent = lv_obj_get_parent(obj); - /*Check if the object inside the parent or not*/ lv_area_t parent_fit_area; lv_obj_get_coords_fit(parent, &parent_fit_area); diff --git a/src/core/lv_obj_style.c b/src/core/lv_obj_style.c index 405fa9178..697300efb 100644 --- a/src/core/lv_obj_style.c +++ b/src/core/lv_obj_style.c @@ -178,7 +178,7 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop) lv_obj_invalidate(obj); if(prop == LV_STYLE_PROP_ALL || - ((prop & LV_STYLE_PROP_INHERIT) && (prop & LV_STYLE_PROP_EXT_DRAW) && (prop & LV_STYLE_PROP_LAYOUT_REFR))) + ((prop & LV_STYLE_PROP_INHERIT) && ((prop & LV_STYLE_PROP_EXT_DRAW) || (prop & LV_STYLE_PROP_LAYOUT_REFR)))) { if(part != LV_PART_SCROLLBAR) { refresh_children_style(obj); diff --git a/src/widgets/lv_dropdown.c b/src/widgets/lv_dropdown.c index 2be4e5dc9..77747c2a6 100644 --- a/src/widgets/lv_dropdown.c +++ b/src/widgets/lv_dropdown.c @@ -555,7 +555,7 @@ static void lv_dropdown_constructor(lv_obj_t * obj, const lv_obj_t * copy) if(copy == NULL) { lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS); - lv_obj_set_width(obj, LV_DPX(150)); + lv_obj_set_size(obj, LV_DPX(150), LV_SIZE_CONTENT); lv_dropdown_set_options_static(obj, "Option 1\nOption 2\nOption 3"); } /*Copy an existing drop down list*/ @@ -839,11 +839,10 @@ static lv_res_t lv_dropdown_signal(lv_obj_t * obj, lv_signal_t sign, void * para else if(sign == LV_SIGNAL_COORD_CHG) { if(dropdown->list) lv_dropdown_close(obj); } - else if(sign == LV_SIGNAL_STYLE_CHG) { - lv_coord_t top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); + else if(sign == LV_SIGNAL_GET_SELF_SIZE) { + lv_point_t * p = param; const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); - lv_obj_set_height(obj, top + bottom + lv_font_get_line_height(font)); + p->y = lv_font_get_line_height(font); } else if(sign == LV_SIGNAL_CONTROL) { char c = *((char *)param);