1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

fix(event): fix typos and tests

This commit is contained in:
Gabor Kiss-Vamosi 2023-03-06 12:59:57 +01:00
parent d81e126b6f
commit 6cd98892a4
25 changed files with 30 additions and 29 deletions

View File

@ -20,6 +20,7 @@ void lv_example_switch_1(void)
sw = lv_switch_create(lv_scr_act());
lv_obj_add_event(sw, event_handler, LV_EVENT_ALL, NULL);
lv_obj_add_flag(sw, LV_OBJ_FLAG_EVENT_BUBBLE);
sw = lv_switch_create(lv_scr_act());
lv_obj_add_state(sw, LV_STATE_CHECKED);

View File

@ -791,7 +791,7 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
LV_UNUSED(class_p);
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * obj = lv_event_get_original_target(e);
lv_obj_t * obj = lv_event_get_target(e);
if(code == LV_EVENT_PRESSED) {
lv_obj_add_state(obj, LV_STATE_PRESSED);
}

View File

@ -75,7 +75,7 @@ lv_res_t lv_obj_send_event(lv_obj_t * obj, lv_event_code_t event_code, void * pa
}
lv_res_t lv_event_base(const lv_obj_class_t * class_p, lv_event_t * e)
lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e)
{
const lv_obj_class_t * base;
if(class_p == NULL) base = ((lv_obj_t *)e->target)->class_p;
@ -309,7 +309,7 @@ static lv_res_t event_send_core(lv_event_t * e)
res = lv_event_send(list, e, true);
if(res != LV_RES_OK) return res;
res = lv_event_base(NULL, e);
res = lv_obj_event_base(NULL, e);
if(res != LV_RES_OK) return res;
res = lv_event_send(list, e, false);

View File

@ -434,7 +434,7 @@ static void lv_arc_event(const lv_obj_class_t * class_p, lv_event_t * e)
lv_res_t res;
/*Call the ancestor's event handler*/
res = lv_event_base(MY_CLASS, e);
res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
lv_event_code_t code = lv_event_get_code(e);

View File

@ -532,7 +532,7 @@ static void lv_bar_event(const lv_obj_class_t * class_p, lv_event_t * e)
lv_res_t res;
/*Call the ancestor's event handler*/
res = lv_event_base(MY_CLASS, e);
res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
lv_event_code_t code = lv_event_get_code(e);

View File

@ -390,7 +390,7 @@ static void lv_btnmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e)
lv_res_t res;
/*Call the ancestor's event handler*/
res = lv_event_base(MY_CLASS, e);
res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
lv_event_code_t code = lv_event_get_code(e);

View File

@ -722,7 +722,7 @@ static void lv_chart_event(const lv_obj_class_t * class_p, lv_event_t * e)
/*Call the ancestor's event handler*/
lv_res_t res;
res = lv_event_base(MY_CLASS, e);
res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
lv_event_code_t code = lv_event_get_code(e);

View File

@ -150,7 +150,7 @@ static void lv_checkbox_event(const lv_obj_class_t * class_p, lv_event_t * e)
lv_res_t res;
/*Call the ancestor's event handler*/
res = lv_event_base(MY_CLASS, e);
res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
lv_event_code_t code = lv_event_get_code(e);

View File

@ -358,7 +358,7 @@ static void lv_colorwheel_event(const lv_obj_class_t * class_p, lv_event_t * e)
LV_UNUSED(class_p);
/*Call the ancestor's event handler*/
lv_res_t res = lv_event_base(MY_CLASS, e);
lv_res_t res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;

View File

@ -651,7 +651,7 @@ static void lv_dropdown_event(const lv_obj_class_t * class_p, lv_event_t * e)
lv_res_t res;
/*Call the ancestor's event handler*/
res = lv_event_base(MY_CLASS, e);
res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
lv_event_code_t code = lv_event_get_code(e);
@ -743,7 +743,7 @@ static void lv_dropdown_list_event(const lv_obj_class_t * class_p, lv_event_t *
/*Call the ancestor's event handler*/
lv_event_code_t code = lv_event_get_code(e);
if(code != LV_EVENT_DRAW_POST) {
res = lv_event_base(MY_CLASS_LIST, e);
res = lv_obj_event_base(MY_CLASS_LIST, e);
if(res != LV_RES_OK) return;
}
lv_obj_t * list = lv_event_get_target(e);
@ -764,7 +764,7 @@ static void lv_dropdown_list_event(const lv_obj_class_t * class_p, lv_event_t *
}
else if(code == LV_EVENT_DRAW_POST) {
draw_list(e);
res = lv_event_base(MY_CLASS_LIST, e);
res = lv_obj_event_base(MY_CLASS_LIST, e);
if(res != LV_RES_OK) return;
}
}

View File

@ -443,7 +443,7 @@ static void lv_img_event(const lv_obj_class_t * class_p, lv_event_t * e)
/*Ancestor events will be called during drawing*/
if(code != LV_EVENT_DRAW_MAIN && code != LV_EVENT_DRAW_POST) {
/*Call the ancestor's event handler*/
lv_res_t res = lv_event_base(MY_CLASS, e);
lv_res_t res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
}
@ -602,7 +602,7 @@ static void draw_img(lv_event_t * e)
lv_area_copy(&ori_coords, &obj->coords);
lv_area_copy(&obj->coords, &bg_coords);
lv_res_t res = lv_event_base(MY_CLASS, e);
lv_res_t res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
lv_area_copy(&obj->coords, &ori_coords);

View File

@ -178,7 +178,7 @@ static void lv_imgbtn_event(const lv_obj_class_t * class_p, lv_event_t * e)
{
LV_UNUSED(class_p);
lv_res_t res = lv_event_base(&lv_imgbtn_class, e);
lv_res_t res = lv_obj_event_base(&lv_imgbtn_class, e);
if(res != LV_RES_OK) return;
lv_event_code_t code = lv_event_get_code(e);

View File

@ -699,7 +699,7 @@ static void lv_label_event(const lv_obj_class_t * class_p, lv_event_t * e)
LV_UNUSED(class_p);
/*Call the ancestor's event handler*/
const lv_res_t res = lv_event_base(MY_CLASS, e);
const lv_res_t res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
const lv_event_code_t code = lv_event_get_code(e);

View File

@ -166,7 +166,7 @@ static void lv_led_event(const lv_obj_class_t * class_p, lv_event_t * e)
/* Call the ancestor's event handler */
lv_event_code_t code = lv_event_get_code(e);
if(code != LV_EVENT_DRAW_MAIN && code != LV_EVENT_DRAW_MAIN_END) {
res = lv_event_base(MY_CLASS, e);
res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
}

View File

@ -138,7 +138,7 @@ static void lv_line_event(const lv_obj_class_t * class_p, lv_event_t * e)
lv_res_t res;
/*Call the ancestor's event handler*/
res = lv_event_base(MY_CLASS, e);
res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
lv_event_code_t code = lv_event_get_code(e);

View File

@ -277,7 +277,7 @@ static void lv_meter_event(const lv_obj_class_t * class_p, lv_event_t * e)
{
LV_UNUSED(class_p);
lv_res_t res = lv_event_base(MY_CLASS, e);
lv_res_t res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
lv_event_code_t code = lv_event_get_code(e);

View File

@ -326,7 +326,7 @@ static void lv_roller_event(const lv_obj_class_t * class_p, lv_event_t * e)
lv_res_t res;
/*Call the ancestor's event handler*/
res = lv_event_base(MY_CLASS, e);
res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
const lv_event_code_t code = lv_event_get_code(e);
@ -432,7 +432,7 @@ static void lv_roller_label_event(const lv_obj_class_t * class_p, lv_event_t * e
/*LV_EVENT_DRAW_MAIN will be called in the draw function*/
if(code != LV_EVENT_DRAW_MAIN) {
/* Call the ancestor's event handler */
res = lv_event_base(MY_CLASS_LABEL, e);
res = lv_obj_event_base(MY_CLASS_LABEL, e);
if(res != LV_RES_OK) return;
}

View File

@ -102,7 +102,7 @@ static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e)
lv_res_t res;
/*Call the ancestor's event handler*/
res = lv_event_base(MY_CLASS, e);
res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
lv_event_code_t code = lv_event_get_code(e);

View File

@ -533,7 +533,7 @@ static void lv_spangroup_event(const lv_obj_class_t * class_p, lv_event_t * e)
LV_UNUSED(class_p);
/* Call the ancestor's event handler */
if(lv_event_base(MY_CLASS, e) != LV_RES_OK) return;
if(lv_obj_event_base(MY_CLASS, e) != LV_RES_OK) return;
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * obj = lv_event_get_target(e);

View File

@ -364,7 +364,7 @@ static void lv_spinbox_event(const lv_obj_class_t * class_p, lv_event_t * e)
/*Call the ancestor's event handler*/
lv_res_t res = LV_RES_OK;
res = lv_event_base(MY_CLASS, e);
res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
const lv_event_code_t code = lv_event_get_code(e);

View File

@ -113,7 +113,7 @@ static void lv_switch_event(const lv_obj_class_t * class_p, lv_event_t * e)
lv_res_t res;
/*Call the ancestor's event handler*/
res = lv_event_base(MY_CLASS, e);
res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
lv_event_code_t code = lv_event_get_code(e);

View File

@ -459,7 +459,7 @@ static void lv_table_event(const lv_obj_class_t * class_p, lv_event_t * e)
lv_res_t res;
/*Call the ancestor's event handler*/
res = lv_event_base(MY_CLASS, e);
res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
lv_event_code_t code = lv_event_get_code(e);

View File

@ -290,7 +290,7 @@ static void lv_tabview_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj
static void lv_tabview_event(const lv_obj_class_t * class_p, lv_event_t * e)
{
LV_UNUSED(class_p);
lv_res_t res = lv_event_base(&lv_tabview_class, e);
lv_res_t res = lv_obj_event_base(&lv_tabview_class, e);
if(res != LV_RES_OK) return;
lv_event_code_t code = lv_event_get_code(e);

View File

@ -877,7 +877,7 @@ static void lv_textarea_event(const lv_obj_class_t * class_p, lv_event_t * e)
lv_res_t res;
/*Call the ancestor's event handler*/
res = lv_event_base(MY_CLASS, e);
res = lv_obj_event_base(MY_CLASS, e);
if(res != LV_RES_OK) return;
lv_event_code_t code = lv_event_get_code(e);

View File

@ -7,7 +7,7 @@ static void event_object_deletion_cb(const lv_obj_class_t * cls, lv_event_t * e)
{
LV_UNUSED(cls);
if(lv_event_get_code(e) == LV_EVENT_VALUE_CHANGED) {
lv_obj_del(lv_event_get_current_target(e));
lv_obj_del(lv_event_get_target(e));
}
}