aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabor Kiss-Vamosi <kisvegabor@gmail.com>2023-03-20 14:24:21 +0100
committerGabor Kiss-Vamosi <kisvegabor@gmail.com>2023-03-20 14:24:21 +0100
commit1faa4c8d7a6322d4f74d55e10015d85d608ef51e (patch)
treec38a4512771ce9608f284740d4a4f3dc41d5dce8
parentcdcd6cf5ef33ed1ad898c6d03f213fe4bb54ad49 (diff)
downloadlvgl-1faa4c8d7a6322d4f74d55e10015d85d608ef51e.tar.gz
lvgl-1faa4c8d7a6322d4f74d55e10015d85d608ef51e.zip
revert(event): use original_target and target to follow JS conventions
fixes #4050
-rw-r--r--demos/keypad_encoder/lv_demo_keypad_encoder.c2
-rw-r--r--demos/widgets/lv_demo_widgets.c2
-rw-r--r--examples/event/lv_example_event_3.c4
-rw-r--r--examples/event/lv_example_event_3.py8
-rw-r--r--examples/others/gridnav/lv_example_gridnav_4.c4
-rw-r--r--examples/porting/lv_port_disp_template.c6
-rw-r--r--examples/widgets/checkbox/lv_example_checkbox_2.c4
-rw-r--r--examples/widgets/checkbox/lv_example_checkbox_2.py4
-rw-r--r--src/core/lv_disp.c2
-rw-r--r--src/core/lv_obj_event.c20
-rw-r--r--src/misc/lv_event.c8
-rw-r--r--src/misc/lv_event.h4
-rw-r--r--src/others/gridnav/lv_gridnav.c2
13 files changed, 35 insertions, 35 deletions
diff --git a/demos/keypad_encoder/lv_demo_keypad_encoder.c b/demos/keypad_encoder/lv_demo_keypad_encoder.c
index b09154e12..1b55bca10 100644
--- a/demos/keypad_encoder/lv_demo_keypad_encoder.c
+++ b/demos/keypad_encoder/lv_demo_keypad_encoder.c
@@ -179,7 +179,7 @@ static void msgbox_create(void)
static void msgbox_event_cb(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e);
- lv_obj_t * msgbox = lv_event_get_target(e);
+ lv_obj_t * msgbox = lv_event_get_current_target(e);
if(code == LV_EVENT_VALUE_CHANGED) {
const char * txt = lv_msgbox_get_active_btn_text(msgbox);
diff --git a/demos/widgets/lv_demo_widgets.c b/demos/widgets/lv_demo_widgets.c
index f49f5f8ed..a42efc5c9 100644
--- a/demos/widgets/lv_demo_widgets.c
+++ b/demos/widgets/lv_demo_widgets.c
@@ -1254,7 +1254,7 @@ static void calendar_event_cb(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * ta = lv_event_get_user_data(e);
- lv_obj_t * obj = lv_event_get_target(e);
+ lv_obj_t * obj = lv_event_get_current_target(e);
if(code == LV_EVENT_VALUE_CHANGED) {
lv_calendar_date_t d;
lv_calendar_get_pressed_date(obj, &d);
diff --git a/examples/event/lv_example_event_3.c b/examples/event/lv_example_event_3.c
index e0a9097a9..f64067c12 100644
--- a/examples/event/lv_example_event_3.c
+++ b/examples/event/lv_example_event_3.c
@@ -4,10 +4,10 @@
static void event_cb(lv_event_t * e)
{
/*The original target of the event. Can be the buttons or the container*/
- lv_obj_t * target = lv_event_get_original_target(e);
+ lv_obj_t * target = lv_event_get_target(e);
/*The current target is always the container as the event is added to it*/
- lv_obj_t * cont = lv_event_get_target(e);
+ lv_obj_t * cont = lv_event_get_current_target(e);
/*If container was clicked do nothing*/
if(target == cont) return;
diff --git a/examples/event/lv_example_event_3.py b/examples/event/lv_example_event_3.py
index 9c0a47fc2..a05b299a5 100644
--- a/examples/event/lv_example_event_3.py
+++ b/examples/event/lv_example_event_3.py
@@ -1,11 +1,11 @@
def event_cb(e):
# The original target of the event. Can be the buttons or the container
- target = e.get_original_target_obj()
-
+ target = e.get_target_obj()
+
# The current target is always the container as the event is added to it
- cont = e.get_target_obj()
-
+ cont = e.get_current_target_obj()
+
# If container was clicked do nothing
if target == cont:
return
diff --git a/examples/others/gridnav/lv_example_gridnav_4.c b/examples/others/gridnav/lv_example_gridnav_4.c
index 0bf0d85d3..4eabd3e7e 100644
--- a/examples/others/gridnav/lv_example_gridnav_4.c
+++ b/examples/others/gridnav/lv_example_gridnav_4.c
@@ -19,7 +19,7 @@ void lv_example_gridnav_4(void)
lv_obj_t * list = lv_list_create(lv_scr_act());
lv_gridnav_add(list, LV_GRIDNAV_CTRL_ROLLOVER);
- lv_obj_align(list, LV_ALIGN_LEFT_MID, 0, 10);
+ lv_obj_align(list, LV_ALIGN_LEFT_MID, 10, 0);
lv_group_add_obj(lv_group_get_default(), list);
uint32_t i;
@@ -39,7 +39,7 @@ void lv_example_gridnav_4(void)
}
lv_obj_t * btn = lv_btn_create(lv_scr_act());
- lv_obj_align(btn, LV_ALIGN_RIGHT_MID, 0, -10);
+ lv_obj_align(btn, LV_ALIGN_RIGHT_MID, -10, 0);
lv_obj_t * label = lv_label_create(btn);
lv_label_set_text(label, "Button");
}
diff --git a/examples/porting/lv_port_disp_template.c b/examples/porting/lv_port_disp_template.c
index 9c3a4c1c5..1cd74f798 100644
--- a/examples/porting/lv_port_disp_template.c
+++ b/examples/porting/lv_port_disp_template.c
@@ -34,7 +34,7 @@
**********************/
static void disp_init(void);
-static void disp_flush(lv_disp_t * disp, const lv_area_t * area, lv_color_t * color_p);
+static void disp_flush(lv_disp_t * disp, const lv_area_t * area, lv_color_t * color_buf);
/**********************
* STATIC VARIABLES
@@ -111,7 +111,7 @@ void disp_disable_update(void)
/*Flush the content of the internal buffer the specific area on the display
*You can use DMA or any hardware acceleration to do this operation in the background but
*'lv_disp_flush_ready()' has to be called when finished.*/
-static void disp_flush(lv_disp_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
+static void disp_flush(lv_disp_t * disp_drv, const lv_area_t * area, lv_color_t * color_buf)
{
if(disp_flush_enabled) {
/*The most simple case (but also the slowest) to put all pixels to the screen one-by-one*/
@@ -122,7 +122,7 @@ static void disp_flush(lv_disp_t * disp_drv, const lv_area_t * area, lv_color_t
for(x = area->x1; x <= area->x2; x++) {
/*Put a pixel to the display. For example:*/
/*put_px(x, y, *color_p)*/
- color_p++;
+ color_buf++;
}
}
}
diff --git a/examples/widgets/checkbox/lv_example_checkbox_2.c b/examples/widgets/checkbox/lv_example_checkbox_2.c
index 93c1b33bc..70056d44e 100644
--- a/examples/widgets/checkbox/lv_example_checkbox_2.c
+++ b/examples/widgets/checkbox/lv_example_checkbox_2.c
@@ -9,8 +9,8 @@ static uint32_t active_index_2 = 0;
static void radio_event_handler(lv_event_t * e)
{
uint32_t * active_id = lv_event_get_user_data(e);
- lv_obj_t * cont = lv_event_get_target(e);
- lv_obj_t * act_cb = lv_event_get_original_target(e);
+ lv_obj_t * cont = lv_event_get_current_target(e);
+ lv_obj_t * act_cb = lv_event_get_target(e);
lv_obj_t * old_cb = lv_obj_get_child(cont, *active_id);
/*Do nothing if the container was clicked*/
diff --git a/examples/widgets/checkbox/lv_example_checkbox_2.py b/examples/widgets/checkbox/lv_example_checkbox_2.py
index 76452c20c..f6f9ca01d 100644
--- a/examples/widgets/checkbox/lv_example_checkbox_2.py
+++ b/examples/widgets/checkbox/lv_example_checkbox_2.py
@@ -49,8 +49,8 @@ class LV_Example_Checkbox_2:
def radio_event_handler(self,e):
- cont = e.get_target_obj()
- act_cb = e.get_original_target_obj()
+ cont = e.get_current_target_obj()
+ act_cb = e.get_target_obj()
if cont == self.cont1:
active_id = self.active_index_1
else:
diff --git a/src/core/lv_disp.c b/src/core/lv_disp.c
index e8c1ad04b..57e4532dd 100644
--- a/src/core/lv_disp.c
+++ b/src/core/lv_disp.c
@@ -734,7 +734,7 @@ lv_res_t lv_disp_send_event(lv_disp_t * disp, lv_event_code_t code, void * user_
lv_event_t e;
lv_memzero(&e, sizeof(e));
e.code = code;
- e.target = disp;
+ e.current_target = disp;
e.original_target = disp;
e.param = user_data;
lv_res_t res;
diff --git a/src/core/lv_obj_event.c b/src/core/lv_obj_event.c
index c71ad2713..6c48c5e1a 100644
--- a/src/core/lv_obj_event.c
+++ b/src/core/lv_obj_event.c
@@ -49,7 +49,7 @@ lv_res_t lv_obj_send_event(lv_obj_t * obj, lv_event_code_t event_code, void * pa
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_event_t e;
- e.target = obj;
+ e.current_target = obj;
e.original_target = obj;
e.code = event_code;
e.user_data = NULL;
@@ -73,7 +73,7 @@ lv_res_t lv_obj_send_event(lv_obj_t * obj, lv_event_code_t event_code, void * pa
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;
+ if(class_p == NULL) base = ((lv_obj_t *)e->current_target)->class_p;
else base = class_p->base_class;
/*Find a base in which call the ancestor's event handler_cb if set*/
@@ -124,14 +124,14 @@ bool lv_obj_remove_event(lv_obj_t * obj, uint32_t index)
return lv_event_remove(&obj->spec_attr->event_list, index);
}
-lv_obj_t * lv_event_get_target_obj(lv_event_t * e)
+lv_obj_t * lv_event_get_current_target_obj(lv_event_t * e)
{
- return lv_event_get_target(e);
+ return lv_event_get_current_target(e);
}
-lv_obj_t * lv_event_get_original_target_obj(lv_event_t * e)
+lv_obj_t * lv_event_get_target_obj(lv_event_t * e)
{
- return lv_event_get_original_target(e);
+ return lv_event_get_target(e);
}
@@ -297,7 +297,7 @@ static lv_res_t event_send_core(lv_event_t * e)
if(e->deleted) return LV_RES_INV;
}
- lv_obj_t * target = e->target;
+ lv_obj_t * target = e->current_target;
lv_res_t res = LV_RES_OK;
lv_event_list_t * list = target->spec_attr ? &target->spec_attr->event_list : NULL;
@@ -310,9 +310,9 @@ static lv_res_t event_send_core(lv_event_t * e)
res = lv_event_send(list, e, false);
if(res != LV_RES_OK) return res;
- lv_obj_t * parent = lv_obj_get_parent(e->target);
+ lv_obj_t * parent = lv_obj_get_parent(e->current_target);
if(parent && event_is_bubbled(e)) {
- e->target = parent;
+ e->current_target = parent;
res = event_send_core(e);
if(res != LV_RES_OK) return res;
}
@@ -335,7 +335,7 @@ static bool event_is_bubbled(lv_event_t * e)
}
/*Check other codes only if bubbling is enabled*/
- if(lv_obj_has_flag(e->target, LV_OBJ_FLAG_EVENT_BUBBLE) == false) return false;
+ if(lv_obj_has_flag(e->current_target, LV_OBJ_FLAG_EVENT_BUBBLE) == false) return false;
switch(e->code) {
case LV_EVENT_HIT_TEST:
diff --git a/src/misc/lv_event.c b/src/misc/lv_event.c
index ed2614fa7..f96148d08 100644
--- a/src/misc/lv_event.c
+++ b/src/misc/lv_event.c
@@ -141,12 +141,12 @@ bool lv_event_remove(lv_event_list_t * list, uint32_t index)
return true;
}
-void * lv_event_get_target(lv_event_t * e)
+void * lv_event_get_current_target(lv_event_t * e)
{
- return e->target;
+ return e->current_target;
}
-void * lv_event_get_original_target(lv_event_t * e)
+void * lv_event_get_target(lv_event_t * e)
{
return e->original_target;
}
@@ -188,7 +188,7 @@ void _lv_event_mark_deleted(void * target)
lv_event_t * e = event_head;
while(e) {
- if(e->original_target == target || e->target == target) e->deleted = 1;
+ if(e->original_target == target || e->current_target == target) e->deleted = 1;
e = e->prev;
}
}
diff --git a/src/misc/lv_event.h b/src/misc/lv_event.h
index 52e8d0f9a..5deeb7496 100644
--- a/src/misc/lv_event.h
+++ b/src/misc/lv_event.h
@@ -114,7 +114,7 @@ typedef struct {
} lv_event_list_t;
typedef struct _lv_event_t {
- void * target;
+ void * current_target;
void * original_target;
lv_event_code_t code;
void * user_data;
@@ -167,7 +167,7 @@ void * lv_event_get_target(lv_event_t * e);
* @param e pointer to the event descriptor
* @return pointer to the current target of the event_code
*/
-void * lv_event_get_original_target(lv_event_t * e);
+void * lv_event_get_current_target(lv_event_t * e);
/**
* Get the event code of an event
diff --git a/src/others/gridnav/lv_gridnav.c b/src/others/gridnav/lv_gridnav.c
index 211e0760a..226370331 100644
--- a/src/others/gridnav/lv_gridnav.c
+++ b/src/others/gridnav/lv_gridnav.c
@@ -132,7 +132,7 @@ void lv_gridnav_set_focused(lv_obj_t * cont, lv_obj_t * to_focus, lv_anim_enable
static void gridnav_event_cb(lv_event_t * e)
{
- lv_obj_t * obj = lv_event_get_original_target(e);
+ lv_obj_t * obj = lv_event_get_target(e);
lv_gridnav_dsc_t * dsc = lv_event_get_user_data(e);
lv_event_code_t code = lv_event_get_code(e);