From 18eb517cfff51a9a0323030278aaf9aae4cb843c Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 7 Aug 2019 09:39:35 +0200 Subject: [PATCH 1/6] Update README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 8f71b522d..26d296633 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,17 @@

+

+ +

Shape the future of LittlevGL

+ +

+It takes only 5 minutes to tell some information about how you use LittlevGL, what you like about it, what should be improved and the future directions you find reasonable.
+ +![](https://littlevgl.com/external/survey.png) +
+

From 5e8a3e180ee03efc6f22a433a8fd524873bc7d8f Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 7 Aug 2019 09:41:01 +0200 Subject: [PATCH 2/6] Update README.md --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 26d296633..8cb597523 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,16 @@

Shape the future of LittlevGL

-It takes only 5 minutes to tell some information about how you use LittlevGL, what you like about it, what should be improved and the future directions you find reasonable. -
- ![](https://littlevgl.com/external/survey.png) -
+

+

+It takes only 5 minutes to tell some information about how you use LittlevGL, what you like about it, what should be improved and the future directions you find reasonable. +

+ +--- + +

From 7c90b84560aa8cea64c1f8f08b4398d3fb29e7da Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 7 Aug 2019 09:42:02 +0200 Subject: [PATCH 3/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8cb597523..3cf978f44 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@

Shape the future of LittlevGL

-![](https://littlevgl.com/external/survey.png) +

From c35c84c7d0675189e93a557fe6a5959243bd6b1b Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Thu, 15 Aug 2019 09:24:22 -0400 Subject: [PATCH 4/6] Guard uses of antialiasing option with LV_ANTIALIAS --- src/lv_objx/lv_canvas.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lv_objx/lv_canvas.c b/src/lv_objx/lv_canvas.c index 43610f3c3..da08521a8 100644 --- a/src/lv_objx/lv_canvas.c +++ b/src/lv_objx/lv_canvas.c @@ -482,6 +482,7 @@ void lv_canvas_draw_rect(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord disp.driver.hor_res = dsc->header.w; disp.driver.ver_res = dsc->header.h; +#if LV_ANTIALIAS /*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/ lv_color_t ctransp = LV_COLOR_TRANSP; if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED && @@ -490,6 +491,7 @@ void lv_canvas_draw_rect(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord { disp.driver.antialiasing = 0; } +#endif lv_disp_t * refr_ori = lv_refr_get_disp_refreshing(); lv_refr_set_disp_refreshing(&disp); @@ -642,6 +644,7 @@ void lv_canvas_draw_line(lv_obj_t * canvas, const lv_point_t * points, uint32_t disp.driver.hor_res = dsc->header.w; disp.driver.ver_res = dsc->header.h; +#if LV_ANTIALIAS /*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/ lv_color_t ctransp = LV_COLOR_TRANSP; if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED && @@ -650,6 +653,7 @@ void lv_canvas_draw_line(lv_obj_t * canvas, const lv_point_t * points, uint32_t { disp.driver.antialiasing = 0; } +#endif lv_disp_t * refr_ori = lv_refr_get_disp_refreshing(); lv_refr_set_disp_refreshing(&disp); @@ -694,6 +698,7 @@ void lv_canvas_draw_polygon(lv_obj_t * canvas, const lv_point_t * points, uint32 disp.driver.hor_res = dsc->header.w; disp.driver.ver_res = dsc->header.h; +#if LV_ANTIALIAS /*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/ lv_color_t ctransp = LV_COLOR_TRANSP; if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED && @@ -702,6 +707,7 @@ void lv_canvas_draw_polygon(lv_obj_t * canvas, const lv_point_t * points, uint32 { disp.driver.antialiasing = 0; } +#endif lv_disp_t * refr_ori = lv_refr_get_disp_refreshing(); lv_refr_set_disp_refreshing(&disp); @@ -747,6 +753,7 @@ void lv_canvas_draw_arc(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_ disp.driver.hor_res = dsc->header.w; disp.driver.ver_res = dsc->header.h; +#if LV_ANTIALIAS /*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/ lv_color_t ctransp = LV_COLOR_TRANSP; if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED && @@ -755,6 +762,7 @@ void lv_canvas_draw_arc(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_ { disp.driver.antialiasing = 0; } +#endif lv_disp_t * refr_ori = lv_refr_get_disp_refreshing(); lv_refr_set_disp_refreshing(&disp); From 71e950614fc534ff99cbbca1b36b69facde48caa Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 16 Aug 2019 13:43:28 +0200 Subject: [PATCH 5/6] roller, ddlist and lv_label_get_letter_on fixes --- src/lv_objx/lv_ddlist.c | 15 ++++++++++----- src/lv_objx/lv_label.c | 15 ++++++++------- src/lv_objx/lv_roller.c | 2 +- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/lv_objx/lv_ddlist.c b/src/lv_objx/lv_ddlist.c index f49ec0cef..d4c132d2d 100644 --- a/src/lv_objx/lv_ddlist.c +++ b/src/lv_objx/lv_ddlist.c @@ -142,8 +142,10 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, const lv_obj_t * copy) ext->draw_arrow = copy_ext->draw_arrow; ext->stay_open = copy_ext->stay_open; - /*Refresh the style with new signal function*/ - lv_obj_refresh_style(new_ddlist); + lv_ddlist_set_style(new_ddlist, LV_DDLIST_STYLE_BG, lv_ddlist_get_style(copy, LV_DDLIST_STYLE_BG)); + lv_ddlist_set_style(new_ddlist, LV_DDLIST_STYLE_SB, lv_ddlist_get_style(copy, LV_DDLIST_STYLE_SB)); + lv_ddlist_set_style(new_ddlist, LV_DDLIST_STYLE_SEL, lv_ddlist_get_style(copy, LV_DDLIST_STYLE_SEL)); + } LV_LOG_INFO("drop down list created"); @@ -773,13 +775,16 @@ static lv_res_t release_handler(lv_obj_t * ddlist) uint16_t new_opt = 0; const char * txt = lv_label_get_text(ext->label); uint32_t i = 0; - uint32_t line_cnt = 0; + uint32_t i_prev = 0; + + uint32_t letter_cnt = 0; uint32_t letter; - for(line_cnt = 0; line_cnt < letter_i; line_cnt++) { + for(letter_cnt = 0; letter_cnt < letter_i; letter_cnt++) { letter = lv_txt_encoded_next(txt, &i); /*Count he lines to reach the clicked letter. But ignore the last '\n' because it * still belongs to the clicked line*/ - if(letter == '\n' && i != letter_i) new_opt++; + if(letter == '\n' && i_prev != letter_i) new_opt++; + i_prev = i; } ext->sel_opt_id = new_opt; diff --git a/src/lv_objx/lv_label.c b/src/lv_objx/lv_label.c index 9dfa92260..0b6046c76 100644 --- a/src/lv_objx/lv_label.c +++ b/src/lv_objx/lv_label.c @@ -585,14 +585,13 @@ uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos) lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT; uint32_t i = line_start; - uint32_t i_current = i; + uint32_t i_act = i; uint32_t letter; uint32_t letter_next; if(new_line_start > 0) { - while(i <= new_line_start - 1) { - /* Get the current letter. - * Be careful 'i' already points to the next character*/ + while(i < new_line_start) { + /* Get the current letter.*/ letter = lv_txt_encoded_next(txt, &i); /*Get the next letter too for kerning*/ @@ -606,12 +605,14 @@ uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos) } x += lv_font_get_glyph_width(font, letter, letter_next); - if(pos->x < x) { - i = i_current; + + /*Finish if the x position or the last char of the line is reached*/ + if(pos->x < x || i == new_line_start) { + i = i_act; break; } x += style->text.letter_space; - i_current = i; + i_act = i; } } diff --git a/src/lv_objx/lv_roller.c b/src/lv_objx/lv_roller.c index 05c3b0919..327690776 100644 --- a/src/lv_objx/lv_roller.c +++ b/src/lv_objx/lv_roller.c @@ -498,7 +498,7 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, lv_coord_t font_h = lv_font_get_line_height(font); if(sign == LV_SIGNAL_DRAG_END) { - /*If dragged then align the list to there be an element in the middle*/ + /*If dragged then align the list to have an element in the middle*/ lv_coord_t label_y1 = ext->ddlist.label->coords.y1 - roller->coords.y1; lv_coord_t label_unit = font_h + style_label->text.line_space; lv_coord_t mid = (roller->coords.y2 - roller->coords.y1) / 2; From bbb0d2f60efc7154597928bfeef94b377ce870d3 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 16 Aug 2019 16:43:05 +0200 Subject: [PATCH 6/6] lv_roller: fix misalignment when an other obj is cliked while rolling --- src/lv_core/lv_indev.c | 15 +++++++++++---- src/lv_objx/lv_ddlist.c | 7 +++++++ src/lv_objx/lv_roller.c | 14 +++++++++++--- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/lv_core/lv_indev.c b/src/lv_core/lv_indev.c index 86e343a60..2d672ac44 100644 --- a/src/lv_core/lv_indev.c +++ b/src/lv_core/lv_indev.c @@ -687,12 +687,14 @@ static void indev_proc_press(lv_indev_proc_t * proc) if(proc->wait_until_release != 0) return; lv_disp_t * disp = indev_act->driver.disp; + bool new_obj_searched = false; /*If there is no last object then search*/ if(indev_obj_act == NULL) { indev_obj_act = indev_search_obj(proc, lv_disp_get_layer_sys(disp)); if(indev_obj_act == NULL) indev_obj_act = indev_search_obj(proc, lv_disp_get_layer_top(disp)); if(indev_obj_act == NULL) indev_obj_act = indev_search_obj(proc, lv_disp_get_scr_act(disp)); + new_obj_searched = true; } /*If there is last object but it is not dragged and not protected also search*/ else if(proc->types.pointer.drag_in_prog == 0 && @@ -700,14 +702,21 @@ static void indev_proc_press(lv_indev_proc_t * proc) indev_obj_act = indev_search_obj(proc, lv_disp_get_layer_sys(disp)); if(indev_obj_act == NULL) indev_obj_act = indev_search_obj(proc, lv_disp_get_layer_top(disp)); if(indev_obj_act == NULL) indev_obj_act = indev_search_obj(proc, lv_disp_get_scr_act(disp)); + new_obj_searched = true; } /*If a dragable or a protected object was the last then keep it*/ else { } + /*The last object might have drag throw. Stop it manually*/ + if(new_obj_searched && proc->types.pointer.last_obj) { + proc->types.pointer.drag_throw_vect.x = 0; + proc->types.pointer.drag_throw_vect.y = 0; + indev_drag_throw(proc); + } + /*If a new object was found reset some variables and send a pressed signal*/ if(indev_obj_act != proc->types.pointer.act_obj) { - proc->types.pointer.last_point.x = proc->types.pointer.act_point.x; proc->types.pointer.last_point.y = proc->types.pointer.act_point.y; @@ -720,6 +729,7 @@ static void indev_proc_press(lv_indev_proc_t * proc) if(indev_reset_check(proc)) return; lv_event_send(last_obj, LV_EVENT_PRESS_LOST, NULL); if(indev_reset_check(proc)) return; + } proc->types.pointer.act_obj = indev_obj_act; /*Save the pressed object*/ @@ -1108,9 +1118,6 @@ static void indev_drag(lv_indev_proc_t * state) lv_obj_set_y(drag_obj, act_y + state->types.pointer.vect.y); } - - - /*If the object didn't moved then clear the invalidated areas*/ if(drag_obj->coords.x1 == prev_x && drag_obj->coords.y1 == prev_y) { // state->types.pointer.drag_in_prog = 0; diff --git a/src/lv_objx/lv_ddlist.c b/src/lv_objx/lv_ddlist.c index d4c132d2d..3deeed174 100644 --- a/src/lv_objx/lv_ddlist.c +++ b/src/lv_objx/lv_ddlist.c @@ -232,6 +232,7 @@ void lv_ddlist_set_fix_height(lv_obj_t * ddlist, lv_coord_t h) */ void lv_ddlist_set_fix_width(lv_obj_t * ddlist, lv_coord_t w) { + lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist); if(w == 0) { lv_cont_set_fit2(ddlist, LV_FIT_TIGHT, lv_cont_get_fit_bottom(ddlist)); } else { @@ -239,6 +240,12 @@ void lv_ddlist_set_fix_width(lv_obj_t * ddlist, lv_coord_t w) lv_obj_set_width(ddlist, w); } + switch(lv_label_get_align(ext->label)) { + case LV_LABEL_ALIGN_LEFT: lv_obj_align(ext->label, NULL, LV_ALIGN_IN_LEFT_MID, 0, 0); break; + case LV_LABEL_ALIGN_CENTER: lv_obj_align(ext->label, NULL, LV_ALIGN_CENTER, 0, 0); break; + case LV_LABEL_ALIGN_RIGHT: lv_obj_align(ext->label, NULL, LV_ALIGN_IN_RIGHT_MID, 0, 0); break; + } + lv_ddlist_refr_size(ddlist, false); } diff --git a/src/lv_objx/lv_roller.c b/src/lv_objx/lv_roller.c index 327690776..287d139b1 100644 --- a/src/lv_objx/lv_roller.c +++ b/src/lv_objx/lv_roller.c @@ -176,9 +176,17 @@ void lv_roller_set_options(lv_obj_t * roller, const char * options, lv_roller_mo void lv_roller_set_align(lv_obj_t * roller, lv_label_align_t align) { lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller); - lv_mem_assert(ext); - if(ext->ddlist.label == NULL) return; /*Probably the roller is being deleted if the label is NULL.*/ - lv_label_set_align(ext->ddlist.label, align); + + lv_obj_t * label = ext->ddlist.label; + + if(label == NULL) return; /*Probably the roller is being deleted if the label is NULL.*/ + lv_label_set_align(label, align); + + switch(lv_label_get_align(label)) { + case LV_LABEL_ALIGN_LEFT: lv_obj_align(label, NULL, LV_ALIGN_IN_LEFT_MID, 0, 0); break; + case LV_LABEL_ALIGN_CENTER: lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0); break; + case LV_LABEL_ALIGN_RIGHT: lv_obj_align(label, NULL, LV_ALIGN_IN_RIGHT_MID, 0, 0); break; + } } /**