minor fixes
This commit is contained in:
11
lvgl.mk
11
lvgl.mk
@@ -1,10 +1 @@
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core/lv_core.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_hal/lv_hal.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_widgets/lv_widgets.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_font/lv_font.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc/lv_misc.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_themes/lv_themes.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_draw/lv_draw.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_gpu/lv_gpu.mk
|
||||
|
||||
|
||||
CSRCS += $(shell find -L lvgl -name \*.c)
|
||||
|
||||
@@ -66,14 +66,14 @@ void _lv_flex_refresh(lv_obj_t * cont)
|
||||
{
|
||||
if(cont->flex_cont.dir == LV_FLEX_DIR_NONE) return;
|
||||
|
||||
lv_flex_dir_t dir = cont->flex_cont.dir;
|
||||
lv_flex_dir_t dir = cont->flex_cont.dir & 0x3;
|
||||
bool row = dir == LV_FLEX_DIR_ROW ? true : false;
|
||||
/*Count the grow units and free space*/
|
||||
lv_coord_t max_main_size = (row ? lv_obj_get_width_fit(cont) : lv_obj_get_height_fit(cont));
|
||||
lv_coord_t abs_x = cont->coords.x1 + lv_obj_get_style_pad_left(cont, LV_OBJ_PART_MAIN) - lv_obj_get_scroll_left(cont);
|
||||
lv_coord_t abs_y = cont->coords.y1 + lv_obj_get_style_pad_top(cont, LV_OBJ_PART_MAIN) - lv_obj_get_scroll_top(cont);
|
||||
|
||||
lv_coord_t * cross_pos = (dir == LV_FLEX_DIR_ROW ? &abs_y : &abs_x);
|
||||
lv_coord_t * cross_pos = (row ? &abs_y : &abs_x);
|
||||
|
||||
lv_coord_t place = cont->flex_cont.place;
|
||||
if((row && cont->h_set == LV_SIZE_AUTO) ||
|
||||
@@ -125,7 +125,7 @@ void _lv_flex_refresh(lv_obj_t * cont)
|
||||
static lv_obj_t * find_track_end(lv_obj_t * cont, lv_obj_t * item_start, lv_coord_t max_size, lv_coord_t * grow_unit, lv_coord_t * track_cross_size)
|
||||
{
|
||||
lv_flex_dir_t dir = cont->flex_cont.dir;
|
||||
bool row = dir == LV_FLEX_DIR_ROW ? true : false;
|
||||
bool row = (dir & 0x3) == LV_FLEX_DIR_ROW ? true : false;
|
||||
lv_coord_t(*get_main_size)(const lv_obj_t *) = (row ? lv_obj_get_width_margin : lv_obj_get_height_margin);
|
||||
lv_coord_t(*get_cross_size)(const lv_obj_t *) = (!row ? lv_obj_get_width_margin : lv_obj_get_height_margin);
|
||||
void * (*ll_iter)(const lv_ll_t * , const void *) = dir & LV_FLEX_REVERSE ? _lv_ll_get_next : _lv_ll_get_prev;
|
||||
@@ -184,7 +184,7 @@ static lv_obj_t * find_track_end(lv_obj_t * cont, lv_obj_t * item_start, lv_coor
|
||||
static void children_repos(lv_obj_t * cont, lv_obj_t * item_first, lv_obj_t * item_last, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t track_size, lv_coord_t grow_unit)
|
||||
{
|
||||
lv_flex_dir_t dir = cont->flex_cont.dir;
|
||||
bool row = dir == LV_FLEX_DIR_ROW ? true : false;
|
||||
bool row = (dir & 0x3) == LV_FLEX_DIR_ROW ? true : false;
|
||||
lv_coord_t(*obj_get_main_size)(const lv_obj_t *) = (row ? lv_obj_get_width_margin : lv_obj_get_height_margin);
|
||||
lv_coord_t(*obj_get_cross_size)(const lv_obj_t *) = (!row ? lv_obj_get_width_margin : lv_obj_get_height_margin);
|
||||
void (*area_set_main_size)(lv_area_t *, lv_coord_t) = (row ? lv_area_set_width : lv_area_set_height);
|
||||
@@ -234,9 +234,13 @@ static void children_repos(lv_obj_t * cont, lv_obj_t * item_first, lv_obj_t * it
|
||||
lv_coord_t diff_x;
|
||||
lv_coord_t diff_y;
|
||||
if(row) {
|
||||
cross_pos += lv_obj_get_style_margin_top(item, LV_OBJ_PART_MAIN);
|
||||
main_pos += lv_obj_get_style_margin_left(item, LV_OBJ_PART_MAIN);
|
||||
diff_x = abs_x + main_pos - item->coords.x1;
|
||||
diff_y = abs_y + cross_pos - item->coords.y1;
|
||||
} else {
|
||||
main_pos += lv_obj_get_style_margin_top(item, LV_OBJ_PART_MAIN);
|
||||
cross_pos += lv_obj_get_style_margin_left(item, LV_OBJ_PART_MAIN);
|
||||
diff_x = abs_x + cross_pos - item->coords.x1;
|
||||
diff_y = abs_y + main_pos - item->coords.y1;
|
||||
}
|
||||
|
||||
@@ -896,11 +896,9 @@ void lv_event_send_refresh_recursive(lv_obj_t * obj)
|
||||
lv_res_t res = lv_event_send_refresh(obj);
|
||||
if(res != LV_RES_OK) return; /*If invalid returned do not check the children*/
|
||||
|
||||
lv_obj_t * child = lv_obj_get_child(obj, NULL);
|
||||
while(child) {
|
||||
lv_obj_t * child;
|
||||
_LV_LL_READ(obj->child_ll, child) {
|
||||
lv_event_send_refresh_recursive(child);
|
||||
|
||||
child = lv_obj_get_child(obj, child);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1173,11 +1171,11 @@ uint32_t lv_obj_get_child_id(const lv_obj_t * obj)
|
||||
if(parent == NULL) return 0;
|
||||
|
||||
uint32_t id = 0;
|
||||
lv_obj_t * child = lv_obj_get_child_back(parent, NULL);
|
||||
while(child) {
|
||||
lv_obj_t * child;
|
||||
|
||||
_LV_LL_READ_BACK(obj->child_ll, child) {
|
||||
if(child == obj) return id;
|
||||
id++;
|
||||
child = lv_obj_get_child_back(parent, child);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
@@ -1187,7 +1185,7 @@ uint32_t lv_obj_get_child_id(const lv_obj_t * obj)
|
||||
* @param obj pointer to an object
|
||||
* @return children number of 'obj'
|
||||
*/
|
||||
uint16_t lv_obj_count_children(const lv_obj_t * obj)
|
||||
uint32_t lv_obj_count_children(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
@@ -1203,7 +1201,7 @@ uint16_t lv_obj_count_children(const lv_obj_t * obj)
|
||||
* @param obj pointer to an object
|
||||
* @return children number of 'obj'
|
||||
*/
|
||||
uint16_t lv_obj_count_children_recursive(const lv_obj_t * obj)
|
||||
uint32_t lv_obj_count_children_recursive(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
@@ -1509,6 +1507,24 @@ bool lv_obj_is_focused(const lv_obj_t * obj)
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell if an object is an instance of a certain widget type or not
|
||||
* @param obj pointer to an object
|
||||
* @param type_str the type to check. The name of the widget's type, g.g. "lv_label", "lv_btn", etc
|
||||
* @return true: `obj` has the given type
|
||||
* @note Not only the "final" type matters. Therefore every widget has "lv_obj" type and "lv_slider" is an "lv_bar" too.
|
||||
*/
|
||||
bool lv_obj_is_instance_of(lv_obj_t * obj, const char * type_str)
|
||||
{
|
||||
lv_obj_type_t type;
|
||||
lv_obj_get_type(obj, &type);
|
||||
uint8_t cnt;
|
||||
for(cnt = 0; cnt < LV_MAX_ANCESTOR_NUM; cnt++) {
|
||||
if(type.type[cnt] == NULL) break;
|
||||
if(!strcmp(type.type[cnt], type_str)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*-------------------
|
||||
* OTHER FUNCTIONS
|
||||
@@ -1610,7 +1626,8 @@ static void lv_obj_del_async_cb(void * obj)
|
||||
static void obj_del_core(lv_obj_t * obj)
|
||||
{
|
||||
/*Let the user free the resources used in `LV_EVENT_DELETE`*/
|
||||
lv_event_send(obj, LV_EVENT_DELETE, NULL);
|
||||
lv_res_t res = lv_event_send(obj, LV_EVENT_DELETE, NULL);
|
||||
if(res == LV_RES_INV) return;
|
||||
|
||||
/*Delete from the group*/
|
||||
#if LV_USE_GROUP
|
||||
@@ -1825,15 +1842,11 @@ static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area
|
||||
static void base_dir_refr_children(lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_t * child;
|
||||
child = lv_obj_get_child(obj, NULL);
|
||||
|
||||
while(child) {
|
||||
_LV_LL_READ(obj->child_ll, child) {
|
||||
if(child->base_dir == LV_BIDI_DIR_INHERIT) {
|
||||
lv_signal_send(child, LV_SIGNAL_BASE_DIR_CHG, NULL);
|
||||
base_dir_refr_children(child);
|
||||
}
|
||||
|
||||
child = lv_obj_get_child(obj, child);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1991,12 +2004,12 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
|
||||
if(obj->grid) _lv_grid_full_refresh(obj);
|
||||
|
||||
/*Reposition non grid objects on by one*/
|
||||
lv_obj_t * child = lv_obj_get_child(obj, NULL);
|
||||
while(child) {
|
||||
lv_obj_t * child;
|
||||
|
||||
_LV_LL_READ(obj->child_ll, child) {
|
||||
if(!LV_COORD_IS_GRID(child->x_set) || !LV_COORD_IS_GRID(child->y_set)) {
|
||||
lv_obj_set_pos(child, child->x_set, child->y_set);
|
||||
}
|
||||
child = lv_obj_get_child(obj, child);
|
||||
}
|
||||
|
||||
if(obj->w_set == LV_SIZE_AUTO || obj->h_set == LV_SIZE_AUTO) {
|
||||
|
||||
@@ -616,13 +616,13 @@ uint32_t lv_obj_get_child_id(const lv_obj_t * obj);
|
||||
* @param obj pointer to an object
|
||||
* @return children number of 'obj'
|
||||
*/
|
||||
uint16_t lv_obj_count_children(const lv_obj_t * obj);
|
||||
uint32_t lv_obj_count_children(const lv_obj_t * obj);
|
||||
|
||||
/** Recursively count the children of an object
|
||||
* @param obj pointer to an object
|
||||
* @return children number of 'obj'
|
||||
*/
|
||||
uint16_t lv_obj_count_children_recursive(const lv_obj_t * obj);
|
||||
uint32_t lv_obj_count_children_recursive(const lv_obj_t * obj);
|
||||
|
||||
/*---------------------
|
||||
* Coordinate get
|
||||
@@ -751,6 +751,15 @@ void * lv_obj_get_group(const lv_obj_t * obj);
|
||||
*/
|
||||
bool lv_obj_is_focused(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Tell if an object is an instance of a certain widget type or not
|
||||
* @param obj pointer to an object
|
||||
* @param type_str the type to check. The name of the widget's type, g.g. "lv_label", "lv_btn", etc
|
||||
* @return true: `obj` has the given type
|
||||
* @note Not only the "final" type matters. Therefore every widget has "lv_obj" type and "lv_slider" is an "lv_bar" too.
|
||||
*/
|
||||
bool lv_obj_is_instance_of(lv_obj_t * obj, const char * type_str);
|
||||
|
||||
/**
|
||||
* Get the really focused object by taking `focus_parent` into account.
|
||||
* @param obj the start object
|
||||
|
||||
@@ -1454,7 +1454,7 @@ static void update_style_cache(lv_obj_t * obj, uint8_t part, uint16_t prop)
|
||||
#endif
|
||||
if(pad_top != 0 ||
|
||||
pad_left != 0 ||
|
||||
lv_obj_get_style_pad_left(obj, part) != 0 ||
|
||||
lv_obj_get_style_pad_bottom(obj, part) != 0 ||
|
||||
lv_obj_get_style_pad_right(obj, part) != 0) {
|
||||
list->pad_all_zero = 0;
|
||||
}
|
||||
|
||||
@@ -196,8 +196,7 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
|
||||
}
|
||||
|
||||
lv_coord_t row_y1 = top + (max_h_no_gap * row) / row_cnt + row * row_gap;
|
||||
lv_coord_t row_y2 = top + (max_h_no_gap * (row + 1)) / row_cnt + row * row_gap;
|
||||
|
||||
lv_coord_t row_y2 = top + (max_h_no_gap * (row + 1)) / row_cnt + row * row_gap - 1;
|
||||
|
||||
/*Set the button size and positions*/
|
||||
lv_coord_t max_w_no_gap = max_w - (col_gap * (btn_cnt - 1));
|
||||
@@ -209,7 +208,7 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
|
||||
uint32_t btn_u = get_button_width(ext->ctrl_bits[btn_tot_i]);
|
||||
|
||||
lv_coord_t btn_x1 = left + (max_w_no_gap * row_unit_cnt) / unit_cnt + btn * col_gap;
|
||||
lv_coord_t btn_x2 = left + (max_w_no_gap * (row_unit_cnt + btn_u)) / unit_cnt + btn * col_gap;
|
||||
lv_coord_t btn_x2 = left + (max_w_no_gap * (row_unit_cnt + btn_u)) / unit_cnt + btn * col_gap - 1;
|
||||
|
||||
/*If RTL start from the right*/
|
||||
if(base_dir == LV_BIDI_DIR_RTL) {
|
||||
|
||||
@@ -207,6 +207,14 @@ bool lv_btnmatrix_get_recolor(const lv_obj_t * btnm);
|
||||
*/
|
||||
uint16_t lv_btnmatrix_get_active_btn(const lv_obj_t * btnm);
|
||||
|
||||
/**
|
||||
* Get the text of the lastly "activated" button by the user (pressed, released etc)
|
||||
* Useful in the the `event_cb`
|
||||
* @param btnm pointer to button matrix object
|
||||
* @return text of the last released button (NULL: if unset)
|
||||
*/
|
||||
const char * lv_btnmatrix_get_active_btn_text(const lv_obj_t * btnm);
|
||||
|
||||
/**
|
||||
* Get the focused button's index.
|
||||
* @param btnm pointer to button matrix object
|
||||
|
||||
Reference in New Issue
Block a user