mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
refactor(ui): ui_log() can now just be a function
This commit is contained in:
parent
c1514d7e67
commit
6942528a54
@ -120,7 +120,6 @@ for i = 1, #events do
|
|||||||
if ev.remote_only then
|
if ev.remote_only then
|
||||||
call_output:write(' Array args = call_buf;\n')
|
call_output:write(' Array args = call_buf;\n')
|
||||||
write_arglist(call_output, ev)
|
write_arglist(call_output, ev)
|
||||||
call_output:write(' UI_LOG('..ev.name..');\n')
|
|
||||||
call_output:write(' ui_call_event("'..ev.name..'", args);\n')
|
call_output:write(' ui_call_event("'..ev.name..'", args);\n')
|
||||||
elseif ev.compositor_impl then
|
elseif ev.compositor_impl then
|
||||||
call_output:write(' ui_comp_'..ev.name)
|
call_output:write(' ui_comp_'..ev.name)
|
||||||
|
@ -64,31 +64,31 @@ static int pending_has_mouse = -1;
|
|||||||
static Array call_buf = ARRAY_DICT_INIT;
|
static Array call_buf = ARRAY_DICT_INIT;
|
||||||
|
|
||||||
#if MIN_LOG_LEVEL > LOGLVL_DBG
|
#if MIN_LOG_LEVEL > LOGLVL_DBG
|
||||||
# define UI_LOG(funname)
|
# define ui_log(funname)
|
||||||
#else
|
#else
|
||||||
static size_t uilog_seen = 0;
|
static size_t uilog_seen = 0;
|
||||||
static char uilog_last_event[1024] = { 0 };
|
static const char *uilog_last_event = NULL;
|
||||||
|
|
||||||
|
static void ui_log(const char *funname)
|
||||||
|
{
|
||||||
# ifndef EXITFREE
|
# ifndef EXITFREE
|
||||||
# define entered_free_all_mem false
|
if (entered_free_all_mem) {
|
||||||
|
return; // do nothing, we cannot log now
|
||||||
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# define UI_LOG(funname) \
|
if (uilog_last_event == funname) {
|
||||||
do { \
|
uilog_seen++;
|
||||||
if (entered_free_all_mem) { \
|
} else {
|
||||||
/* do nothing, we cannot log now */ \
|
if (uilog_seen > 0) {
|
||||||
} else if (strequal(uilog_last_event, STR(funname))) { \
|
logmsg(LOGLVL_DBG, "UI: ", NULL, -1, true,
|
||||||
uilog_seen++; \
|
"%s (+%zu times...)", uilog_last_event, uilog_seen);
|
||||||
} else { \
|
}
|
||||||
if (uilog_seen > 0) { \
|
logmsg(LOGLVL_DBG, "UI: ", NULL, -1, true, "%s", funname);
|
||||||
logmsg(LOGLVL_DBG, "UI: ", NULL, -1, true, \
|
uilog_seen = 0;
|
||||||
"%s (+%zu times...)", uilog_last_event, uilog_seen); \
|
uilog_last_event = funname;
|
||||||
} \
|
}
|
||||||
logmsg(LOGLVL_DBG, "UI: ", NULL, -1, true, STR(funname)); \
|
}
|
||||||
uilog_seen = 0; \
|
|
||||||
xstrlcpy(uilog_last_event, STR(funname), sizeof(uilog_last_event)); \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// UI_CALL invokes a function on all registered UI instances.
|
// UI_CALL invokes a function on all registered UI instances.
|
||||||
@ -105,7 +105,7 @@ static char uilog_last_event[1024] = { 0 };
|
|||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
if (any_call) { \
|
if (any_call) { \
|
||||||
UI_LOG(funname); \
|
ui_log(STR(funname)); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -654,6 +654,8 @@ void ui_call_event(char *name, Array args)
|
|||||||
if (!handled) {
|
if (!handled) {
|
||||||
UI_CALL(true, event, ui, name, args);
|
UI_CALL(true, event, ui, name, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui_log(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ui_cb_update_ext(void)
|
void ui_cb_update_ext(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user