diff --git a/lv_core/lv_indev.c b/lv_core/lv_indev.c index 37ed77268..d7b57941a 100644 --- a/lv_core/lv_indev.c +++ b/lv_core/lv_indev.c @@ -346,12 +346,13 @@ static void indev_proc_press(lv_indev_proc_t * info) pr_obj = indev_search_obj(info, lv_layer_top()); if(pr_obj == NULL) pr_obj = indev_search_obj(info, lv_scr_act()); } - /*If there is last object but it is not dragged also search*/ - else if(info->drag_in_prog == 0) {/*Now act_obj != NULL*/ + /*If there is last object but it is not dragged and not protected also search*/ + else if(info->drag_in_prog == 0 && + lv_obj_is_protected(info->act_obj, LV_PROTECT_PRESS_LOST) == false) {/*Now act_obj != NULL*/ pr_obj = indev_search_obj(info, lv_layer_top()); if(pr_obj == NULL) pr_obj = indev_search_obj(info, lv_scr_act()); } - /*If a dragable object was the last then keep it*/ + /*If a dragable or a protected object was the last then keep it*/ else { } diff --git a/lv_core/lv_obj.h b/lv_core/lv_obj.h index d6b8077ce..e9c937a7e 100644 --- a/lv_core/lv_obj.h +++ b/lv_core/lv_obj.h @@ -117,8 +117,9 @@ typedef struct _lv_obj_t void * free_ptr; /*Application specific pointer (set it freely)*/ #endif - void * group_p; /*Pointer to the group of the object*/ - +#if USE_LV_GROUP != 0 + void * group_p; /*Pointer to the group of the object*/ +#endif /*Attributes and states*/ uint8_t click :1; /*1: Can be pressed by an input device*/ uint8_t drag :1; /*1: Enable the dragging*/ @@ -147,6 +148,7 @@ typedef enum LV_PROTECT_PARENT = 0x02, /*Prevent automatic parent change (e.g. in lv_page)*/ LV_PROTECT_POS = 0x04, /*Prevent automatic positioning (e.g. in lv_cont layout)*/ LV_PROTECT_FOLLOW = 0x08, /*Prevent the object be followed in automatic ordering (e.g. in lv_cont PRETTY layout)*/ + LV_PROTECT_PRESS_LOST= 0x10, /*TODO */ }lv_protect_t; typedef enum diff --git a/lv_draw/lv_draw.c b/lv_draw/lv_draw.c index 83ba579ef..2c0f3f4ab 100644 --- a/lv_draw/lv_draw.c +++ b/lv_draw/lv_draw.c @@ -1755,7 +1755,7 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask bool line_ready; for(line = 1; line <= radius + swidth; line++) { /*Check all rows and make the 1D blur to 2D*/ line_ready = false; - for(col = 1; col < radius + swidth + 1; col++) { /*Check all pixels in a 1D blur line (from the origo to last shadow pixel (radius + swidth))*/ + for(col = 1; col < radius + swidth + 10; col++) { /*Check all pixels in a 1D blur line (from the origo to last shadow pixel (radius + swidth))*/ /*Sum the opacities from the lines above and below this 'row'*/ int16_t line_rel; diff --git a/lv_objx/lv_page.c b/lv_objx/lv_page.c index d29df4def..a6bc37fb7 100644 --- a/lv_objx/lv_page.c +++ b/lv_objx/lv_page.c @@ -81,7 +81,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_set_design_func(ext->scrl, lv_scrl_design); lv_obj_set_drag(ext->scrl, true); lv_obj_set_drag_throw(ext->scrl, true); - lv_obj_set_protect(ext->scrl, LV_PROTECT_PARENT); + lv_obj_set_protect(ext->scrl, LV_PROTECT_PARENT | LV_PROTECT_PRESS_LOST); lv_cont_set_fit(ext->scrl, false, true); /* Add the signal function only if 'scrolling' is created diff --git a/lv_objx/lv_slider.c b/lv_objx/lv_slider.c index 47e862da7..774728d71 100644 --- a/lv_objx/lv_slider.c +++ b/lv_objx/lv_slider.c @@ -1,3 +1,4 @@ + /** * @file lv_slider.c * @@ -77,6 +78,7 @@ lv_obj_t * lv_slider_create(lv_obj_t * par, lv_obj_t * copy) /*Init the new slider slider*/ if(copy == NULL) { lv_obj_set_click(new_slider, true); + lv_obj_set_protect(new_slider, LV_PROTECT_PRESS_LOST); /*Set the default styles*/ lv_theme_t *th = lv_theme_get_current(); @@ -421,14 +423,12 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par lv_style_t *knob_style = lv_slider_get_style(slider, LV_SLIDER_STYLE_KNOB); lv_coord_t shadow_w = knob_style->body.shadow.width; if(ext->knob_in == 0) { - /* The smaller size is the knob diameter - * +2 for the possible rounding error*/ - lv_coord_t x = LV_MATH_MIN(w / 2 + 2 + shadow_w, h / 2 + 2 + shadow_w); + /* The smaller size is the knob diameter*/ + lv_coord_t x = LV_MATH_MIN(w / 2 + 1 + shadow_w, h / 2 + 1 + shadow_w); if(slider->ext_size < x) slider->ext_size = x; } else { lv_coord_t pad = LV_MATH_MIN(style->body.padding.hor, style->body.padding.ver); if(pad < 0) pad = -pad; - if(pad < 1) pad = 1; /*For possible rounding errors*/ if(slider->ext_size < pad) slider->ext_size = pad; if(slider->ext_size < shadow_w) slider->ext_size = shadow_w;