Merge branch 'dev-6.0' of https://github.com/littlevgl/lvgl into dev-6.0
This commit is contained in:
@@ -57,6 +57,7 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
|
||||
**********************/
|
||||
static bool lv_initialized = false;
|
||||
static lv_event_temp_data_t * event_temp_data_head;
|
||||
static const void * event_act_data;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@@ -1327,6 +1328,23 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data)
|
||||
{
|
||||
if(obj == NULL) return LV_RES_OK;
|
||||
|
||||
lv_res_t res;
|
||||
res = lv_event_send_func(obj->event_cb, obj, event, data);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call an event function with an object, event, and data.
|
||||
* @param event_cb an event callback function. If `NULL` `LV_RES_OK` will return without any actions.
|
||||
* @param obj pointer to an object to associate with the event (can be `NULL` to simply call the `event_cb`)
|
||||
* @param event an event
|
||||
* @param data pointer to a custom data
|
||||
* @return LV_RES_OK: `obj` was not deleted in the event; LV_RES_INV: `obj` was deleted in the event
|
||||
*/
|
||||
lv_res_t lv_event_send_func(lv_event_cb_t event_cb, lv_obj_t * obj, lv_event_t event, const void * data)
|
||||
{
|
||||
if(event_cb == NULL) return LV_RES_OK;
|
||||
|
||||
lv_event_temp_data_t event_temp_data;
|
||||
event_temp_data.obj = obj;
|
||||
event_temp_data.deleted = false;
|
||||
@@ -1341,18 +1359,26 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data)
|
||||
|
||||
event_temp_data_head = &event_temp_data;
|
||||
|
||||
if(obj->event_cb) obj->event_cb(obj, event);
|
||||
event_act_data = data;
|
||||
|
||||
if(event_cb) event_cb(obj, event);
|
||||
|
||||
/*Remove this element from the list*/
|
||||
event_temp_data_head = event_temp_data_head->prev;
|
||||
|
||||
if(event_temp_data.deleted) {
|
||||
event_act_data = NULL;
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if(obj->parent_event && obj->par) {
|
||||
lv_res_t res = lv_event_send(obj->par, event, data);
|
||||
if(res != LV_RES_OK) return LV_RES_INV;
|
||||
if(obj) {
|
||||
if(obj->parent_event && obj->par) {
|
||||
lv_res_t res = lv_event_send(obj->par, event, data);
|
||||
if(res != LV_RES_OK) {
|
||||
event_act_data = NULL;
|
||||
return LV_RES_INV;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return LV_RES_OK;
|
||||
@@ -1364,7 +1390,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)
|
||||
{
|
||||
return NULL; //event_act_data;
|
||||
return event_act_data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1944,14 +1970,15 @@ void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf)
|
||||
}
|
||||
|
||||
#if LV_USE_USER_DATA_SINGLE
|
||||
|
||||
/**
|
||||
* Get a pointer to the object's user data
|
||||
* @param obj pointer to an object
|
||||
* @return pointer to the user data
|
||||
*/
|
||||
lv_obj_user_data_t * lv_obj_get_user_data(lv_obj_t * obj)
|
||||
lv_obj_user_data_t lv_obj_get_user_data(lv_obj_t * obj)
|
||||
{
|
||||
return &obj->user_data;
|
||||
return obj->user_data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -562,6 +562,16 @@ void lv_obj_set_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb);
|
||||
*/
|
||||
lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data);
|
||||
|
||||
/**
|
||||
* Call an event function with an object, event, and data.
|
||||
* @param event_cb an event callback function
|
||||
* @param obj pointer to an object to associate with the event (can be `NULL` to simply call the `event_cb`)
|
||||
* @param event an event
|
||||
* @param data pointer to a custom data
|
||||
* @return LV_RES_OK: `obj` was not deleted in the event; LV_RES_INV: `obj` was deleted in the event
|
||||
*/
|
||||
lv_res_t lv_event_send_func(lv_event_cb_t event_cb, lv_obj_t * obj, lv_event_t event, const void * data);
|
||||
|
||||
/**
|
||||
* Get the `data` parameter of the current event
|
||||
* @return the `data` parameter
|
||||
@@ -903,7 +913,7 @@ void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf);
|
||||
* @param obj pointer to an object
|
||||
* @return pointer to the user data
|
||||
*/
|
||||
lv_obj_user_data_t * lv_obj_get_user_data(lv_obj_t * obj);
|
||||
lv_obj_user_data_t lv_obj_get_user_data(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Set the object's user data. The data will be copied.
|
||||
|
||||
@@ -72,7 +72,12 @@ void lv_refr_init(void)
|
||||
*/
|
||||
void lv_refr_now(void)
|
||||
{
|
||||
lv_disp_refr_task(NULL);
|
||||
lv_disp_t * d;
|
||||
d = lv_disp_get_next(NULL);
|
||||
while(d) {
|
||||
lv_disp_refr_task(d->refr_task);
|
||||
d = lv_disp_get_next(d);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -204,9 +204,7 @@ lv_task_t * lv_task_create(void (*task)(lv_task_t *), uint32_t period, lv_task_p
|
||||
new_lv_task->once = 0;
|
||||
new_lv_task->last_run = lv_tick_get();
|
||||
|
||||
#if LV_USE_USER_DATA_SINGLE
|
||||
new_lv_task->user_data = user_data;
|
||||
#endif
|
||||
|
||||
#if LV_USE_USER_DATA_MULTI
|
||||
new_lv_task->task_user_data = NULL;
|
||||
|
||||
@@ -57,9 +57,7 @@ typedef struct _lv_task_t
|
||||
uint32_t last_run;
|
||||
void (*task_cb)(struct _lv_task_t *);
|
||||
|
||||
#if LV_USE_USER_DATA_SINGLE
|
||||
void * user_data;
|
||||
#endif
|
||||
|
||||
#if LV_USE_USER_DATA_MULTI
|
||||
void * task_user_data;
|
||||
|
||||
@@ -215,7 +215,6 @@ void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay)
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
a.user_data = NULL;
|
||||
lv_anim_create(&a);
|
||||
|
||||
a.start = lv_obj_get_width(mbox);
|
||||
@@ -239,7 +238,6 @@ void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay)
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
a.user_data = NULL;
|
||||
lv_anim_create(&a);
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -48,6 +48,7 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
||||
static void cursor_blink_anim(lv_obj_t * ta, uint8_t show);
|
||||
static void pwd_char_hider_anim(lv_obj_t * ta, int32_t x);
|
||||
#endif
|
||||
static void pwd_char_hider_anim_ready(lv_anim_t * a);
|
||||
static void pwd_char_hider(lv_obj_t * ta);
|
||||
static bool char_is_accepted(lv_obj_t * ta, uint32_t c);
|
||||
static void get_cursor_style(lv_obj_t * ta, lv_style_t * style_res);
|
||||
@@ -252,7 +253,7 @@ void lv_ta_add_char(lv_obj_t * ta, uint32_t c)
|
||||
a.exec_cb = (lv_anim_exec_cb_t)pwd_char_hider_anim;
|
||||
a.time = LV_TA_PWD_SHOW_TIME;
|
||||
a.act_time = 0;
|
||||
a.ready_cb = (lv_anim_ready_cb_t)pwd_char_hider;
|
||||
a.ready_cb = pwd_char_hider_anim_ready;
|
||||
a.start = 0;
|
||||
a.end = 1;
|
||||
a.repeat = 0;
|
||||
@@ -332,7 +333,7 @@ void lv_ta_add_text(lv_obj_t * ta, const char * txt)
|
||||
a.exec_cb = (lv_anim_exec_cb_t)pwd_char_hider_anim;
|
||||
a.time = LV_TA_PWD_SHOW_TIME;
|
||||
a.act_time = 0;
|
||||
a.ready_cb = (lv_anim_ready_cb_t)pwd_char_hider;
|
||||
a.ready_cb = pwd_char_hider_anim_ready;
|
||||
a.start = 0;
|
||||
a.end = 1;
|
||||
a.repeat = 0;
|
||||
@@ -469,10 +470,10 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt)
|
||||
/*Auto hide characters*/
|
||||
lv_anim_t a;
|
||||
a.var = ta;
|
||||
a.exec_cb = (lv_anim_exec_cb_t)pwd_char_hider_anim;
|
||||
a.exec_cb = (lv_anim_exec_cb_t)pwd_char_hider_anim;
|
||||
a.time = LV_TA_PWD_SHOW_TIME;
|
||||
a.act_time = 0;
|
||||
a.ready_cb = (lv_anim_ready_cb_t)pwd_char_hider;
|
||||
a.ready_cb = pwd_char_hider_anim_ready;
|
||||
a.start = 0;
|
||||
a.end = 1;
|
||||
a.repeat = 0;
|
||||
@@ -1418,6 +1419,17 @@ static void pwd_char_hider_anim(lv_obj_t * ta, int32_t x)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Call when an animation is ready to convert all characters to '*'
|
||||
* @param a pointer to the animation
|
||||
*/
|
||||
static void pwd_char_hider_anim_ready(lv_anim_t * a)
|
||||
{
|
||||
lv_obj_t * ta = a->var;
|
||||
pwd_char_hider(ta);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide all characters (convert them to '*')
|
||||
* @param ta: pointer to text area object
|
||||
|
||||
Reference in New Issue
Block a user