aboutsummaryrefslogtreecommitdiff
path: root/vis-lua.c
diff options
context:
space:
mode:
authorRudy Dellomas III <dther@dther.xyz>2024-04-21 20:25:40 +1000
committerRandy Palamar <randy@rnpnr.xyz>2024-04-29 08:36:44 -0600
commit596ec20dd81fc4a48a528bfed9e241343ee03eaa (patch)
tree9ece9e4212b1d770b33f8fd8317ff13d079f91eb /vis-lua.c
parent62ccfe59ae63858dc5c21039e907a9277134d171 (diff)
downloadvis-596ec20dd81fc4a48a528bfed9e241343ee03eaa.tar.gz
vis-596ec20dd81fc4a48a528bfed9e241343ee03eaa.tar.xz
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.
Diffstat (limited to 'vis-lua.c')
-rw-r--r--vis-lua.c14
1 files changed, 13 insertions, 1 deletions
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