This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch efl
in repository laugh.
View the commit online.
commit 7facf4853f40281111e8a1ef2ecdd59bc296e93d
Author: melerva <[email protected]>
AuthorDate: Sat Sep 20 20:06:58 2025 -0400
Starting on the UI finally
Premature optimization might kill me
---
meson.build | 1 +
src/modules/laugh_ui.c | 42 ++++++++++++++++++++++++++++++++++++++++++
src/packages.c | 1 +
3 files changed, 44 insertions(+)
diff --git a/meson.build b/meson.build
index d92448b..5141e31 100644
--- a/meson.build
+++ b/meson.build
@@ -30,6 +30,7 @@ conf.set('LAUGH_USE_EFL_UI', efl_ui_dep.found())
laugh_sources = [
'src/main.c',
'src/modules/laugh.c',
+ 'src/modules/laugh_ui.c',
'src/packages.c',
'src/require.c',
]
diff --git a/src/modules/laugh_ui.c b/src/modules/laugh_ui.c
new file mode 100644
index 0000000..884ff7c
--- /dev/null
+++ b/src/modules/laugh_ui.c
@@ -0,0 +1,42 @@
+#include "config.h"
+
+#include <lauxlib.h>
+#include <lua.h>
+#include <lualib.h>
+
+/* Wrap in ifdefs to avoid compiling in code that'll never be used. */
+
+#ifdef LAUGH_USE_EFL_UI
+# include <Efl_Ui.h>
+
+static int laugh_ui_new(lua_State *const L) {
+ aux_lines(L, 0);
+ return 1;
+}
+
+static const luaL_Reg laugh_ui_efl_lib[] = {
+ {"new", laugh_ui_new},
+ {NULL, NULL},
+};
+#endif // LAUGH_USE_EFL_UI
+
+int luaopen_laugh_ui(lua_State *const L) {
+ /* TODO: detect which backend(s) will work, pick one.
+ * For example, check for graphics and use Qt/EFL,
+ * use ncurses if no graphics.
+ * Check an environment variable or lua global variable
+ * for chosen backend before autodetecting. */
+
+ /* bonus TODO: laugh.ui is generic and abstracted.
+ * expose laugh.ui.$backend for advanced usage later.
+ * Actually, laugh.ui should be written directly in lua
+ * and have those functions call the more advanced things. */
+#ifdef LAUGH_USE_EFL_UI
+ luaL_newlib(L, laugh_ui_efl_lib);
+ lua_pushstring(L, "efl");
+ lua_setfield(L, -2, backend);
+#else
+ lua_pushnil();
+#endif
+ return 1;
+}
diff --git a/src/packages.c b/src/packages.c
index f9ed23e..06e9dbd 100644
--- a/src/packages.c
+++ b/src/packages.c
@@ -17,6 +17,7 @@ void init_preloaders(lua_State *const L) {
lua_getfield(L, -1, "preload");
REGISTER_LOADER("laugh", luaopen_laugh);
+ REGISTER_LOADER("laugh.ui", luaopen_laugh_ui);
#ifdef LAUGH_MOD_PACKAGEGC
REGISTER_LOADER("mod_packagegc", luaopen_mod_packagegc);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.