From 07b8e9d8a293d63fd9c1059968b53ad396e9f013 Mon Sep 17 00:00:00 2001 From: Randy Palamar Date: Sat, 11 May 2024 10:38:28 -0600 Subject: cleanup vis event interface This removes the function pointer interface which was adding needless complexity and making it difficult to add new events. Now if new events are only meant for lua they only need to be added to the lua interface. This will also have a minor reduction in runtime memory usage and produce a smaller binary. The only runtime difference is that QUIT happens after all windows have been closed and their files freed. --- event-basic.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 event-basic.c (limited to 'event-basic.c') diff --git a/event-basic.c b/event-basic.c new file mode 100644 index 0000000..6d298b5 --- /dev/null +++ b/event-basic.c @@ -0,0 +1,23 @@ +#include + +#include "vis-core.h" + +#if !CONFIG_LUA +bool vis_event_emit(Vis *vis, enum VisEvents id, ...) { + if (!vis->initialized) { + vis->initialized = true; + vis->ui->init(vis->ui, vis); + } + + va_list ap; + va_start(ap, id); + + if (id == VIS_EVENT_WIN_STATUS) { + Win *win = va_arg(ap, Win*); + window_status_update(vis, win); + } + + va_end(ap); + return true; +} +#endif -- cgit v1.2.3