mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-22 23:37:43 +08:00
fix(event): remove preprocess flag when get name (#7468)
This commit is contained in:
@@ -86,9 +86,9 @@ lv_result_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
|
||||
/*Call the actual event callback*/
|
||||
e->user_data = NULL;
|
||||
LV_PROFILER_EVENT_BEGIN_TAG(lv_event_get_code_name(e->code));
|
||||
LV_PROFILER_EVENT_BEGIN_TAG(lv_event_code_get_name(e->code));
|
||||
base->event_cb(base, e);
|
||||
LV_PROFILER_EVENT_END_TAG(lv_event_get_code_name(e->code));
|
||||
LV_PROFILER_EVENT_END_TAG(lv_event_code_get_name(e->code));
|
||||
|
||||
lv_result_t res = LV_RESULT_OK;
|
||||
/*Stop if the object is deleted*/
|
||||
|
||||
+20
-3
@@ -250,16 +250,24 @@ void lv_event_mark_deleted(void * target)
|
||||
}
|
||||
}
|
||||
|
||||
const char * lv_event_get_code_name(lv_event_code_t code)
|
||||
const char * lv_event_code_get_name(lv_event_code_t code)
|
||||
{
|
||||
/*Remove the preprocess flag*/
|
||||
code &= ~LV_EVENT_PREPROCESS;
|
||||
|
||||
#define ENUM_CASE(x) case LV_##x: return #x
|
||||
|
||||
switch(code) {
|
||||
ENUM_CASE(EVENT_ALL);
|
||||
|
||||
/** Input device events*/
|
||||
ENUM_CASE(EVENT_PRESSED);
|
||||
ENUM_CASE(EVENT_PRESSING);
|
||||
ENUM_CASE(EVENT_PRESS_LOST);
|
||||
ENUM_CASE(EVENT_SHORT_CLICKED);
|
||||
ENUM_CASE(EVENT_SINGLE_CLICKED);
|
||||
ENUM_CASE(EVENT_DOUBLE_CLICKED);
|
||||
ENUM_CASE(EVENT_TRIPLE_CLICKED);
|
||||
ENUM_CASE(EVENT_LONG_PRESSED);
|
||||
ENUM_CASE(EVENT_LONG_PRESSED_REPEAT);
|
||||
ENUM_CASE(EVENT_CLICKED);
|
||||
@@ -276,6 +284,8 @@ const char * lv_event_get_code_name(lv_event_code_t code)
|
||||
ENUM_CASE(EVENT_LEAVE);
|
||||
ENUM_CASE(EVENT_HIT_TEST);
|
||||
ENUM_CASE(EVENT_INDEV_RESET);
|
||||
ENUM_CASE(EVENT_HOVER_OVER);
|
||||
ENUM_CASE(EVENT_HOVER_LEAVE);
|
||||
|
||||
/** Drawing events*/
|
||||
ENUM_CASE(EVENT_COVER_CHECK);
|
||||
@@ -326,11 +336,18 @@ const char * lv_event_get_code_name(lv_event_code_t code)
|
||||
|
||||
ENUM_CASE(EVENT_VSYNC);
|
||||
|
||||
default:
|
||||
/* Special event flags */
|
||||
case LV_EVENT_LAST:
|
||||
case LV_EVENT_PREPROCESS:
|
||||
case LV_EVENT_MARKED_DELETING:
|
||||
break;
|
||||
|
||||
/* Note that default is not added here because when adding new event code,
|
||||
* if forget to add case, the compiler will automatically report a warning.
|
||||
*/
|
||||
}
|
||||
|
||||
#undef EVENT_ENUM_CASE
|
||||
#undef ENUM_CASE
|
||||
|
||||
return "EVENT_UNKNOWN";
|
||||
}
|
||||
|
||||
+1
-1
@@ -218,7 +218,7 @@ uint32_t lv_event_register_id(void);
|
||||
* @param code the event code
|
||||
* @return the name of the event code as a string
|
||||
*/
|
||||
const char * lv_event_get_code_name(lv_event_code_t code);
|
||||
const char * lv_event_code_get_name(lv_event_code_t code);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
Reference in New Issue
Block a user