From ca84aaf6e87f937c1906a92b56fd29de7b5a0a63 Mon Sep 17 00:00:00 2001 From: Alexey Papkovskiy <50448930+apapkovskiy@users.noreply.github.com> Date: Thu, 16 Jan 2020 18:40:25 +0100 Subject: [PATCH 01/19] fix calculation of font kerning values (#1356) --- src/lv_font/lv_font_fmt_txt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lv_font/lv_font_fmt_txt.c b/src/lv_font/lv_font_fmt_txt.c index fb02c743c..a36be57c8 100644 --- a/src/lv_font/lv_font_fmt_txt.c +++ b/src/lv_font/lv_font_fmt_txt.c @@ -257,7 +257,7 @@ static int8_t get_kern_value(const lv_font_t * font, uint32_t gid_left, uint32_t /*Kern classes*/ const lv_font_fmt_txt_kern_classes_t * kdsc = fdsc->kern_dsc; uint8_t left_class = kdsc->left_class_mapping[gid_left]; - uint8_t right_class = kdsc->left_class_mapping[gid_right]; + uint8_t right_class = kdsc->right_class_mapping[gid_right]; /* If class = 0, kerning not exist for that glyph * else got the value form `class_pair_values` 2D array*/ From c75d868c2a33b2add838a74b41fbe1581277c98d Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Thu, 16 Jan 2020 19:07:38 -0500 Subject: [PATCH 02/19] Make unclickable drop down lists work --- src/lv_objx/lv_ddlist.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lv_objx/lv_ddlist.c b/src/lv_objx/lv_ddlist.c index 22ff7fd39..fb57cd2fa 100644 --- a/src/lv_objx/lv_ddlist.c +++ b/src/lv_objx/lv_ddlist.c @@ -807,6 +807,10 @@ static lv_res_t release_handler(lv_obj_t * ddlist) { lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist); + /*Only deal with clickable drop down lists*/ + if(!lv_obj_get_click(ddlist)) + return LV_RES_OK; + if(ext->opened == 0) { /*Open the list*/ ext->opened = 1; lv_obj_set_drag(lv_page_get_scrl(ddlist), true); From 33f5448a382fda5b2dae405c1510a1927d7f0fa2 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 17 Jan 2020 15:49:36 +0100 Subject: [PATCH 03/19] fix overflow on 16 bit MCU in font processing --- src/lv_font/lv_font_fmt_txt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lv_font/lv_font_fmt_txt.c b/src/lv_font/lv_font_fmt_txt.c index a36be57c8..78fcccdd0 100644 --- a/src/lv_font/lv_font_fmt_txt.c +++ b/src/lv_font/lv_font_fmt_txt.c @@ -475,5 +475,5 @@ static uint8_t rle_next(void) */ static int32_t unicode_list_compare(const void * ref, const void * element) { - return (*(uint16_t *)ref) - (*(uint16_t *)element); + return ((int32_t)(*(uint16_t *)ref)) - ((int32_t)(*(uint16_t *)element)); } From 9b283981e80af23799bc55c5dd3b24dedc0ad813 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 20 Jan 2020 14:47:05 +0100 Subject: [PATCH 04/19] add lv_obj_invalidate_area to replace lv_inv_area in objects. Fixes #1360 --- src/lv_core/lv_obj.c | 61 +++++++++++++++++++++++++++++----------- src/lv_core/lv_obj.h | 9 ++++++ src/lv_objx/lv_btnm.c | 2 +- src/lv_objx/lv_chart.c | 4 +-- src/lv_objx/lv_cpicker.c | 2 +- src/lv_objx/lv_page.c | 12 ++++---- src/lv_objx/lv_ta.c | 8 ++---- 7 files changed, 66 insertions(+), 32 deletions(-) diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index c9880a346..510a87062 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -521,10 +521,12 @@ void lv_obj_clean(lv_obj_t * obj) } /** - * Mark the object as invalid therefore its current position will be redrawn by 'lv_refr_task' + * Mark an area of an object as invalid. + * This area will be redrawn by 'lv_refr_task' * @param obj pointer to an object + * @param area the area to redraw */ -void lv_obj_invalidate(const lv_obj_t * obj) +void lv_obj_invalidate_area(const lv_obj_t * obj, const lv_area_t * area) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); @@ -535,31 +537,56 @@ void lv_obj_invalidate(const lv_obj_t * obj) lv_disp_t * disp = lv_obj_get_disp(obj_scr); if(obj_scr == lv_disp_get_scr_act(disp) || obj_scr == lv_disp_get_layer_top(disp) || obj_scr == lv_disp_get_layer_sys(disp)) { - /*Truncate recursively to the parents*/ - lv_area_t area_trunc; - lv_obj_t * par = lv_obj_get_parent(obj); - bool union_ok = true; - /*Start with the original coordinates*/ - lv_coord_t ext_size = obj->ext_draw_pad; - lv_area_copy(&area_trunc, &obj->coords); - area_trunc.x1 -= ext_size; - area_trunc.y1 -= ext_size; - area_trunc.x2 += ext_size; - area_trunc.y2 += ext_size; - /*Check through all parents*/ + /*Truncate the area to the object*/ + lv_area_t obj_coords; + lv_coord_t ext_size = obj->ext_draw_pad; + lv_area_copy(&obj_coords, &obj->coords); + obj_coords.x1 -= ext_size; + obj_coords.y1 -= ext_size; + obj_coords.x2 += ext_size; + obj_coords.y2 += ext_size; + + bool is_common; + lv_area_t area_trunc; + + is_common = lv_area_intersect(&area_trunc, area, &obj_coords); + if(is_common == false) return; /*The area is not on the object*/ + + /*Truncate recursively to the parents*/ + lv_obj_t * par = lv_obj_get_parent(obj); while(par != NULL) { - union_ok = lv_area_intersect(&area_trunc, &area_trunc, &par->coords); - if(union_ok == false) break; /*If no common parts with parent break;*/ + is_common = lv_area_intersect(&area_trunc, &area_trunc, &par->coords); + if(is_common == false) break; /*If no common parts with parent break;*/ if(lv_obj_get_hidden(par)) return; /*If the parent is hidden then the child is hidden and won't be drawn*/ par = lv_obj_get_parent(par); } - if(union_ok) lv_inv_area(disp, &area_trunc); + if(is_common) lv_inv_area(disp, &area_trunc); } } +/** + * Mark the object as invalid therefore its current position will be redrawn by 'lv_refr_task' + * @param obj pointer to an object + */ +void lv_obj_invalidate(const lv_obj_t * obj) +{ + LV_ASSERT_OBJ(obj, LV_OBJX_NAME); + + /*Truncate the area to the object*/ + lv_area_t obj_coords; + lv_coord_t ext_size = obj->ext_draw_pad; + lv_area_copy(&obj_coords, &obj->coords); + obj_coords.x1 -= ext_size; + obj_coords.y1 -= ext_size; + obj_coords.x2 += ext_size; + obj_coords.y2 += ext_size; + + lv_obj_invalidate_area(obj, &obj_coords); + +} /*===================== * Setter functions *====================*/ diff --git a/src/lv_core/lv_obj.h b/src/lv_core/lv_obj.h index 3bc8270e4..24517241d 100644 --- a/src/lv_core/lv_obj.h +++ b/src/lv_core/lv_obj.h @@ -312,6 +312,15 @@ void lv_obj_del_async(struct _lv_obj_t *obj); */ void lv_obj_clean(lv_obj_t * obj); + +/** + * Mark an area of an object as invalid. + * This area will be redrawn by 'lv_refr_task' + * @param obj pointer to an object + * @param area the area to redraw + */ +void lv_obj_invalidate_area(const lv_obj_t * obj, const lv_area_t * area); + /** * Mark the object as invalid therefore its current position will be redrawn by 'lv_refr_task' * @param obj pointer to an object diff --git a/src/lv_objx/lv_btnm.c b/src/lv_objx/lv_btnm.c index 27016315b..d8d5f7004 100644 --- a/src/lv_objx/lv_btnm.c +++ b/src/lv_objx/lv_btnm.c @@ -1084,7 +1084,7 @@ static void invalidate_button_area(const lv_obj_t * btnm, uint16_t btn_idx) btn_area.x2 += btnm_area.x1; btn_area.y2 += btnm_area.y1; - lv_inv_area(lv_obj_get_disp(btnm), &btn_area); + lv_obj_invalidate_area(btnm, &btn_area); } /** diff --git a/src/lv_objx/lv_chart.c b/src/lv_objx/lv_chart.c index 00fbed195..2dfdef0e9 100644 --- a/src/lv_objx/lv_chart.c +++ b/src/lv_objx/lv_chart.c @@ -1496,13 +1496,13 @@ static void lv_chart_inv_lines(lv_obj_t * chart, uint16_t i) if(i < ext->point_cnt - 1) { coords.x1 = ((w * i) / (ext->point_cnt - 1)) + x_ofs - ext->series.width; coords.x2 = ((w * (i + 1)) / (ext->point_cnt - 1)) + x_ofs + ext->series.width; - lv_inv_area(lv_obj_get_disp(chart), &coords); + lv_obj_invalidate_area(chart, &coords); } if(i > 0) { coords.x1 = ((w * (i - 1)) / (ext->point_cnt - 1)) + x_ofs - ext->series.width; coords.x2 = ((w * i) / (ext->point_cnt - 1)) + x_ofs + ext->series.width; - lv_inv_area(lv_obj_get_disp(chart), &coords); + lv_obj_invalidate_area(chart, &coords); } } } diff --git a/src/lv_objx/lv_cpicker.c b/src/lv_objx/lv_cpicker.c index fa574bf90..658266734 100644 --- a/src/lv_objx/lv_cpicker.c +++ b/src/lv_objx/lv_cpicker.c @@ -750,7 +750,7 @@ static void invalidate_indic(lv_obj_t * cpicker) { lv_area_t indic_area = get_indic_area(cpicker); - lv_inv_area(lv_obj_get_disp(cpicker), &indic_area); + lv_obj_invalidate_area(cpicker, &indic_area); } static lv_area_t get_indic_area(lv_obj_t * cpicker) diff --git a/src/lv_objx/lv_page.c b/src/lv_objx/lv_page.c index e9a21a2fe..3bb69e813 100644 --- a/src/lv_objx/lv_page.c +++ b/src/lv_objx/lv_page.c @@ -1081,7 +1081,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi sb_area_tmp.y1 += page->coords.y1; sb_area_tmp.x2 += page->coords.x1; sb_area_tmp.y2 += page->coords.y1; - lv_inv_area(disp, &sb_area_tmp); + lv_obj_invalidate_area(page, &sb_area_tmp); page_ext->sb.hor_draw = 0; } if(page_ext->sb.ver_draw) { @@ -1090,7 +1090,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi sb_area_tmp.y1 += page->coords.y1; sb_area_tmp.x2 += page->coords.x1; sb_area_tmp.y2 += page->coords.y1; - lv_inv_area(disp, &sb_area_tmp); + lv_obj_invalidate_area(page, &sb_area_tmp); page_ext->sb.ver_draw = 0; } } @@ -1158,7 +1158,7 @@ static void lv_page_sb_refresh(lv_obj_t * page) sb_area_tmp.y1 += page->coords.y1; sb_area_tmp.x2 += page->coords.x1; sb_area_tmp.y2 += page->coords.y1; - lv_inv_area(disp, &sb_area_tmp); + lv_obj_invalidate_area(page, &sb_area_tmp); } if(ext->sb.ver_draw != 0) { lv_area_copy(&sb_area_tmp, &ext->sb.ver_area); @@ -1166,7 +1166,7 @@ static void lv_page_sb_refresh(lv_obj_t * page) sb_area_tmp.y1 += page->coords.y1; sb_area_tmp.x2 += page->coords.x1; sb_area_tmp.y2 += page->coords.y1; - lv_inv_area(disp, &sb_area_tmp); + lv_obj_invalidate_area(page, &sb_area_tmp); } if(ext->sb.mode == LV_SB_MODE_DRAG && lv_indev_is_dragging(lv_indev_get_act()) == false) { @@ -1228,7 +1228,7 @@ static void lv_page_sb_refresh(lv_obj_t * page) sb_area_tmp.y1 += page->coords.y1; sb_area_tmp.x2 += page->coords.x1; sb_area_tmp.y2 += page->coords.y1; - lv_inv_area(disp, &sb_area_tmp); + lv_obj_invalidate_area(page, &sb_area_tmp); } if(ext->sb.ver_draw != 0) { lv_area_copy(&sb_area_tmp, &ext->sb.ver_area); @@ -1236,7 +1236,7 @@ static void lv_page_sb_refresh(lv_obj_t * page) sb_area_tmp.y1 += page->coords.y1; sb_area_tmp.x2 += page->coords.x1; sb_area_tmp.y2 += page->coords.y1; - lv_inv_area(disp, &sb_area_tmp); + lv_obj_invalidate_area(page, &sb_area_tmp); } } diff --git a/src/lv_objx/lv_ta.c b/src/lv_objx/lv_ta.c index a99c37e92..f7bd63d49 100644 --- a/src/lv_objx/lv_ta.c +++ b/src/lv_objx/lv_ta.c @@ -1591,14 +1591,13 @@ static void cursor_blink_anim(lv_obj_t * ta, lv_anim_value_t show) if(show != ext->cursor.state) { ext->cursor.state = show == 0 ? 0 : 1; if(ext->cursor.type != LV_CURSOR_NONE && (ext->cursor.type & LV_CURSOR_HIDDEN) == 0) { - lv_disp_t * disp = lv_obj_get_disp(ta); lv_area_t area_tmp; lv_area_copy(&area_tmp, &ext->cursor.area); area_tmp.x1 += ext->label->coords.x1; area_tmp.y1 += ext->label->coords.y1; area_tmp.x2 += ext->label->coords.x1; area_tmp.y2 += ext->label->coords.y1; - lv_inv_area(disp, &area_tmp); + lv_obj_invalidate_area(ta, &area_tmp); } } } @@ -1793,14 +1792,13 @@ static void refr_cursor_area(lv_obj_t * ta) } /*Save the new area*/ - lv_disp_t * disp = lv_obj_get_disp(ta); lv_area_t area_tmp; lv_area_copy(&area_tmp, &ext->cursor.area); area_tmp.x1 += ext->label->coords.x1; area_tmp.y1 += ext->label->coords.y1; area_tmp.x2 += ext->label->coords.x1; area_tmp.y2 += ext->label->coords.y1; - lv_inv_area(disp, &area_tmp); + lv_obj_invalidate_area(ta, &area_tmp); lv_area_copy(&ext->cursor.area, &cur_area); @@ -1809,7 +1807,7 @@ static void refr_cursor_area(lv_obj_t * ta) area_tmp.y1 += ext->label->coords.y1; area_tmp.x2 += ext->label->coords.x1; area_tmp.y2 += ext->label->coords.y1; - lv_inv_area(disp, &area_tmp); + lv_obj_invalidate_area(ta, &area_tmp); } static void placeholder_update(lv_obj_t * ta) From a53fca8c7f2cca95a6b96d6e438c09c532b2057e Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 20 Jan 2020 14:51:37 +0100 Subject: [PATCH 05/19] fix buffer out of bound error in lv_bidi_get_visual/logicl_pos(). Fixes #1351 --- src/lv_misc/lv_bidi.c | 12 ++++++++---- src/lv_objx/lv_page.c | 2 -- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lv_misc/lv_bidi.c b/src/lv_misc/lv_bidi.c index bde752071..6e50d926c 100644 --- a/src/lv_misc/lv_bidi.c +++ b/src/lv_misc/lv_bidi.c @@ -148,9 +148,11 @@ bool lv_bidi_letter_is_neutral(uint32_t letter) uint16_t lv_bidi_get_logical_pos(const char * str_in, char **bidi_txt, uint32_t len, lv_bidi_dir_t base_dir, uint32_t visual_pos, bool *is_rtl) { uint32_t pos_conv_len = get_txt_len(str_in, len); - void *buf = lv_draw_get_buf(len + pos_conv_len * sizeof(uint16_t)); + uint32_t txt_buf_size = len + 1; + txt_buf_size = (txt_buf_size + 3) & (~0x3); + void *buf = lv_draw_get_buf(txt_buf_size + pos_conv_len * sizeof(uint16_t)); if (bidi_txt) *bidi_txt = buf; - uint16_t *pos_conv_buf = (uint16_t*) ((char*)buf + len); + uint16_t *pos_conv_buf = (uint16_t*) ((char*)buf + txt_buf_size); lv_bidi_process_paragraph(str_in, bidi_txt? *bidi_txt: NULL, len, base_dir, pos_conv_buf, pos_conv_len); if (is_rtl) *is_rtl = IS_RTL_POS(pos_conv_buf[visual_pos]); return GET_POS(pos_conv_buf[visual_pos]); @@ -159,9 +161,11 @@ uint16_t lv_bidi_get_logical_pos(const char * str_in, char **bidi_txt, uint32_t uint16_t lv_bidi_get_visual_pos(const char * str_in, char **bidi_txt, uint16_t len, lv_bidi_dir_t base_dir, uint32_t logical_pos, bool *is_rtl) { uint32_t pos_conv_len = get_txt_len(str_in, len); - void *buf = lv_draw_get_buf(len + pos_conv_len * sizeof(uint16_t)); + uint32_t txt_buf_size = len + 1; + txt_buf_size = (txt_buf_size + 3) & (~0x3); + void *buf = lv_draw_get_buf(txt_buf_size + pos_conv_len * sizeof(uint16_t)); if (bidi_txt) *bidi_txt = buf; - uint16_t *pos_conv_buf = (uint16_t*) ((char*)buf + len); + uint16_t *pos_conv_buf = (uint16_t*) ((char*)buf + txt_buf_size); lv_bidi_process_paragraph(str_in, bidi_txt? *bidi_txt: NULL, len, base_dir, pos_conv_buf, pos_conv_len); for (uint16_t i = 0; i < pos_conv_len; i++){ if (GET_POS(pos_conv_buf[i]) == logical_pos){ diff --git a/src/lv_objx/lv_page.c b/src/lv_objx/lv_page.c index 3bb69e813..0ef420a1b 100644 --- a/src/lv_objx/lv_page.c +++ b/src/lv_objx/lv_page.c @@ -1073,7 +1073,6 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi /*Hide scrollbars if required*/ if(page_ext->sb.mode == LV_SB_MODE_DRAG) { - lv_disp_t * disp = lv_obj_get_disp(page); lv_area_t sb_area_tmp; if(page_ext->sb.hor_draw) { lv_area_copy(&sb_area_tmp, &page_ext->sb.hor_area); @@ -1150,7 +1149,6 @@ static void lv_page_sb_refresh(lv_obj_t * page) } /*Invalidate the current (old) scrollbar areas*/ - lv_disp_t * disp = lv_obj_get_disp(page); lv_area_t sb_area_tmp; if(ext->sb.hor_draw != 0) { lv_area_copy(&sb_area_tmp, &ext->sb.hor_area); From 10b9c9b2f5344e7b2f5cc00a19ed86ed56ae9866 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 21 Jan 2020 07:00:57 +0100 Subject: [PATCH 06/19] fix crash on page delete --- src/lv_objx/lv_page.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lv_objx/lv_page.c b/src/lv_objx/lv_page.c index 0ef420a1b..b39eab51f 100644 --- a/src/lv_objx/lv_page.c +++ b/src/lv_objx/lv_page.c @@ -828,6 +828,7 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) lv_page_ext_t * ext = lv_obj_get_ext_attr(page); lv_obj_t * child; if(sign == LV_SIGNAL_CHILD_CHG) { /*Automatically move children to the scrollable object*/ + if(ext->scrl == NULL) return LV_RES_OK; const lv_style_t * style_bg = lv_page_get_style(page, LV_PAGE_STYLE_BG); const lv_style_t * style_scrl = lv_page_get_style(page, LV_PAGE_STYLE_SCRL); lv_fit_t fit_left = lv_page_get_scrl_fit_left(page); @@ -1093,6 +1094,8 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi page_ext->sb.ver_draw = 0; } } + } else if(sign == LV_SIGNAL_CLEANUP) { + page_ext->scrl = NULL; } return res; From eb67692baa8dfb7e2f324c36375dfe6d7a8bdcd8 Mon Sep 17 00:00:00 2001 From: Deon Marais Date: Wed, 29 Jan 2020 17:43:36 +0200 Subject: [PATCH 07/19] Removed incorrect assert Removed incorrect assert in lv_label_set_static_text --- src/lv_objx/lv_label.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lv_objx/lv_label.c b/src/lv_objx/lv_label.c index aa677b094..c4e408707 100644 --- a/src/lv_objx/lv_label.c +++ b/src/lv_objx/lv_label.c @@ -308,7 +308,6 @@ void lv_label_set_array_text(lv_obj_t * label, const char * array, uint16_t size void lv_label_set_static_text(lv_obj_t * label, const char * text) { LV_ASSERT_OBJ(label, LV_OBJX_NAME); - LV_ASSERT_STR(text); lv_label_ext_t * ext = lv_obj_get_ext_attr(label); if(ext->static_txt == 0 && ext->text != NULL) { From 1765dde018cf6d084d3a48371eca54e1bdfb668f Mon Sep 17 00:00:00 2001 From: Deon Marais Date: Wed, 29 Jan 2020 17:47:20 +0200 Subject: [PATCH 08/19] Fix compiler warning in lv_color_to16 --- src/lv_misc/lv_color.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lv_misc/lv_color.h b/src/lv_misc/lv_color.h index 94f6c8c1a..05f6e320a 100644 --- a/src/lv_misc/lv_color.h +++ b/src/lv_misc/lv_color.h @@ -373,9 +373,10 @@ static inline uint16_t lv_color_to16(lv_color_t color) #endif LV_COLOR_SET_B16(ret, LV_COLOR_GET_B(color) >> 3); /* 8 - 5 = 3*/ return ret.full; -#endif - +#else return 0; +#endif + } static inline uint32_t lv_color_to32(lv_color_t color) From 6b4ec1ee2eda674de57dfa472b44f831010147cc Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 30 Jan 2020 05:39:38 +0100 Subject: [PATCH 09/19] ta: fix disabling cursor blink. Closes #1361 --- src/lv_objx/lv_ta.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lv_objx/lv_ta.c b/src/lv_objx/lv_ta.c index f7bd63d49..162d8f640 100644 --- a/src/lv_objx/lv_ta.c +++ b/src/lv_objx/lv_ta.c @@ -945,6 +945,7 @@ void lv_ta_set_cursor_blink_time(lv_obj_t * ta, uint16_t time) a.path_cb = lv_anim_path_step; lv_anim_create(&a); } else { + lv_anim_del(ta, cursor_blink_anim); ext->cursor.state = 1; } #else From dde953f0e2b11e35ea2b1bdc9c97c21c0eab9f02 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 30 Jan 2020 05:41:24 +0100 Subject: [PATCH 10/19] fix warning --- src/lv_objx/lv_ta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lv_objx/lv_ta.c b/src/lv_objx/lv_ta.c index 162d8f640..600f6e4e9 100644 --- a/src/lv_objx/lv_ta.c +++ b/src/lv_objx/lv_ta.c @@ -945,7 +945,7 @@ void lv_ta_set_cursor_blink_time(lv_obj_t * ta, uint16_t time) a.path_cb = lv_anim_path_step; lv_anim_create(&a); } else { - lv_anim_del(ta, cursor_blink_anim); + lv_anim_del(ta, (lv_anim_exec_xcb_t)cursor_blink_anim); ext->cursor.state = 1; } #else From eb44a75bf62946de74b44a664bba62d947723f32 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 30 Jan 2020 05:48:49 +0100 Subject: [PATCH 11/19] ta, tabview, tileview, win: fix creating as screen. Closes #1363 --- src/lv_objx/lv_tabview.c | 13 +++++++++++-- src/lv_objx/lv_tileview.c | 13 +++++++++++-- src/lv_objx/lv_win.c | 13 +++++++++++-- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/lv_objx/lv_tabview.c b/src/lv_objx/lv_tabview.c index 79727b157..f60454e25 100644 --- a/src/lv_objx/lv_tabview.c +++ b/src/lv_objx/lv_tabview.c @@ -114,8 +114,17 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy) /* Set a size which fits into the parent. * Don't use `par` directly because if the tabview is created on a page it is moved to the * scrollable so the parent has changed */ - lv_obj_set_size(new_tabview, lv_obj_get_width_fit(lv_obj_get_parent(new_tabview)), - lv_obj_get_height_fit(lv_obj_get_parent(new_tabview))); + lv_coord_t w; + lv_coord_t h; + if(par) { + w = lv_obj_get_width_fit(lv_obj_get_parent(new_tabview)); + h = lv_obj_get_height_fit(lv_obj_get_parent(new_tabview)); + } else { + w = lv_disp_get_hor_res(NULL); + h = lv_disp_get_ver_res(NULL); + } + + lv_obj_set_size(new_tabview, w, h); ext->content = lv_cont_create(new_tabview, NULL); ext->btns = lv_btnm_create(new_tabview, NULL); diff --git a/src/lv_objx/lv_tileview.c b/src/lv_objx/lv_tileview.c index cd2f83d0c..97b63358d 100644 --- a/src/lv_objx/lv_tileview.c +++ b/src/lv_objx/lv_tileview.c @@ -97,8 +97,17 @@ lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy) /* Set a size which fits into the parent. * Don't use `par` directly because if the tileview is created on a page it is moved to the * scrollable so the parent has changed */ - lv_obj_set_size(new_tileview, lv_obj_get_width_fit(lv_obj_get_parent(new_tileview)), - lv_obj_get_height_fit(lv_obj_get_parent(new_tileview))); + lv_coord_t w; + lv_coord_t h; + if(par) { + w = lv_obj_get_width_fit(lv_obj_get_parent(new_tileview)); + h = lv_obj_get_height_fit(lv_obj_get_parent(new_tileview)); + } else { + w = lv_disp_get_hor_res(NULL); + h = lv_disp_get_ver_res(NULL); + } + + lv_obj_set_size(new_tileview, w, h); lv_obj_set_drag_throw(lv_page_get_scrl(new_tileview), false); lv_page_set_scrl_fit(new_tileview, LV_FIT_TIGHT); diff --git a/src/lv_objx/lv_win.c b/src/lv_objx/lv_win.c index 03c689a0f..b0a79c0e2 100644 --- a/src/lv_objx/lv_win.c +++ b/src/lv_objx/lv_win.c @@ -75,8 +75,17 @@ lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy) /* Set a size which fits into the parent. * Don't use `par` directly because if the window is created on a page it is moved to the * scrollable so the parent has changed */ - lv_obj_set_size(new_win, lv_obj_get_width_fit(lv_obj_get_parent(new_win)), - lv_obj_get_height_fit(lv_obj_get_parent(new_win))); + lv_coord_t w; + lv_coord_t h; + if(par) { + w = lv_obj_get_width_fit(lv_obj_get_parent(new_win)); + h = lv_obj_get_height_fit(lv_obj_get_parent(new_win)); + } else { + w = lv_disp_get_hor_res(NULL); + h = lv_disp_get_ver_res(NULL); + } + + lv_obj_set_size(new_win, w, h); lv_obj_set_pos(new_win, 0, 0); lv_obj_set_style(new_win, &lv_style_pretty); From 0c093da924e550a6993dfb44bea081a082fd0917 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 30 Jan 2020 06:13:15 +0100 Subject: [PATCH 12/19] win: fix if created as screen --- src/lv_objx/lv_win.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lv_objx/lv_win.c b/src/lv_objx/lv_win.c index b0a79c0e2..689dad378 100644 --- a/src/lv_objx/lv_win.c +++ b/src/lv_objx/lv_win.c @@ -87,7 +87,6 @@ lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy) lv_obj_set_size(new_win, w, h); - lv_obj_set_pos(new_win, 0, 0); lv_obj_set_style(new_win, &lv_style_pretty); ext->page = lv_page_create(new_win, NULL); From cde12976acc78407c8f99053f979b6aa5dfbd48f Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 30 Jan 2020 06:39:16 +0100 Subject: [PATCH 13/19] label: fix writing out of bounds in LV_LABEL_LONG_FOT mode #1364 --- src/lv_objx/lv_label.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lv_objx/lv_label.c b/src/lv_objx/lv_label.c index aa677b094..6fc211bd4 100644 --- a/src/lv_objx/lv_label.c +++ b/src/lv_objx/lv_label.c @@ -1303,10 +1303,18 @@ static void lv_label_refr_text(lv_obj_t * label) p.y -= style->text.line_space; /*Trim the last line space*/ uint32_t letter_id = lv_label_get_letter_on(label, &p); - /*Save letters under the dots and replace them with dots*/ - uint32_t i; + + /*Be sure there is space for the dots*/ + size_t txt_len = strlen(ext->text); uint32_t byte_id = lv_txt_encoded_get_byte_id(ext->text, letter_id); + while(byte_id + LV_LABEL_DOT_NUM > txt_len) { + byte_id -= lv_txt_encoded_size(&ext->text[byte_id]); + letter_id--; + } + + /*Save letters under the dots and replace them with dots*/ uint32_t byte_id_ori = byte_id; + uint32_t i; uint8_t len = 0; for(i = 0; i <= LV_LABEL_DOT_NUM; i++) { len += lv_txt_encoded_size(&ext->text[byte_id]); From 708d68eac129746ddedd72eeaa94d4a17750be47 Mon Sep 17 00:00:00 2001 From: Deon Marais Date: Thu, 30 Jan 2020 14:58:14 +0200 Subject: [PATCH 14/19] Update lv_label.c --- src/lv_objx/lv_label.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lv_objx/lv_label.c b/src/lv_objx/lv_label.c index c4e408707..5c870d05f 100644 --- a/src/lv_objx/lv_label.c +++ b/src/lv_objx/lv_label.c @@ -1302,10 +1302,18 @@ static void lv_label_refr_text(lv_obj_t * label) p.y -= style->text.line_space; /*Trim the last line space*/ uint32_t letter_id = lv_label_get_letter_on(label, &p); - /*Save letters under the dots and replace them with dots*/ - uint32_t i; + + /*Be sure there is space for the dots*/ + size_t txt_len = strlen(ext->text); uint32_t byte_id = lv_txt_encoded_get_byte_id(ext->text, letter_id); + while(byte_id + LV_LABEL_DOT_NUM > txt_len) { + byte_id -= lv_txt_encoded_size(&ext->text[byte_id]); + letter_id--; + } + + /*Save letters under the dots and replace them with dots*/ uint32_t byte_id_ori = byte_id; + uint32_t i; uint8_t len = 0; for(i = 0; i <= LV_LABEL_DOT_NUM; i++) { len += lv_txt_encoded_size(&ext->text[byte_id]); From 6fbc9f3400bcf3cf39582caa7f5768c84adfaf0d Mon Sep 17 00:00:00 2001 From: Deon Marais Date: Thu, 30 Jan 2020 15:00:42 +0200 Subject: [PATCH 15/19] Update lv_color.h --- src/lv_misc/lv_color.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/lv_misc/lv_color.h b/src/lv_misc/lv_color.h index 05f6e320a..1febbdcea 100644 --- a/src/lv_misc/lv_color.h +++ b/src/lv_misc/lv_color.h @@ -344,7 +344,6 @@ static inline uint8_t lv_color_to8(lv_color_t color) static inline uint16_t lv_color_to16(lv_color_t color) { - #if LV_COLOR_DEPTH == 1 if(color.full == 0) return 0; @@ -373,10 +372,7 @@ static inline uint16_t lv_color_to16(lv_color_t color) #endif LV_COLOR_SET_B16(ret, LV_COLOR_GET_B(color) >> 3); /* 8 - 5 = 3*/ return ret.full; -#else - return 0; -#endif - +#endif } static inline uint32_t lv_color_to32(lv_color_t color) From e60439a9e798f53b917871fbb5034c21c2ca8642 Mon Sep 17 00:00:00 2001 From: Deon Marais Date: Thu, 30 Jan 2020 15:02:46 +0200 Subject: [PATCH 16/19] Update lv_symbol_def.h --- src/lv_font/lv_symbol_def.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/lv_font/lv_symbol_def.h b/src/lv_font/lv_symbol_def.h index 6fe823b72..a111ec39c 100644 --- a/src/lv_font/lv_symbol_def.h +++ b/src/lv_font/lv_symbol_def.h @@ -12,12 +12,12 @@ extern "C" { #endif /* In the font converter use this list as range: - 61441, 61448, 61451, 61452, 61452, 61453, 61457, 61459, 61461, 61465, - 61468, 61473, 61478, 61479, 61480, 61502, 61512, 61515, 61516, 61517, - 61521, 61522, 61523, 61524, 61543, 61544, 61550, 61552, 61553, 61556, - 61559, 61560, 61561, 61563, 61587, 61589, 61636, 61637, 61639, 61671, - 61674, 61683, 61724, 61732, 61787, 61931, 62016, 62017, 62018, 62019, - 62020, 62087, 62099, 62212, 62189, 62810, 63426, 63650 + 61441, 61448, 61451, 61452, 61453, 61457, 61459, 61461, 61465, 61468, + 61473, 61478, 61479, 61480, 61502, 61512, 61515, 61516, 61517, 61521, + 61522, 61523, 61524, 61543, 61544, 61550, 61552, 61553, 61556, 61559, + 61560, 61561, 61563, 61587, 61589, 61636, 61637, 61639, 61671, 61674, + 61683, 61724, 61732, 61787, 61931, 62016, 62017, 62018, 62019, 62020, + 62087, 62099, 62212, 62189, 62810, 63426, 63650 */ #define LV_SYMBOL_AUDIO "\xef\x80\x81" /*61441, 0xF001*/ @@ -93,7 +93,6 @@ enum { _LV_STR_SYMBOL_CLOSE, _LV_STR_SYMBOL_POWER, _LV_STR_SYMBOL_SETTINGS, - _LV_STR_SYMBOL_TRASH, _LV_STR_SYMBOL_HOME, _LV_STR_SYMBOL_DOWNLOAD, _LV_STR_SYMBOL_DRIVE, @@ -113,6 +112,8 @@ enum { _LV_STR_SYMBOL_RIGHT, _LV_STR_SYMBOL_PLUS, _LV_STR_SYMBOL_MINUS, + _LV_STR_SYMBOL_EYE_OPEN, + _LV_STR_SYMBOL_EYE_CLOSE, _LV_STR_SYMBOL_WARNING, _LV_STR_SYMBOL_SHUFFLE, _LV_STR_SYMBOL_UP, @@ -125,6 +126,7 @@ enum { _LV_STR_SYMBOL_COPY, _LV_STR_SYMBOL_SAVE, _LV_STR_SYMBOL_CHARGE, + _LV_STR_SYMBOL_PASTE, _LV_STR_SYMBOL_BELL, _LV_STR_SYMBOL_KEYBOARD, _LV_STR_SYMBOL_GPS, @@ -135,7 +137,12 @@ enum { _LV_STR_SYMBOL_BATTERY_2, _LV_STR_SYMBOL_BATTERY_1, _LV_STR_SYMBOL_BATTERY_EMPTY, + _LV_STR_SYMBOL_USB, _LV_STR_SYMBOL_BLUETOOTH, + _LV_STR_SYMBOL_TRASH, + _LV_STR_SYMBOL_BACKSPACE, + _LV_STR_SYMBOL_SD_CARD, + _LV_STR_SYMBOL_NEW_LINE, _LV_STR_SYMBOL_DUMMY, }; From 0065992fcd7eaa874efa281801eb136a1ca67cc9 Mon Sep 17 00:00:00 2001 From: Deon Marais Date: Thu, 30 Jan 2020 15:06:43 +0200 Subject: [PATCH 17/19] Update lv_symbol_def.h --- src/lv_font/lv_symbol_def.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lv_font/lv_symbol_def.h b/src/lv_font/lv_symbol_def.h index a111ec39c..026f4a600 100644 --- a/src/lv_font/lv_symbol_def.h +++ b/src/lv_font/lv_symbol_def.h @@ -140,9 +140,9 @@ enum { _LV_STR_SYMBOL_USB, _LV_STR_SYMBOL_BLUETOOTH, _LV_STR_SYMBOL_TRASH, - _LV_STR_SYMBOL_BACKSPACE, - _LV_STR_SYMBOL_SD_CARD, - _LV_STR_SYMBOL_NEW_LINE, + _LV_STR_SYMBOL_BACKSPACE, + _LV_STR_SYMBOL_SD_CARD, + _LV_STR_SYMBOL_NEW_LINE, _LV_STR_SYMBOL_DUMMY, }; From 603786f969b0d96bcbff25a8395509a88e0e5adc Mon Sep 17 00:00:00 2001 From: Deon Marais Date: Thu, 30 Jan 2020 15:15:36 +0200 Subject: [PATCH 18/19] Update lv_label.c --- src/lv_objx/lv_label.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lv_objx/lv_label.c b/src/lv_objx/lv_label.c index 5c870d05f..6fc211bd4 100644 --- a/src/lv_objx/lv_label.c +++ b/src/lv_objx/lv_label.c @@ -308,6 +308,7 @@ void lv_label_set_array_text(lv_obj_t * label, const char * array, uint16_t size void lv_label_set_static_text(lv_obj_t * label, const char * text) { LV_ASSERT_OBJ(label, LV_OBJX_NAME); + LV_ASSERT_STR(text); lv_label_ext_t * ext = lv_obj_get_ext_attr(label); if(ext->static_txt == 0 && ext->text != NULL) { From 4bf228ca2c120a7f541b478923afbfeab15d19d4 Mon Sep 17 00:00:00 2001 From: Deon Marais Date: Thu, 30 Jan 2020 15:17:02 +0200 Subject: [PATCH 19/19] Remove incorrect assert --- src/lv_objx/lv_label.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lv_objx/lv_label.c b/src/lv_objx/lv_label.c index 6fc211bd4..5c870d05f 100644 --- a/src/lv_objx/lv_label.c +++ b/src/lv_objx/lv_label.c @@ -308,7 +308,6 @@ void lv_label_set_array_text(lv_obj_t * label, const char * array, uint16_t size void lv_label_set_static_text(lv_obj_t * label, const char * text) { LV_ASSERT_OBJ(label, LV_OBJX_NAME); - LV_ASSERT_STR(text); lv_label_ext_t * ext = lv_obj_get_ext_attr(label); if(ext->static_txt == 0 && ext->text != NULL) {