From 596ec20dd81fc4a48a528bfed9e241343ee03eaa Mon Sep 17 00:00:00 2001 From: Rudy Dellomas III Date: Sun, 21 Apr 2024 20:25:40 +1000 Subject: Emit an event (ui_draw) immediately before drawing the screen This allows better control over styling, as well as potential for entirely new UI elements implemented entirely using the Lua API. --- vis-lua.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'vis-lua.c') diff --git a/vis-lua.c b/vis-lua.c index 3d80293..91ee428 100644 --- a/vis-lua.c +++ b/vis-lua.c @@ -166,7 +166,7 @@ void vis_lua_win_status(Vis *vis, Win *win) { window_status_update(vis, win); } void vis_lua_term_csi(Vis *vis, const long *csi) { } void vis_lua_process_response(Vis *vis, const char *name, char *buffer, size_t len, ResponseType rtype) { } - +void vis_lua_ui_draw(Vis *vis) { } #else @@ -3689,4 +3689,16 @@ void vis_lua_process_response(Vis *vis, const char *name, lua_pop(L, 1); } +/*** + * Emitted immediately before the UI is drawn to the screen. + * Allows last-minute overrides to the styling of UI elements. + * + * *WARNING:* This is emitted every screen draw! + * Use sparingly and check for `nil` values! + * @function ui_draw + */ +void vis_lua_ui_draw(Vis *vis) { + vis_lua_event_call(vis, "ui_draw"); +} + #endif -- cgit v1.2.3