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

This commit is contained in:
Gabor Kiss-Vamosi
2021-02-19 15:02:29 +01:00
9 changed files with 105 additions and 58 deletions

View File

@@ -460,8 +460,12 @@ typedef void * lv_user_data_t;
/* A simple, impressive and very complete theme */ /* A simple, impressive and very complete theme */
#define LV_USE_THEME_DEFAULT 1 #define LV_USE_THEME_DEFAULT 1
#if LV_USE_THEME_DEFAULT #if LV_USE_THEME_DEFAULT
/* 1: Light mode; 0: Dark mode*/ /* 1: Light mode; 0: Dark mode*/
# define LV_THEME_DEFAULT_FLAG_LIGHT 1 # define LV_THEME_DEFAULT_PALETTE_LIGHT 1
/* 1: Enable grow on press*/
# define LV_THEME_DEFAULT_GROW 0
/*Default transition time in [ms]*/ /*Default transition time in [ms]*/
# define LV_THEME_DEFAULT_TRANSITON_TIME 80 # define LV_THEME_DEFAULT_TRANSITON_TIME 80

View File

@@ -71,7 +71,7 @@
#define TRANSITION_TIME LV_THEME_DEFAULT_TRANSITON_TIME #define TRANSITION_TIME LV_THEME_DEFAULT_TRANSITON_TIME
#define BORDER_WIDTH LV_DPX(2) #define BORDER_WIDTH LV_DPX(2)
#define OUTLINE_WIDTH LV_DPX(2) #define OUTLINE_WIDTH LV_DPX(2)
#define IS_LIGHT (LV_THEME_DEFAULT_FLAG_LIGHT) #define IS_LIGHT (LV_THEME_DEFAULT_PALETTE_LIGHT)
#define PAD_DEF LV_DPX(15) #define PAD_DEF LV_DPX(15)
//(lv_disp_get_size_category(NULL) <= LV_DISP_SIZE_MEDIUM ? LV_DPX(15) : (LV_DPX(30))) //(lv_disp_get_size_category(NULL) <= LV_DISP_SIZE_MEDIUM ? LV_DPX(15) : (LV_DPX(30)))
@@ -105,7 +105,9 @@ typedef struct {
lv_style_t circle; lv_style_t circle;
lv_style_t no_radius; lv_style_t no_radius;
lv_style_t clip_corner; lv_style_t clip_corner;
#if LV_THEME_DEFAULT_GROW
lv_style_t grow; lv_style_t grow;
#endif
lv_style_t transition_delayed; lv_style_t transition_delayed;
lv_style_t transition_normal; lv_style_t transition_normal;
lv_style_t anim; lv_style_t anim;
@@ -334,9 +336,11 @@ static void style_init(void)
style_init_reset(&styles->no_radius); style_init_reset(&styles->no_radius);
lv_style_set_radius(&styles->no_radius, 0); lv_style_set_radius(&styles->no_radius, 0);
#if LV_THEME_DEFAULT_GROW
style_init_reset(&styles->grow); style_init_reset(&styles->grow);
lv_style_set_transform_width(&styles->grow, LV_DPX(3)); lv_style_set_transform_width(&styles->grow, LV_DPX(3));
lv_style_set_transform_height(&styles->grow, LV_DPX(3)); lv_style_set_transform_height(&styles->grow, LV_DPX(3));
#endif
style_init_reset(&styles->knob); style_init_reset(&styles->knob);
lv_style_set_bg_color(&styles->knob, IS_LIGHT ? theme.color_primary : LV_COLOR_WHITE); lv_style_set_bg_color(&styles->knob, IS_LIGHT ? theme.color_primary : LV_COLOR_WHITE);
@@ -578,7 +582,9 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->transition_delayed); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->transition_delayed);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->pressed); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->pressed);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->transition_normal); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->transition_normal);
#if LV_THEME_DEFAULT_GROW
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->grow); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->grow);
#endif
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_CHECKED, &styles->bg_color_secondary); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_CHECKED, &styles->bg_color_secondary);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DISABLED, &styles->disabled); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DISABLED, &styles->disabled);
} }
@@ -636,7 +642,9 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
lv_obj_add_style(obj, LV_PART_INDICATOR, LV_STATE_DEFAULT, &styles->bg_color_primary); lv_obj_add_style(obj, LV_PART_INDICATOR, LV_STATE_DEFAULT, &styles->bg_color_primary);
lv_obj_add_style(obj, LV_PART_INDICATOR, LV_STATE_DEFAULT, &styles->circle); lv_obj_add_style(obj, LV_PART_INDICATOR, LV_STATE_DEFAULT, &styles->circle);
lv_obj_add_style(obj, LV_PART_KNOB, LV_STATE_DEFAULT, &styles->knob); lv_obj_add_style(obj, LV_PART_KNOB, LV_STATE_DEFAULT, &styles->knob);
#if LV_THEME_DEFAULT_GROW
lv_obj_add_style(obj, LV_PART_KNOB, LV_STATE_PRESSED, &styles->grow); lv_obj_add_style(obj, LV_PART_KNOB, LV_STATE_PRESSED, &styles->grow);
#endif
lv_obj_add_style(obj, LV_PART_KNOB, LV_STATE_DEFAULT, &styles->transition_delayed); lv_obj_add_style(obj, LV_PART_KNOB, LV_STATE_DEFAULT, &styles->transition_delayed);
lv_obj_add_style(obj, LV_PART_KNOB, LV_STATE_PRESSED, &styles->transition_normal); lv_obj_add_style(obj, LV_PART_KNOB, LV_STATE_PRESSED, &styles->transition_normal);
} }
@@ -665,7 +673,9 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_CHECKED, &styles->bg_color_primary); lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_CHECKED, &styles->bg_color_primary);
lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_CHECKED, &styles->cb_marker_checked); lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_CHECKED, &styles->cb_marker_checked);
lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_PRESSED, &styles->pressed); lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_PRESSED, &styles->pressed);
#if LV_THEME_DEFAULT_GROW
lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_PRESSED, &styles->grow); lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_PRESSED, &styles->grow);
#endif
lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_PRESSED, &styles->transition_normal); lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_PRESSED, &styles->transition_normal);
lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_DEFAULT, &styles->transition_delayed); lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_DEFAULT, &styles->transition_delayed);
} }
@@ -719,7 +729,9 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->transition_delayed); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->transition_delayed);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->pressed); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->pressed);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->transition_normal); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->transition_normal);
#if LV_THEME_DEFAULT_GROW
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->grow); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->grow);
#endif
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_CHECKED, &styles->ddlist_flip); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_CHECKED, &styles->ddlist_flip);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->transition_normal); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->transition_normal);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_FOCUS_KEY, &styles->focus_outline); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_FOCUS_KEY, &styles->focus_outline);

View File

@@ -401,7 +401,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
# ifdef CONFIG_LV_ASSERT_HANDLER_INCLUDE # ifdef CONFIG_LV_ASSERT_HANDLER_INCLUDE
# define LV_ASSERT_HANDLER_INCLUDE CONFIG_LV_ASSERT_HANDLER_INCLUDE # define LV_ASSERT_HANDLER_INCLUDE CONFIG_LV_ASSERT_HANDLER_INCLUDE
# else # else
# define LV_ASSERT_HANDLER_INCLUDE <stdint.h> # define LV_ASSERT_HANDLER_INCLUDE <stdint.h>
# endif # endif
#endif #endif
#ifndef LV_ASSERT_HANDLER #ifndef LV_ASSERT_HANDLER
@@ -1371,12 +1371,22 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
# endif # endif
#endif #endif
#if LV_USE_THEME_DEFAULT #if LV_USE_THEME_DEFAULT
/* 1: Light mode; 0: Dark mode*/ /* 1: Light mode; 0: Dark mode*/
#ifndef LV_THEME_DEFAULT_FLAG_LIGHT #ifndef LV_THEME_DEFAULT_PALETTE_LIGHT
# ifdef CONFIG_LV_THEME_DEFAULT_FLAG_LIGHT # ifdef CONFIG_LV_THEME_DEFAULT_PALETTE_LIGHT
# define LV_THEME_DEFAULT_FLAG_LIGHT CONFIG_LV_THEME_DEFAULT_FLAG_LIGHT # define LV_THEME_DEFAULT_PALETTE_LIGHT CONFIG_LV_THEME_DEFAULT_PALETTE_LIGHT
# else # else
# define LV_THEME_DEFAULT_FLAG_LIGHT 1 # define LV_THEME_DEFAULT_PALETTE_LIGHT 1
# endif
#endif
/* 1: Enable grow on press*/
#ifndef LV_THEME_DEFAULT_GROW
# ifdef CONFIG_LV_THEME_DEFAULT_GROW
# define LV_THEME_DEFAULT_GROW CONFIG_LV_THEME_DEFAULT_GROW
# else
# define LV_THEME_DEFAULT_GROW 0
# endif # endif
#endif #endif

View File

@@ -890,6 +890,13 @@ static void indev_proc_release(lv_indev_proc_t * proc)
/*Forget the act obj and send a released signal */ /*Forget the act obj and send a released signal */
if(indev_obj_act) { if(indev_obj_act) {
/*Send RELEASE signal and event*/
lv_signal_send(indev_obj_act, LV_SIGNAL_RELEASED, indev_act);
if(indev_reset_check(proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
if(indev_reset_check(proc)) return;
/*Send CLICK if no scrolling*/ /*Send CLICK if no scrolling*/
if(scroll_obj == NULL) { if(scroll_obj == NULL) {
if(proc->long_pr_sent == 0) { if(proc->long_pr_sent == 0) {
@@ -901,13 +908,6 @@ static void indev_proc_release(lv_indev_proc_t * proc)
if(indev_reset_check(proc)) return; if(indev_reset_check(proc)) return;
} }
/*Send RELEASE signal and event*/
lv_signal_send(indev_obj_act, LV_SIGNAL_RELEASED, indev_act);
if(indev_reset_check(proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
if(indev_reset_check(proc)) return;
proc->types.pointer.act_obj = NULL; proc->types.pointer.act_obj = NULL;
proc->pr_timestamp = 0; proc->pr_timestamp = 0;
proc->longpr_rep_timestamp = 0; proc->longpr_rep_timestamp = 0;

View File

@@ -195,7 +195,7 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, void * param)
/*Nothing to do if no event function and not bubbled*/ /*Nothing to do if no event function and not bubbled*/
lv_event_dsc_t * event_dsc = lv_obj_get_event_dsc(obj, 0); lv_event_dsc_t * event_dsc = lv_obj_get_event_dsc(obj, 0);
if((event_dsc == NULL || event_dsc->cb == NULL) && lv_obj_has_flag(obj, LV_OBJ_FLAG_EVENT_BUBBLE) == false) { if(event_dsc == NULL && lv_obj_has_flag(obj, LV_OBJ_FLAG_EVENT_BUBBLE) == false) {
return LV_RES_OK; return LV_RES_OK;
} }

View File

@@ -221,12 +221,12 @@ void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_co
case LV_ALIGN_IN_LEFT_MID: case LV_ALIGN_IN_LEFT_MID:
x = 0; x = 0;
y = lv_obj_get_height(base) / 2 - lv_obj_get_height(obj) / 2 - pleft; y = lv_obj_get_height(base) / 2 - lv_obj_get_height(obj) / 2;
break; break;
case LV_ALIGN_IN_RIGHT_MID: case LV_ALIGN_IN_RIGHT_MID:
x = lv_obj_get_width_fit(base) - lv_obj_get_width(obj); x = lv_obj_get_width_fit(base) - lv_obj_get_width(obj);
y = lv_obj_get_height_fit(base) / 2 - lv_obj_get_height(obj) / 2 - pleft; y = lv_obj_get_height_fit(base) / 2 - lv_obj_get_height(obj) / 2;
break; break;
case LV_ALIGN_OUT_TOP_LEFT: case LV_ALIGN_OUT_TOP_LEFT:
@@ -490,36 +490,38 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
/*Invalidate the object only if it belongs to the current or previous'*/ /*Invalidate the object only if it belongs to the current or previous'*/
lv_obj_t * obj_scr = lv_obj_get_screen(obj); lv_obj_t * obj_scr = lv_obj_get_screen(obj);
lv_disp_t * disp = lv_obj_get_disp(obj_scr); lv_disp_t * disp = lv_obj_get_disp(obj_scr);
if(obj_scr == lv_disp_get_scr_act(disp) || if(obj_scr != lv_disp_get_scr_act(disp) &&
obj_scr == lv_disp_get_scr_prev(disp) || obj_scr != lv_disp_get_scr_prev(disp) &&
obj_scr == lv_disp_get_layer_top(disp) || obj_scr != lv_disp_get_layer_top(disp) &&
obj_scr == lv_disp_get_layer_sys(disp)) { obj_scr != lv_disp_get_layer_sys(disp))
{
/*Truncate the area to the object*/ return false;
lv_area_t obj_coords;
lv_coord_t ext_size = _lv_obj_get_ext_draw_size(obj);
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;
is_common = _lv_area_intersect(area, area, &obj_coords);
if(is_common == false) return false; /*The area is not on the object*/
/*Truncate recursively to the parents*/
lv_obj_t * par = lv_obj_get_parent(obj);
while(par != NULL) {
is_common = _lv_area_intersect(area, area, &par->coords);
if(is_common == false) return false; /*If no common parts with parent break;*/
if(lv_obj_has_flag(par, LV_OBJ_FLAG_HIDDEN)) return false; /*If the parent is hidden then the child is hidden and won't be drawn*/
par = lv_obj_get_parent(par);
}
} }
/*Truncate the area to the object*/
lv_area_t obj_coords;
lv_coord_t ext_size = _lv_obj_get_ext_draw_size(obj);
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;
is_common = _lv_area_intersect(area, area, &obj_coords);
if(is_common == false) return false; /*The area is not on the object*/
/*Truncate recursively to the parents*/
lv_obj_t * par = lv_obj_get_parent(obj);
while(par != NULL) {
is_common = _lv_area_intersect(area, area, &par->coords);
if(is_common == false) return false; /*If no common parts with parent break;*/
if(lv_obj_has_flag(par, LV_OBJ_FLAG_HIDDEN)) return false; /*If the parent is hidden then the child is hidden and won't be drawn*/
par = lv_obj_get_parent(par);
}
return true; return true;
} }

View File

@@ -181,7 +181,7 @@ void lv_obj_move_foreground(lv_obj_t * obj)
lv_obj_invalidate(parent); lv_obj_invalidate(parent);
uint32_t i; int32_t i;
for(i = lv_obj_get_child_id(obj) - 1; i > 0; i--) { for(i = lv_obj_get_child_id(obj) - 1; i > 0; i--) {
parent->spec_attr->children[i] = parent->spec_attr->children[i-1]; parent->spec_attr->children[i] = parent->spec_attr->children[i-1];
} }
@@ -355,14 +355,32 @@ static void obj_del_core(lv_obj_t * obj)
/* All children deleted. Now clean up the object specific data*/ /* All children deleted. Now clean up the object specific data*/
_lv_obj_destruct(obj); _lv_obj_destruct(obj);
/*Remove the object from the child list of its parent*/ /*Remove the screen for the screen list*/
uint32_t id = lv_obj_get_child_id(obj); if(obj->parent == NULL) {
uint32_t i; lv_disp_t * disp = lv_obj_get_disp(obj);
for(i = id; i < obj->parent->spec_attr->child_cnt - 1; i++) { uint32_t i;
obj->parent->spec_attr->children[i] = obj->parent->spec_attr->children[i + 1]; /*Find the screen in the list*/
for(i = 0; i < disp->screen_cnt; i++) {
if(disp->screens[i] == obj) break;
}
uint32_t id = i;
for(i = id; i < disp->screen_cnt - 1; i++) {
disp->screens[i] = disp->screens[i + 1];
}
disp->screen_cnt--;
disp->screens = lv_mem_realloc(disp->screens, disp->screen_cnt * sizeof(lv_obj_t *));
}
/*Remove the object from the child list of its parent*/
else {
uint32_t id = lv_obj_get_child_id(obj);
uint32_t i;
for(i = id; i < obj->parent->spec_attr->child_cnt - 1; i++) {
obj->parent->spec_attr->children[i] = obj->parent->spec_attr->children[i + 1];
}
obj->parent->spec_attr->child_cnt--;
obj->parent->spec_attr->children = lv_mem_realloc(obj->parent->spec_attr->children, obj->parent->spec_attr->child_cnt * sizeof(lv_obj_t *));
} }
obj->parent->spec_attr->child_cnt--;
obj->parent->spec_attr->children = lv_mem_realloc(obj->parent->spec_attr->children, obj->parent->spec_attr->child_cnt * sizeof(lv_obj_t *));
/*Free the object itself*/ /*Free the object itself*/
lv_mem_free(obj); lv_mem_free(obj);

View File

@@ -129,6 +129,7 @@ void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
if(lv_disp_is_true_double_buf(disp)) { if(lv_disp_is_true_double_buf(disp)) {
disp->inv_areas[0] = scr_area; disp->inv_areas[0] = scr_area;
disp->inv_p = 1; disp->inv_p = 1;
lv_timer_pause(disp->read_task, false);
return; return;
} }

View File

@@ -161,11 +161,11 @@ typedef enum {
LV_STYLE_BORDER_SIDE = 51, LV_STYLE_BORDER_SIDE = 51,
LV_STYLE_BORDER_POST = 52, LV_STYLE_BORDER_POST = 52,
LV_STYLE_OUTLINE_WIDTH = 48 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_OUTLINE_WIDTH = 58 | LV_STYLE_PROP_EXT_DRAW,
LV_STYLE_OUTLINE_COLOR = 49, LV_STYLE_OUTLINE_COLOR = 59,
LV_STYLE_OUTLINE_COLOR_FILTERED = 49 | LV_STYLE_PROP_FILTER, LV_STYLE_OUTLINE_COLOR_FILTERED = 59 | LV_STYLE_PROP_FILTER,
LV_STYLE_OUTLINE_OPA = 50 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_OUTLINE_OPA = 60 | LV_STYLE_PROP_EXT_DRAW,
LV_STYLE_OUTLINE_PAD = 51 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_OUTLINE_PAD = 61 | LV_STYLE_PROP_EXT_DRAW,
/*Group 4*/ /*Group 4*/
LV_STYLE_SHADOW_WIDTH = 64 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_SHADOW_WIDTH = 64 | LV_STYLE_PROP_EXT_DRAW,