1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0

This commit is contained in:
Gabor Kiss-Vamosi 2020-02-17 06:45:09 +01:00
commit a0827e74e2
3 changed files with 21 additions and 5 deletions

View File

@ -405,8 +405,17 @@ typedef void * lv_font_user_data_t;
* LV_OBJ SETTINGS
*==================*/
#if LV_USE_USER_DATA
/*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/
typedef void * lv_obj_user_data_t;
/*Provide a function to free user data*/
#define LV_USE_USER_DATA_FREE 0
#if LV_USE_USER_DATA_FREE
# define LV_USER_DATA_FREE_INCLUDE "something.h" /*Header for user data free function*/
/* Function prototype : void user_data_free(lv_obj_t * obj); */
# define LV_USER_DATA_FREE (user_data_free) /*Invoking for user data free function*/
#endif
#endif
/*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
#define LV_USE_OBJ_REALIGN 1

View File

@ -31,6 +31,11 @@
#include LV_GC_INCLUDE
#endif /* LV_ENABLE_GC */
#if defined(LV_USER_DATA_FREE_INCLUDE)
#include LV_USER_DATA_FREE_INCLUDE
#endif /* LV_USE_USER_DATA_FREE */
/*********************
* DEFINES
*********************/
@ -335,10 +340,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
/*Set the same coordinates for non screen objects*/
if(lv_obj_get_parent(copy) != NULL && parent != NULL) {
lv_obj_set_pos(new_obj, lv_obj_get_x(copy), lv_obj_get_y(copy));
} else {
lv_obj_set_pos(new_obj, 0, 0);
}
}
/*Send a signal to the parent to notify it about the new child*/
@ -375,6 +377,11 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
lv_anim_del(obj, NULL);
#endif
/*Delete the user data*/
#if LV_USE_USER_DATA_FREE
LV_USER_DATA_FREE(obj);
#endif
/*Recursively delete the children*/
lv_obj_t * i;
lv_obj_t * i_next;

View File

@ -680,7 +680,7 @@ lv_res_t lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop,
int16_t weight_act;
int16_t weight = -1;
lv_style_int_t value_act;
lv_style_int_t value_act = 0;
int16_t ci;
for(ci = 0; ci < list->style_cnt; ci++) {
@ -728,7 +728,7 @@ lv_res_t lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t pro
int16_t weight_act;
int16_t weight = -1;
lv_color_t value_act;
lv_color_t value_act = { 0 };
int16_t ci;
for(ci = 0; ci < list->style_cnt; ci++) {