Merge branch 'dev-6.0' into font
This commit is contained in:
@@ -34,6 +34,12 @@
|
|||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
**********************/
|
**********************/
|
||||||
|
typedef struct _lv_event_temp_data
|
||||||
|
{
|
||||||
|
lv_obj_t * obj;
|
||||||
|
bool deleted;
|
||||||
|
struct _lv_event_temp_data * prev;
|
||||||
|
}lv_event_temp_data_t;
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC PROTOTYPES
|
* STATIC PROTOTYPES
|
||||||
@@ -42,6 +48,7 @@ static void refresh_children_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coor
|
|||||||
static void report_style_mod_core(void * style_p, lv_obj_t * obj);
|
static void report_style_mod_core(void * style_p, lv_obj_t * obj);
|
||||||
static void refresh_children_style(lv_obj_t * obj);
|
static void refresh_children_style(lv_obj_t * obj);
|
||||||
static void delete_children(lv_obj_t * obj);
|
static void delete_children(lv_obj_t * obj);
|
||||||
|
static void lv_event_mark_deleted(lv_obj_t * obj);
|
||||||
static bool lv_obj_design(lv_obj_t * obj, const lv_area_t * mask_p, lv_design_mode_t mode);
|
static bool lv_obj_design(lv_obj_t * obj, const lv_area_t * mask_p, lv_design_mode_t mode);
|
||||||
static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
|
static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
|
||||||
|
|
||||||
@@ -49,9 +56,8 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
|
|||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
**********************/
|
**********************/
|
||||||
static bool lv_initialized = false;
|
static bool lv_initialized = false;
|
||||||
static lv_obj_t * event_act_obj; /*Stores the which event is currently being executed*/
|
static lv_event_temp_data_t * event_temp_data_head;
|
||||||
static bool event_act_obj_deleted; /*Shows that the object was deleted in the event function*/
|
|
||||||
static const void * event_act_data; /*Stores the data passed to the event*/
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
**********************/
|
**********************/
|
||||||
@@ -377,8 +383,6 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
|
|||||||
{
|
{
|
||||||
lv_obj_invalidate(obj);
|
lv_obj_invalidate(obj);
|
||||||
|
|
||||||
if(event_act_obj == obj && event_act_obj_deleted == false) event_act_obj_deleted = true;
|
|
||||||
|
|
||||||
/*Delete from the group*/
|
/*Delete from the group*/
|
||||||
#if LV_USE_GROUP
|
#if LV_USE_GROUP
|
||||||
bool was_focused = false;
|
bool was_focused = false;
|
||||||
@@ -410,9 +414,11 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
|
|||||||
i = i_next;
|
i = i_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Let the suer free the resources used in `LV_EVENT_DELETE`*/
|
/*Let the user free the resources used in `LV_EVENT_DELETE`*/
|
||||||
lv_event_send(obj, LV_EVENT_DELETE, NULL);
|
lv_event_send(obj, LV_EVENT_DELETE, NULL);
|
||||||
|
|
||||||
|
lv_event_mark_deleted(obj);
|
||||||
|
|
||||||
/*Remove the object from parent's children list*/
|
/*Remove the object from parent's children list*/
|
||||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||||
if(par == NULL) { /*It is a screen*/
|
if(par == NULL) { /*It is a screen*/
|
||||||
@@ -1277,25 +1283,26 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data)
|
|||||||
{
|
{
|
||||||
if(obj == NULL) return LV_RES_OK;
|
if(obj == NULL) return LV_RES_OK;
|
||||||
|
|
||||||
/*If the event was send from an other event save the current states to restore it at the end*/
|
lv_event_temp_data_t event_temp_data;
|
||||||
lv_obj_t * prev_obj_act = event_act_obj;
|
event_temp_data.obj = obj;
|
||||||
bool prev_obj_act_deleted = event_act_obj_deleted;
|
event_temp_data.deleted = false;
|
||||||
const void * prev_data = event_act_data;
|
event_temp_data.prev = NULL;
|
||||||
|
|
||||||
event_act_obj = obj;
|
if(event_temp_data_head == NULL) {
|
||||||
event_act_obj_deleted = false;
|
event_temp_data_head = &event_temp_data;
|
||||||
event_act_data = data;
|
} else {
|
||||||
|
event_temp_data.prev = event_temp_data_head;
|
||||||
|
event_temp_data_head = &event_temp_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
event_temp_data_head = &event_temp_data;
|
||||||
|
|
||||||
if(obj->event_cb) obj->event_cb(obj, event);
|
if(obj->event_cb) obj->event_cb(obj, event);
|
||||||
|
|
||||||
bool deleted = event_act_obj_deleted;
|
/*Remove this element from the list*/
|
||||||
|
event_temp_data_head = event_temp_data_head->prev;
|
||||||
|
|
||||||
/*Restore the previous states*/
|
if(event_temp_data.deleted) {
|
||||||
event_act_obj = prev_obj_act;
|
|
||||||
event_act_obj_deleted = prev_obj_act_deleted;
|
|
||||||
event_act_data = prev_data;
|
|
||||||
|
|
||||||
if(deleted) {
|
|
||||||
return LV_RES_INV;
|
return LV_RES_INV;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1313,7 +1320,7 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data)
|
|||||||
*/
|
*/
|
||||||
const void * lv_event_get_data(void)
|
const void * lv_event_get_data(void)
|
||||||
{
|
{
|
||||||
return event_act_data;
|
return NULL; //event_act_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2176,9 +2183,6 @@ static void refresh_children_style(lv_obj_t * obj)
|
|||||||
*/
|
*/
|
||||||
static void delete_children(lv_obj_t * obj)
|
static void delete_children(lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(event_act_obj == obj && event_act_obj_deleted == false) event_act_obj_deleted = true;
|
|
||||||
|
|
||||||
lv_obj_t * i;
|
lv_obj_t * i;
|
||||||
lv_obj_t * i_next;
|
lv_obj_t * i_next;
|
||||||
i = lv_ll_get_head(&(obj->child_ll));
|
i = lv_ll_get_head(&(obj->child_ll));
|
||||||
@@ -2210,6 +2214,8 @@ static void delete_children(lv_obj_t * obj)
|
|||||||
/*Let the suer free the resources used in `LV_EVENT_DELETE`*/
|
/*Let the suer free the resources used in `LV_EVENT_DELETE`*/
|
||||||
lv_event_send(obj, LV_EVENT_DELETE, NULL);
|
lv_event_send(obj, LV_EVENT_DELETE, NULL);
|
||||||
|
|
||||||
|
lv_event_mark_deleted(obj);
|
||||||
|
|
||||||
/*Remove the animations from this object*/
|
/*Remove the animations from this object*/
|
||||||
#if LV_USE_ANIMATION
|
#if LV_USE_ANIMATION
|
||||||
lv_anim_del(obj, NULL);
|
lv_anim_del(obj, NULL);
|
||||||
@@ -2241,3 +2247,13 @@ static void delete_children(lv_obj_t * obj)
|
|||||||
if(obj->ext_attr != NULL) lv_mem_free(obj->ext_attr);
|
if(obj->ext_attr != NULL) lv_mem_free(obj->ext_attr);
|
||||||
lv_mem_free(obj); /*Free the object itself*/
|
lv_mem_free(obj); /*Free the object itself*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void lv_event_mark_deleted(lv_obj_t * obj)
|
||||||
|
{
|
||||||
|
lv_event_temp_data_t * t = event_temp_data_head;
|
||||||
|
|
||||||
|
while(t) {
|
||||||
|
if(t->obj == obj) t->deleted = true;
|
||||||
|
t = t->prev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -137,8 +137,7 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
|
|||||||
disp_def = disp_def_tmp; /*Revert the default display*/
|
disp_def = disp_def_tmp; /*Revert the default display*/
|
||||||
|
|
||||||
/*Create a refresh task*/
|
/*Create a refresh task*/
|
||||||
disp->refr_task =
|
disp->refr_task = lv_task_create(lv_disp_refr_task, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, disp);
|
||||||
lv_task_create(lv_disp_refr_task, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, disp);
|
|
||||||
lv_mem_assert(disp->refr_task);
|
lv_mem_assert(disp->refr_task);
|
||||||
if(disp->refr_task == NULL) return NULL;
|
if(disp->refr_task == NULL) return NULL;
|
||||||
|
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void)
|
|||||||
* @param user_data custom parameter
|
* @param user_data custom parameter
|
||||||
* @return pointer to the new task
|
* @return pointer to the new task
|
||||||
*/
|
*/
|
||||||
lv_task_t * lv_task_create(void (*task)(void *), uint32_t period, lv_task_prio_t prio, void * user_data)
|
lv_task_t * lv_task_create(void (*task)(lv_task_t *), uint32_t period, lv_task_prio_t prio, void * user_data)
|
||||||
{
|
{
|
||||||
lv_task_t * new_lv_task = NULL;
|
lv_task_t * new_lv_task = NULL;
|
||||||
lv_task_t * tmp;
|
lv_task_t * tmp;
|
||||||
|
|||||||
@@ -51,11 +51,11 @@ typedef uint8_t lv_task_prio_t;
|
|||||||
/**
|
/**
|
||||||
* Descriptor of a lv_task
|
* Descriptor of a lv_task
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct _lv_task_t
|
||||||
{
|
{
|
||||||
uint32_t period;
|
uint32_t period;
|
||||||
uint32_t last_run;
|
uint32_t last_run;
|
||||||
void (*task_cb)(void *);
|
void (*task_cb)(struct _lv_task_t *);
|
||||||
|
|
||||||
#if LV_USE_USER_DATA_SINGLE
|
#if LV_USE_USER_DATA_SINGLE
|
||||||
void * user_data;
|
void * user_data;
|
||||||
@@ -91,7 +91,7 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void);
|
|||||||
* @param user_data custom parameter
|
* @param user_data custom parameter
|
||||||
* @return pointer to the new task_cb
|
* @return pointer to the new task_cb
|
||||||
*/
|
*/
|
||||||
lv_task_t * lv_task_create(void (*task)(void *), uint32_t period, lv_task_prio_t prio, void * user_data);
|
lv_task_t * lv_task_create(void (*task)(lv_task_t *), uint32_t period, lv_task_prio_t prio, void * user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a lv_task
|
* Delete a lv_task
|
||||||
|
|||||||
@@ -721,7 +721,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
|||||||
button_is_inactive(ext->ctrl_bits[ext->btn_id_act]) == false &&
|
button_is_inactive(ext->ctrl_bits[ext->btn_id_act]) == false &&
|
||||||
button_is_hidden(ext->ctrl_bits[ext->btn_id_act]) == false) {
|
button_is_hidden(ext->ctrl_bits[ext->btn_id_act]) == false) {
|
||||||
uint32_t b = ext->btn_id_act;
|
uint32_t b = ext->btn_id_act;
|
||||||
lv_event_send(btnm, LV_EVENT_SELECTED, &b);
|
res = lv_event_send(btnm, LV_EVENT_SELECTED, &b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(sign == LV_SIGNAL_PRESSING) {
|
} else if(sign == LV_SIGNAL_PRESSING) {
|
||||||
@@ -737,10 +737,12 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
|||||||
}
|
}
|
||||||
if(btn_pr != LV_BTNM_BTN_NONE) {
|
if(btn_pr != LV_BTNM_BTN_NONE) {
|
||||||
uint32_t b = ext->btn_id_act;
|
uint32_t b = ext->btn_id_act;
|
||||||
lv_event_send(btnm, LV_EVENT_SELECTED, &b);
|
res = lv_event_send(btnm, LV_EVENT_SELECTED, &b);
|
||||||
|
if(res == LV_RES_OK) {
|
||||||
invalidate_button_area(btnm, btn_pr);
|
invalidate_button_area(btnm, btn_pr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ext->btn_id_pr = btn_pr;
|
ext->btn_id_pr = btn_pr;
|
||||||
ext->btn_id_act = btn_pr;
|
ext->btn_id_act = btn_pr;
|
||||||
@@ -773,7 +775,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
|||||||
button_is_inactive(ext->ctrl_bits[ext->btn_id_act]) == false &&
|
button_is_inactive(ext->ctrl_bits[ext->btn_id_act]) == false &&
|
||||||
button_is_hidden(ext->ctrl_bits[ext->btn_id_act]) == false) {
|
button_is_hidden(ext->ctrl_bits[ext->btn_id_act]) == false) {
|
||||||
uint32_t b = ext->btn_id_act;
|
uint32_t b = ext->btn_id_act;
|
||||||
lv_event_send(btnm, LV_EVENT_SELECTED, &b);
|
res = lv_event_send(btnm, LV_EVENT_SELECTED, &b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(sign == LV_SIGNAL_LONG_PRESS_REP) {
|
} else if(sign == LV_SIGNAL_LONG_PRESS_REP) {
|
||||||
@@ -782,7 +784,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
|||||||
button_is_inactive(ext->ctrl_bits[ext->btn_id_act]) == false &&
|
button_is_inactive(ext->ctrl_bits[ext->btn_id_act]) == false &&
|
||||||
button_is_hidden(ext->ctrl_bits[ext->btn_id_act]) == false) {
|
button_is_hidden(ext->ctrl_bits[ext->btn_id_act]) == false) {
|
||||||
uint32_t b = ext->btn_id_act;
|
uint32_t b = ext->btn_id_act;
|
||||||
lv_event_send(btnm, LV_EVENT_SELECTED, &b);
|
res = lv_event_send(btnm, LV_EVENT_SELECTED, &b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(sign == LV_SIGNAL_PRESS_LOST || sign == LV_SIGNAL_DEFOCUS) {
|
} else if(sign == LV_SIGNAL_PRESS_LOST || sign == LV_SIGNAL_DEFOCUS) {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ static const lv_btnm_ctrl_t kb_ctrl_lc_map[] = {
|
|||||||
LV_KB_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
|
LV_KB_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
|
||||||
LV_KB_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
|
LV_KB_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
2, 2, 6, 2, 2};
|
LV_KB_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KB_CTRL_BTN_FLAGS | 2};
|
||||||
|
|
||||||
static const char * kb_map_uc[] = {"1#", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "Bksp", "\n",
|
static const char * kb_map_uc[] = {"1#", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "Bksp", "\n",
|
||||||
"abc", "A", "S", "D", "F", "G", "H", "J", "K", "L", "Enter", "\n",
|
"abc", "A", "S", "D", "F", "G", "H", "J", "K", "L", "Enter", "\n",
|
||||||
@@ -52,7 +52,7 @@ static const lv_btnm_ctrl_t kb_ctrl_uc_map[] = {
|
|||||||
LV_KB_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
|
LV_KB_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
|
||||||
LV_KB_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
|
LV_KB_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
2, 2, 6, 2, 2};
|
LV_KB_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KB_CTRL_BTN_FLAGS | 2};
|
||||||
|
|
||||||
static const char * kb_map_spec[] = {"0", "1", "2", "3", "4" ,"5", "6", "7", "8", "9", "Bksp", "\n",
|
static const char * kb_map_spec[] = {"0", "1", "2", "3", "4" ,"5", "6", "7", "8", "9", "Bksp", "\n",
|
||||||
"abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n",
|
"abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n",
|
||||||
@@ -122,7 +122,7 @@ lv_obj_t * lv_kb_create(lv_obj_t * par, const lv_obj_t * copy)
|
|||||||
* Don't use `par` directly because if the window is created on a page it is moved to the
|
* 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 */
|
* scrollable so the parent has changed */
|
||||||
lv_obj_set_size(new_kb, lv_obj_get_width_fit(lv_obj_get_parent(new_kb)),
|
lv_obj_set_size(new_kb, lv_obj_get_width_fit(lv_obj_get_parent(new_kb)),
|
||||||
lv_obj_get_height_fit(lv_obj_get_parent(new_kb)));
|
lv_obj_get_height_fit(lv_obj_get_parent(new_kb)) / 2);
|
||||||
|
|
||||||
lv_obj_align(new_kb, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
lv_obj_align(new_kb, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
||||||
lv_obj_set_event_cb(new_kb, lv_kb_def_event_cb);
|
lv_obj_set_event_cb(new_kb, lv_kb_def_event_cb);
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, const lv_obj_t * copy)
|
|||||||
ext->cursor.type = LV_CURSOR_LINE;
|
ext->cursor.type = LV_CURSOR_LINE;
|
||||||
ext->cursor.valid_x = 0;
|
ext->cursor.valid_x = 0;
|
||||||
ext->one_line = 0;
|
ext->one_line = 0;
|
||||||
|
ext->text_sel_en = 0;
|
||||||
ext->label = NULL;
|
ext->label = NULL;
|
||||||
ext->placeholder = NULL;
|
ext->placeholder = NULL;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user