summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2024-12-24 15:04:18 -0500
committerAndrew Opalach <andrew@akon.city> 2024-12-24 16:56:02 -0500
commit473a3f42333d03a1d5c4abcbbd4d3f86b81ba1f3 (patch)
treebaea7f4cc4d28064d27023affdea99439d948db9
parent37a45ee3ae3a7b6b1754a5199ca1750529b09575 (diff)
downloadmauri-473a3f42333d03a1d5c4abcbbd4d3f86b81ba1f3.tar.gz
mauri-473a3f42333d03a1d5c4abcbbd4d3f86b81ba1f3.tar.bz2
mauri-473a3f42333d03a1d5c4abcbbd4d3f86b81ba1f3.zip
Update for dependency name change
Signed-off-by: Andrew Opalach <andrew@akon.city>
-rw-r--r--.gitignore6
-rw-r--r--flake.lock6
-rw-r--r--flake.nix14
-rw-r--r--meson.build6
-rw-r--r--src/context.h6
-rw-r--r--src/gl.cc2
-rw-r--r--src/mauri.cc8
-rw-r--r--src/objects/pass.cc2
-rw-r--r--src/util.h2
-rw-r--r--subprojects/libakiyo.wrap4
-rw-r--r--subprojects/libalabaster.wrap2
-rw-r--r--subprojects/libnaunet.wrap4
-rw-r--r--subprojects/stela.wrap2
-rw-r--r--taro/config.h12
-rw-r--r--taro/daemon.c131
-rw-r--r--taro/db.c26
-rw-r--r--taro/file_ext.c28
-rw-r--r--taro/file_ext.h10
-rw-r--r--taro/meson.build6
-rw-r--r--taro/tests/meson.build1
-rw-r--r--taro/tests/notcurses_ffmpeg.c6
-rw-r--r--taro/ui.c44
22 files changed, 164 insertions, 164 deletions
diff --git a/.gitignore b/.gitignore
index 3f4dd15..6fab9ba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,13 +9,15 @@ subprojects/glm/
subprojects/jansson.wrap
subprojects/janus/
subprojects/json/
-subprojects/libakiyo
-subprojects/libakiyo/
subprojects/libalabaster
subprojects/libalabaster/
+subprojects/libev-4.33/
subprojects/libev.wrap
+subprojects/libnaunet
+subprojects/libnaunet/
subprojects/lz4/
subprojects/notcurses/
+subprojects/packagecache/
subprojects/s3tc-dxt-decompression/
subprojects/stb/
subprojects/stela
diff --git a/flake.lock b/flake.lock
index b66bfef..ae3a73f 100644
--- a/flake.lock
+++ b/flake.lock
@@ -19,11 +19,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1732014248,
- "narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=",
+ "lastModified": 1734649271,
+ "narHash": "sha256-4EVBRhOjMDuGtMaofAIqzJbg4Ql7Ai0PSeuVZTHjyKQ=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "23e89b7da85c3640bbc2173fe04f4bd114342367",
+ "rev": "d70bd19e0a38ad4790d3913bf08fcbfc9eeca507",
"type": "github"
},
"original": {
diff --git a/flake.nix b/flake.nix
index a80c0dc..a41a1f8 100644
--- a/flake.nix
+++ b/flake.nix
@@ -29,12 +29,12 @@
cd "$out"
${lib.getExe meson} subprojects download \
- libalabaster libakiyo stela janus stb s3tc-dxt-decompression notcurses
+ libalabaster libnaunet stela janus stb s3tc-dxt-decompression notcurses
cd "$out/subprojects/libalabaster"
${lib.getExe meson} subprojects download c89atomic
- cd "$out/subprojects/libakiyo"
+ cd "$out/subprojects/libnaunet"
${lib.getExe meson} subprojects download libev
cd "$out"
@@ -127,12 +127,10 @@
};
mingw64 = with pkgs; let
- gcc = pkgsCross.ucrt64.buildPackages.wrapCC (pkgsCross.ucrt64.buildPackages.gcc-unwrapped.override ({
- threadsCross = {
- model = "win32";
- package = null;
- };
- }));
+ gcc = pkgsCross.ucrt64.buildPackages.wrapCC
+ (pkgsCross.ucrt64.buildPackages.gcc-unwrapped.override ({
+ threadsCross = { model = "win32"; package = null; };
+ }));
gccWin32Stdenv = overrideCC pkgsCross.ucrt64.stdenv gcc;
in mkShell.override { stdenv = gccWin32Stdenv; } {
NIX_HARDENING_ENABLE = "";
diff --git a/meson.build b/meson.build
index 458037c..7d13da0 100644
--- a/meson.build
+++ b/meson.build
@@ -9,11 +9,11 @@ is_windows = host_machine.system() == 'windows'
alabaster = subproject('libalabaster').get_variable('alabaster')
-akiyo = subproject('libakiyo', default_options: [
+naunet = subproject('libnaunet', default_options: [
get_option('taro').enabled() ? 'event-loop=enabled' : 'event-loop=disabled',
'curl=disabled',
'json=enabled'
-]).get_variable('akiyo')
+]).get_variable('naunet')
stela = subproject('stela', default_options: [
'api=opengl',
@@ -44,7 +44,7 @@ if not json.found()
json = subproject('json').get_variable('nlohmann_json_dep')
endif
-mauri_deps = [alabaster, akiyo, stela, janus, stb, s3tc, lz4, glm, json]
+mauri_deps = [alabaster, naunet, stela, janus, stb, s3tc, lz4, glm, json]
mauri_src = [
'src/mauri.cc',
'src/assets.cc',
diff --git a/src/context.h b/src/context.h
index 5dfcc8b..a64dde7 100644
--- a/src/context.h
+++ b/src/context.h
@@ -4,7 +4,7 @@
extern "C" {
#include <stl/window.h>
#include <stl/gl.h>
-#include <aki/thread.h>
+#include <nnwt/thread.h>
}
#include "gl.h"
@@ -18,7 +18,7 @@ static void should_close_callback(void *userdata);
class Context
{
public:
- Context() : start(aki_get_timestamp()) {}
+ Context() : start(nn_get_timestamp()) {}
~Context()
{
if (this->window) this->window->free(&this->window);
@@ -96,7 +96,7 @@ class Context
auto current_time() const -> f64
{
- return (aki_get_timestamp() - this->start) / 1000000.f;
+ return (nn_get_timestamp() - this->start) / 1000000.f;
}
auto check_error() -> void
diff --git a/src/gl.cc b/src/gl.cc
index 96f00e9..d753142 100644
--- a/src/gl.cc
+++ b/src/gl.cc
@@ -400,7 +400,7 @@ auto RenderTexture::save_pixels(const void *ptr, s32 width, s32 height, bool dxt
{
for (s32 i = 0; i < width * height; i++)
{
- this->pixels[i] = aki_htonl(((u32 *)ptr)[i]);
+ this->pixels[i] = nn_htonl(((u32 *)ptr)[i]);
}
return;
}
diff --git a/src/mauri.cc b/src/mauri.cc
index 077b060..e562a76 100644
--- a/src/mauri.cc
+++ b/src/mauri.cc
@@ -1,5 +1,5 @@
extern "C" {
-#include <aki/common.h>
+#include <nnwt/common.h>
#include <stl/window.h>
}
@@ -29,7 +29,7 @@ auto main(s32 argc, char *argv[]) -> s32
auto wmain(s32 argc, wchar_t **argv) -> s32
#endif
{
- if (!aki_common_init()) return EXIT_FAILURE;
+ if (!nn_common_init()) return EXIT_FAILURE;
janus::ArgParser args(HELP_TEXT, "0.13");
@@ -109,11 +109,11 @@ auto wmain(s32 argc, wchar_t **argv) -> s32
Engine *engine = new Engine(scene, 1.f, true);
- u64 begin = aki_get_timestamp();
+ u64 begin = nn_get_timestamp();
scene->load(engine);
- u64 duration = aki_get_timestamp() - begin;
+ u64 duration = nn_get_timestamp() - begin;
info("scene loaded in %.2fs", duration / 1000000.f);
if (asset_manager()->prepare_output) asset_manager()->dump(args.getString("target"));
diff --git a/src/objects/pass.cc b/src/objects/pass.cc
index 4d2fd0f..0ed32ae 100644
--- a/src/objects/pass.cc
+++ b/src/objects/pass.cc
@@ -347,7 +347,7 @@ auto RenderPass::draw(Engine *engine) -> void
#ifdef FRAME_STEP
adjusted_target->buffer->blit(0, context()->width(), context()->height());
context()->swap_buffers();
- aki_thread_sleep(AKI_TS_FROM_USEC(1000000));
+ nn_thread_sleep(NNWT_TS_FROM_USEC(1000000));
#endif
break;
}
diff --git a/src/util.h b/src/util.h
index 42c94a6..db954c0 100644
--- a/src/util.h
+++ b/src/util.h
@@ -3,7 +3,7 @@
extern "C" {
#include <al/types.h>
-#include <aki/socket.h>
+#include <nnwt/socket.h>
}
#include "log.h"
diff --git a/subprojects/libakiyo.wrap b/subprojects/libakiyo.wrap
deleted file mode 100644
index 002abff..0000000
--- a/subprojects/libakiyo.wrap
+++ /dev/null
@@ -1,4 +0,0 @@
-[wrap-git]
-url = https://git.akon.city/libakiyo
-revision = 62b75446102ca32b23a78188b0aca8fe31d8b2c0
-depth = 1
diff --git a/subprojects/libalabaster.wrap b/subprojects/libalabaster.wrap
index 3c1d0b1..49f70eb 100644
--- a/subprojects/libalabaster.wrap
+++ b/subprojects/libalabaster.wrap
@@ -1,4 +1,4 @@
[wrap-git]
url = https://git.akon.city/libalabaster
-revision = 27cbe448f08a783196e49aa58d9af57240a20d43
+revision = bb4d5418f2173bf9a2fa1c0be31c3eb9f2025a21
depth = 1
diff --git a/subprojects/libnaunet.wrap b/subprojects/libnaunet.wrap
new file mode 100644
index 0000000..6db8ca9
--- /dev/null
+++ b/subprojects/libnaunet.wrap
@@ -0,0 +1,4 @@
+[wrap-git]
+url = https://git.akon.city/libnaunet
+revision = 822e754cafdc5a32c80c97ca015cd6f9008329c3
+depth = 1
diff --git a/subprojects/stela.wrap b/subprojects/stela.wrap
index 6a95860..a44296c 100644
--- a/subprojects/stela.wrap
+++ b/subprojects/stela.wrap
@@ -1,4 +1,4 @@
[wrap-git]
url = https://git.akon.city/stela
-revision = 5c0e9eb465c5c291b0d2658ad01f15e050042df1
+revision = 6fe15ce0d41bd55331cac006134b61c1704775c3
depth = 1
diff --git a/taro/config.h b/taro/config.h
index a8fffd1..0357d70 100644
--- a/taro/config.h
+++ b/taro/config.h
@@ -80,26 +80,26 @@ static bool open_config(struct config *conf, bool create)
al_str_from(&conf->config_dir, envhome);
al_str_cat(&conf->config_dir, al_str_c(CONFIG_PATH));
- if (!aki_dir_exists(&conf->config_dir)) {
- if (!create || !aki_dir_create(&conf->config_dir)) {
+ if (!nn_dir_exists(&conf->config_dir)) {
+ if (!create || !nn_dir_create(&conf->config_dir)) {
goto err;
}
}
al_str_clone(&conf->config_path, &conf->config_dir);
al_str_cat(&conf->config_path, al_str_c("/config.json"));
- if (!aki_file_exists(&conf->config_path)) {
- if (aki_file_create(&conf->config_path)) {
+ if (!nn_file_exists(&conf->config_path)) {
+ if (nn_file_create(&conf->config_path)) {
json_t *blank = json_object();
json_t *directories = json_object();
json_object_set_new(directories, "assets", json_string_nocheck(""));
json_object_set_new(directories, "wallpapers", json_string_nocheck(""));
json_object_set_new(blank, "directories", directories);
- aki_dump_json_and_decref(&conf->config_path, blank);
+ nn_dump_json_and_decref(&conf->config_path, blank);
}
}
- json_t *root = aki_file_open_as_json(&conf->config_path);
+ json_t *root = nn_file_open_as_json(&conf->config_path);
if (!root) goto err;
parse_config_json(conf, envhome, root);
diff --git a/taro/daemon.c b/taro/daemon.c
index 3eec7e1..6641b0b 100644
--- a/taro/daemon.c
+++ b/taro/daemon.c
@@ -3,11 +3,11 @@
#include <al/array.h>
#include <al/log.h>
#include <al/str.h>
-#include <aki/common.h>
-#include <aki/event_loop.h>
-#include <aki/signal.h>
-#include <aki/fs_event.h>
-#include <aki/socket.h>
+#include <nnwt/common.h>
+#include <nnwt/event_loop.h>
+#include <nnwt/signal.h>
+#include <nnwt/fs_event.h>
+#include <nnwt/socket.h>
#include <stl/window.h>
#include <jansson.h>
@@ -18,7 +18,7 @@ struct monitor {
struct stl_monitor *os;
str config_dir;
str selection_path;
- struct aki_fs_event selection_event;
+ struct nn_fs_event selection_event;
bool self_event_skip;
pid_t pid;
bool paused;
@@ -30,15 +30,15 @@ struct monitor {
#define SWAY_IPC_SUBSCRIBE 2
struct daemon {
- struct aki_event_loop loop;
- struct aki_signal quit_signal;
+ struct nn_event_loop loop;
+ struct nn_signal quit_signal;
s32 context_poll_fd;
- struct aki_poll context_poll;
+ struct nn_poll context_poll;
array(struct monitor *) monitors;
- struct aki_socket ipc_socket;
+ struct nn_socket ipc_socket;
bool ipc_connected;
bool ipc_errored;
- struct aki_poll ipc_poll;
+ struct nn_poll ipc_poll;
struct {
u8 *buf;
ssize_t index;
@@ -51,7 +51,7 @@ struct daemon {
ssize_t alloc;
} ipc;
struct config conf;
- struct aki_fs_event conf_event;
+ struct nn_fs_event conf_event;
};
static s32 parse_and_set_props(str *selection, str *wallpaper_path, bool *is_package)
@@ -85,7 +85,7 @@ static s32 parse_and_set_props(str *selection, str *wallpaper_path, bool *is_pac
static bool send_signal_to_pid(pid_t pid, s32 signal)
{
if (kill(pid, signal) != 0) {
- al_log_error("tarod", "kill(%d) failed (%s)", pid, aki_strerror(errno));
+ al_log_error("tarod", "kill(%d) failed (%s)", pid, nn_strerror(errno));
return false;
}
return true;
@@ -142,7 +142,7 @@ static bool run_wallpaper(struct daemon *dmon, struct monitor *monitor)
str selection;
monitor->self_event_skip = true;
- if (!aki_file_open_and_read_wholly(&monitor->selection_path, &selection, true)) {
+ if (!nn_file_open_and_read_wholly(&monitor->selection_path, &selection, true)) {
monitor->self_event_skip = false;
return false;
}
@@ -171,7 +171,7 @@ static bool run_wallpaper(struct daemon *dmon, struct monitor *monitor)
al_str_cat(&wallpaper_path, al_str_c("/scene.pkg"));
}
- if ((is_package && !aki_file_exists(&wallpaper_path)) || (!is_package && !aki_dir_exists(&wallpaper_path))) {
+ if ((is_package && !nn_file_exists(&wallpaper_path)) || (!is_package && !nn_dir_exists(&wallpaper_path))) {
al_log_error("tarod", "wallpaper doesn't exist at %.*s", AL_STR_PRINTF(&wallpaper_path));
al_str_free(&wallpaper_path);
return false;
@@ -234,8 +234,8 @@ static void output_discovered_callback(void *userdata, struct stl_monitor *os_mo
al_str_cat(&monitor_dir, al_str_c("/"));
al_str_cat(&monitor_dir, al_str_cr(os_monitor->name));
- if (!aki_dir_exists(&monitor_dir)) {
- if (!aki_dir_create(&monitor_dir)) return;
+ if (!nn_dir_exists(&monitor_dir)) {
+ if (!nn_dir_create(&monitor_dir)) return;
}
monitor = al_alloc_object(struct monitor);
@@ -249,9 +249,9 @@ static void output_discovered_callback(void *userdata, struct stl_monitor *os_mo
al_str_clone(&monitor->selection_path, &monitor->config_dir);
al_str_cat(&monitor->selection_path, al_str_c("/selection"));
- if (!aki_file_exists(&monitor->selection_path)) {
- aki_file_create(&monitor->selection_path);
- aki_file_open_and_replace(&monitor->selection_path, al_str_c("||"), false);
+ if (!nn_file_exists(&monitor->selection_path)) {
+ nn_file_create(&monitor->selection_path);
+ nn_file_open_and_replace(&monitor->selection_path, al_str_c("||"), false);
}
monitor->pid = -1;
@@ -261,9 +261,9 @@ static void output_discovered_callback(void *userdata, struct stl_monitor *os_mo
run_wallpaper(dmon, monitor);
monitor->self_event_skip = false;
- aki_fs_event_init(&monitor->selection_event, &monitor->selection_path,
- AKI_CLOSE_WRITE, selection_fs_event_callback, monitor);
- aki_fs_event_start(&monitor->selection_event, &monitor->dmon->loop);
+ nn_fs_event_init(&monitor->selection_event, &monitor->selection_path,
+ NNWT_CLOSE_WRITE, selection_fs_event_callback, monitor);
+ nn_fs_event_start(&monitor->selection_event, &monitor->dmon->loop);
}
// https://vi.stackexchange.com/questions/25030/vim-not-firing-inotify-events-when-writing-file
@@ -286,7 +286,7 @@ static void close_monitor(struct monitor *monitor)
{
al_str_free(&monitor->config_dir);
al_str_free(&monitor->selection_path);
- aki_fs_event_free(&monitor->selection_event);
+ nn_fs_event_free(&monitor->selection_event);
}
static void ipc_handle_subscribe_success(json_t *root)
@@ -348,32 +348,32 @@ static void ipc_poll_callback(void *userdata, s32 revents)
{
struct daemon *dmon = (struct daemon *)userdata;
- if (revents & AKI_POLL_WRITE) {
+ if (revents & NNWT_POLL_WRITE) {
al_assert(!dmon->ipc_connected);
if (!dmon->ipc_connected) {
al_log_info("tarod", "connected to sway ipc socket");
dmon->ipc_connected = true;
}
- ssize_t ret = aki_socket_write(&dmon->ipc_socket,
+ ssize_t ret = nn_socket_write(&dmon->ipc_socket,
dmon->out.buf + dmon->out.index, dmon->out.size - dmon->out.index);
if (ret <= 0) {
- aki_signal_send(&dmon->quit_signal);
+ nn_signal_send(&dmon->quit_signal);
return;
}
dmon->out.index += ret;
if (dmon->out.index == dmon->out.size) {
- aki_poll_stop(&dmon->ipc_poll);
- aki_poll_set(&dmon->ipc_poll, aki_socket_get_fd(&dmon->ipc_socket), AKI_POLL_READ);
- aki_poll_start(&dmon->ipc_poll, &dmon->loop);
+ nn_poll_stop(&dmon->ipc_poll);
+ nn_poll_set(&dmon->ipc_poll, nn_socket_get_fd(&dmon->ipc_socket), NNWT_POLL_READ);
+ nn_poll_start(&dmon->ipc_poll, &dmon->loop);
}
}
- if (revents & AKI_POLL_READ) {
+ if (revents & NNWT_POLL_READ) {
if (dmon->ipc.index < SWAY_IPC_HEADER_LENGTH) {
- ssize_t ret = aki_socket_read(&dmon->ipc_socket,
+ ssize_t ret = nn_socket_read(&dmon->ipc_socket,
dmon->ipc.buf + dmon->ipc.index, SWAY_IPC_HEADER_LENGTH - dmon->ipc.index);
if (ret <= 0) {
- aki_signal_send(&dmon->quit_signal);
+ nn_signal_send(&dmon->quit_signal);
return;
}
dmon->ipc.index += ret;
@@ -383,10 +383,10 @@ static void ipc_poll_callback(void *userdata, s32 revents)
ensure_ipc_buf_size(dmon, dmon->ipc.size);
}
if (dmon->ipc.size) {
- ssize_t ret = aki_socket_read(&dmon->ipc_socket,
+ ssize_t ret = nn_socket_read(&dmon->ipc_socket,
dmon->ipc.buf + dmon->ipc.index, dmon->ipc.size - dmon->ipc.index);
if (ret <= 0) {
- aki_signal_send(&dmon->quit_signal);
+ nn_signal_send(&dmon->quit_signal);
return;
}
dmon->ipc.index += ret;
@@ -403,7 +403,7 @@ static void ipc_poll_callback(void *userdata, s32 revents)
static void context_poll_callback(void *userdata, s32 revents)
{
(void)userdata;
- al_assert(revents & AKI_POLL_READ);
+ al_assert(revents & NNWT_POLL_READ);
stl_global_process_events();
}
@@ -412,17 +412,17 @@ static void quit_signal_callback(void *userdata)
struct daemon *dmon = (struct daemon *)userdata;
struct monitor *monitor;
al_array_foreach(dmon->monitors, i, monitor) {
- aki_fs_event_stop(&monitor->selection_event);
+ nn_fs_event_stop(&monitor->selection_event);
maybe_kill_wallpaper(monitor);
}
- aki_fs_event_stop(&dmon->conf_event);
+ nn_fs_event_stop(&dmon->conf_event);
if (!dmon->ipc_errored) {
- aki_poll_stop(&dmon->ipc_poll);
+ nn_poll_stop(&dmon->ipc_poll);
}
if (dmon->context_poll_fd != -1) {
- aki_poll_stop(&dmon->context_poll);
+ nn_poll_stop(&dmon->context_poll);
}
- aki_signal_stop(&dmon->quit_signal);
+ nn_signal_stop(&dmon->quit_signal);
}
static struct daemon dmon = { 0 };
@@ -439,31 +439,31 @@ static void sigchld_handler(s32 signum)
static void sigint_handler(s32 signum)
{
(void)signum;
- aki_signal_send(&dmon.quit_signal);
+ nn_signal_send(&dmon.quit_signal);
}
s32 main(void)
{
- if (!aki_common_init() || !open_config(&dmon.conf, true)) return EXIT_FAILURE;
+ if (!nn_common_init() || !open_config(&dmon.conf, true)) return EXIT_FAILURE;
signal(SIGINT, sigint_handler);
signal(SIGCHLD, sigchld_handler);
s32 ret = EXIT_FAILURE;
- aki_event_loop_init(&dmon.loop);
+ nn_event_loop_init(&dmon.loop);
- aki_signal_init(&dmon.quit_signal, quit_signal_callback, &dmon);
- aki_signal_start(&dmon.quit_signal, &dmon.loop);
+ nn_signal_init(&dmon.quit_signal, &dmon.loop, quit_signal_callback, &dmon);
+ nn_signal_start(&dmon.quit_signal);
al_array_init(dmon.monitors);
stl_set_output_discovered_callback(output_discovered_callback, &dmon);
if (!stl_global_init(true)) goto out;
dmon.context_poll_fd = stl_global_get_poll_fd();
if (dmon.context_poll_fd != -1) {
- aki_poll_init(&dmon.context_poll, context_poll_callback, &dmon);
- aki_poll_set(&dmon.context_poll, dmon.context_poll_fd, AKI_POLL_READ);
- aki_poll_start(&dmon.context_poll, &dmon.loop);
+ nn_poll_init(&dmon.context_poll, context_poll_callback, &dmon);
+ nn_poll_set(&dmon.context_poll, dmon.context_poll_fd, NNWT_POLL_READ);
+ nn_poll_start(&dmon.context_poll, &dmon.loop);
}
str monitors;
@@ -477,9 +477,9 @@ s32 main(void)
str monitors_path;
al_str_clone(&monitors_path, &dmon.conf.config_dir);
al_str_cat(&monitors_path, al_str_c("/monitors"));
- bool monitors_exists = aki_file_exists(&monitors_path) || aki_file_create(&monitors_path);
+ bool monitors_exists = nn_file_exists(&monitors_path) || nn_file_create(&monitors_path);
if (monitors_exists) {
- aki_file_open_and_replace(&monitors_path, &monitors, false);
+ nn_file_open_and_replace(&monitors_path, &monitors, false);
}
al_str_free(&monitors_path);
al_str_free(&monitors);
@@ -507,26 +507,25 @@ s32 main(void)
dmon.out.size = SWAY_IPC_HEADER_LENGTH + len;
dmon.out.index = 0;
- dmon.ipc_socket.type = AKI_SOCKET_UNIX;
- aki_socket_init(&dmon.ipc_socket);
- aki_socket_set_blocking(&dmon.ipc_socket, false);
- aki_poll_init(&dmon.ipc_poll, ipc_poll_callback, &dmon);
- aki_poll_set(&dmon.ipc_poll, aki_socket_get_fd(&dmon.ipc_socket), AKI_POLL_WRITE);
+ dmon.ipc_socket.type = NNWT_SOCKET_UNIX;
+ nn_socket_init(&dmon.ipc_socket, NNWT_SOCKET_NONBLOCKING);
+ nn_poll_init(&dmon.ipc_poll, ipc_poll_callback, &dmon);
+ nn_poll_set(&dmon.ipc_poll, nn_socket_get_fd(&dmon.ipc_socket), NNWT_POLL_WRITE);
dmon.ipc_connected = false;
dmon.ipc_errored = false;
char *swaysock = getenv("SWAYSOCK");
- if (swaysock && aki_socket_connect(&dmon.ipc_socket, al_str_cr(swaysock), 0)) {
- aki_poll_start(&dmon.ipc_poll, &dmon.loop);
+ if (swaysock && nn_socket_connect(&dmon.ipc_socket, al_str_cr(swaysock), 0)) {
+ nn_poll_start(&dmon.ipc_poll, &dmon.loop);
} else {
dmon.ipc_errored = true;
al_log_warn("tarod", "couldn't connect to sway ipc socket");
}
- aki_fs_event_init(&dmon.conf_event, &dmon.conf.config_path,
- AKI_CLOSE_WRITE, conf_fs_event_callback, &dmon);
- aki_fs_event_start(&dmon.conf_event, &dmon.loop);
+ nn_fs_event_init(&dmon.conf_event, &dmon.conf.config_path,
+ NNWT_CLOSE_WRITE, conf_fs_event_callback, &dmon);
+ nn_fs_event_start(&dmon.conf_event, &dmon.loop);
- aki_event_loop_run(&dmon.loop);
+ nn_event_loop_run(&dmon.loop);
al_array_foreach(dmon.monitors, i, monitor) {
close_monitor(monitor);
@@ -534,13 +533,13 @@ s32 main(void)
}
al_array_free(dmon.monitors);
- aki_fs_event_free(&dmon.conf_event);
+ nn_fs_event_free(&dmon.conf_event);
al_free(dmon.out.buf);
al_free(dmon.ipc.buf);
- aki_socket_close(&dmon.ipc_socket);
+ nn_socket_close(&dmon.ipc_socket);
- aki_event_loop_destroy(&dmon.loop);
+ nn_event_loop_destroy(&dmon.loop);
ret = EXIT_SUCCESS;
@@ -548,7 +547,7 @@ out:
close_config(&dmon.conf);
stl_global_close();
- aki_common_close();
+ nn_common_close();
return ret;
}
diff --git a/taro/db.c b/taro/db.c
index 5202df8..f3e5ede 100644
--- a/taro/db.c
+++ b/taro/db.c
@@ -8,11 +8,11 @@
static bool load_entry(struct entry *e)
{
- struct aki_dir dir;
- if (!aki_dir_open(&dir, &e->path)) return false;
+ struct nn_dir dir;
+ if (!nn_dir_open(&dir, &e->path)) return false;
- struct aki_dir_entry entry;
- while (aki_dir_read(&dir, &entry)) {
+ struct nn_dir_entry entry;
+ while (nn_dir_read(&dir, &entry)) {
if (entry.entry->d_type != DT_REG) {
continue;
}
@@ -26,7 +26,7 @@ static bool load_entry(struct entry *e)
str package_path;
al_str_clone(&package_path, &e->path);
al_str_cat(&package_path, al_str_c("/scene.pkg"));
- e->has_package = aki_file_exists(&package_path);
+ e->has_package = nn_file_exists(&package_path);
al_str_free(&package_path);
str project_path;
@@ -34,7 +34,7 @@ static bool load_entry(struct entry *e)
al_str_cat(&project_path, al_str_c("/"));
al_str_cat(&project_path, al_str_cr(entry.entry->d_name));
- json_t *root = aki_file_open_as_json(&project_path);
+ json_t *root = nn_file_open_as_json(&project_path);
al_str_free(&project_path);
if (!root) continue;
e->loaded = true;
@@ -49,7 +49,7 @@ static bool load_entry(struct entry *e)
al_str_clone(&e->preview_path, &e->path);
al_str_cat(&e->preview_path, al_str_c("/"));
al_str_cat(&e->preview_path, al_str_cr(json_string_value(preview)));
- e->has_preview = aki_file_exists(&e->preview_path);
+ e->has_preview = nn_file_exists(&e->preview_path);
}
json_t *general = json_object_get(root, "general");
@@ -127,7 +127,7 @@ static bool load_entry(struct entry *e)
}
}
- aki_dir_close(&dir);
+ nn_dir_close(&dir);
return e->loaded;
}
@@ -159,12 +159,12 @@ static s32 wallpaper_id_compare(const void *a, const void *b)
bool db_load_entries(struct db *db, str *path)
{
- struct aki_dir dir;
- if (!aki_dir_open(&dir, path)) return false;
+ struct nn_dir dir;
+ if (!nn_dir_open(&dir, path)) return false;
al_array_init(db->entries);
- struct aki_dir_entry entry;
- while (aki_dir_read(&dir, &entry)) {
+ struct nn_dir_entry entry;
+ while (nn_dir_read(&dir, &entry)) {
if (!(entry.entry->d_type == DT_DIR || entry.entry->d_type == DT_UNKNOWN)) {
continue;
}
@@ -178,7 +178,7 @@ bool db_load_entries(struct db *db, str *path)
al_str_clone(&e.path, path);
al_str_cat(&e.path, al_str_c("/"));
al_str_cat(&e.path, &e.id);
- if (!aki_dir_exists(&e.path)) {
+ if (!nn_dir_exists(&e.path)) {
al_str_free(&e.id);
al_str_free(&e.path);
continue;
diff --git a/taro/file_ext.c b/taro/file_ext.c
index 3091fa4..1d1bbdc 100644
--- a/taro/file_ext.c
+++ b/taro/file_ext.c
@@ -2,32 +2,32 @@
#include "file_ext.h"
-bool aki_file_open_and_read_wholly(str *path, str *out, bool lock)
+bool nn_file_open_and_read_wholly(str *path, str *out, bool lock)
{
- struct aki_file file;
- if (!aki_file_open(&file, path, lock ? AKI_FILE_LOCK : AKI_FILE_READONLY)) {
+ struct nn_file file;
+ if (!nn_file_open(&file, path, lock ? NNWT_FILE_LOCK : NNWT_FILE_READONLY)) {
return false;
}
- s32 ret = aki_file_read_as_str(&file, out);
- aki_file_close(&file);
+ s32 ret = nn_file_read_as_str(&file, out);
+ nn_file_close(&file);
return ret != -1;
}
-bool aki_file_open_and_replace(str *path, str *buf, bool lock)
+bool nn_file_open_and_replace(str *path, str *buf, bool lock)
{
- struct aki_file file;
- if (!aki_file_open(&file, path, lock ? AKI_FILE_LOCK : 0)) {
+ struct nn_file file;
+ if (!nn_file_open(&file, path, lock ? NNWT_FILE_LOCK : 0)) {
return false;
}
- s32 ret = aki_file_replace(&file, buf);
- aki_file_close(&file);
+ s32 ret = nn_file_replace(&file, buf);
+ nn_file_close(&file);
return ret != -1;
}
-json_t *aki_file_open_as_json(str *path)
+json_t *nn_file_open_as_json(str *path)
{
str s;
- if (!aki_file_open_and_read_wholly(path, &s, false)) {
+ if (!nn_file_open_and_read_wholly(path, &s, false)) {
return NULL;
}
json_error_t error;
@@ -39,7 +39,7 @@ json_t *aki_file_open_as_json(str *path)
return root;
}
-bool aki_dump_json_and_decref(str *path, json_t *root)
+bool nn_dump_json_and_decref(str *path, json_t *root)
{
str s;
size_t size = json_dumpb(root, NULL, 0, JSON_INDENT(4));
@@ -49,7 +49,7 @@ bool aki_dump_json_and_decref(str *path, json_t *root)
json_decref(root);
return false;
}
- bool ret = aki_file_open_and_replace(path, &s, false);
+ bool ret = nn_file_open_and_replace(path, &s, false);
al_str_free(&s);
json_decref(root);
return ret;
diff --git a/taro/file_ext.h b/taro/file_ext.h
index 9398eb3..8ff69dd 100644
--- a/taro/file_ext.h
+++ b/taro/file_ext.h
@@ -1,7 +1,7 @@
-#include <aki/file.h>
+#include <nnwt/file.h>
#include <jansson.h>
-bool aki_file_open_and_read_wholly(str *path, str *out, bool lock);
-bool aki_file_open_and_replace(str *path, str *buf, bool lock);
-json_t *aki_file_open_as_json(str *path);
-bool aki_dump_json_and_decref(str *path, json_t *root);
+bool nn_file_open_and_read_wholly(str *path, str *out, bool lock);
+bool nn_file_open_and_replace(str *path, str *buf, bool lock);
+json_t *nn_file_open_as_json(str *path);
+bool nn_dump_json_and_decref(str *path, json_t *root);
diff --git a/taro/meson.build b/taro/meson.build
index cbac318..487c671 100644
--- a/taro/meson.build
+++ b/taro/meson.build
@@ -14,13 +14,13 @@ if not notcurses.found() or not notcurses_core.found()
notcurses_core = notcurses_proj.dependency('notcurses-core')
endif
-taro_deps = [akiyo, notcurses, notcurses_core]
+taro_deps = [naunet, notcurses, notcurses_core]
taro_src = ['ui.c', 'db.c', 'file_ext.c']
-tarod_deps = [akiyo, stela]
+tarod_deps = [naunet, stela]
tarod_src = ['daemon.c', 'file_ext.c']
executable('taro', taro_src, dependencies: taro_deps, install: true)
executable('tarod', tarod_src, dependencies: tarod_deps, install: true)
-executable('notcurses_test', ['tests/notcurses_ffmpeg.c'], dependencies: [akiyo, notcurses, notcurses_core])
+subdir('tests')
diff --git a/taro/tests/meson.build b/taro/tests/meson.build
new file mode 100644
index 0000000..00ecb00
--- /dev/null
+++ b/taro/tests/meson.build
@@ -0,0 +1 @@
+executable('notcurses_test', ['notcurses_ffmpeg.c'], dependencies: [naunet, notcurses, notcurses_core])
diff --git a/taro/tests/notcurses_ffmpeg.c b/taro/tests/notcurses_ffmpeg.c
index dd798c9..adf9689 100644
--- a/taro/tests/notcurses_ffmpeg.c
+++ b/taro/tests/notcurses_ffmpeg.c
@@ -1,11 +1,11 @@
#include <al/types.h>
-#include <aki/common.h>
+#include <nnwt/common.h>
#include <notcurses/notcurses.h>
#include <notcurses/nckeys.h>
s32 main(void)
{
- if (!aki_common_init()) return EXIT_FAILURE;
+ if (!nn_common_init()) return EXIT_FAILURE;
struct notcurses *nc = notcurses_init(NULL, stdin);
@@ -29,7 +29,7 @@ s32 main(void)
out:
notcurses_stop(nc);
- aki_common_close();
+ nn_common_close();
return EXIT_SUCCESS;
}
diff --git a/taro/ui.c b/taro/ui.c
index a93d2c1..95ce402 100644
--- a/taro/ui.c
+++ b/taro/ui.c
@@ -1,9 +1,9 @@
#include <al/log.h>
#include <al/lib.h>
#include <al/random.h>
-#include <aki/common.h>
-#include <aki/event_loop.h>
-#include <aki/timer.h>
+#include <nnwt/common.h>
+#include <nnwt/event_loop.h>
+#include <nnwt/timer.h>
#include <notcurses/notcurses.h>
#include <notcurses/nckeys.h>
@@ -114,10 +114,10 @@ enum {
struct ui {
struct notcurses *nc;
- struct aki_event_loop loop;
- struct aki_poll input_poll;
+ struct nn_event_loop loop;
+ struct nn_poll input_poll;
u64 delay;
- struct aki_timer timer;
+ struct nn_timer timer;
bool layed_out;
f32 text_update;
u32 term_rows;
@@ -140,7 +140,7 @@ static s32 get_entry_from_config(struct ui *u)
{
s32 ret = -1;
str config;
- if (aki_file_open_and_read_wholly(&u->m.selection_path, &config, false)) {
+ if (nn_file_open_and_read_wholly(&u->m.selection_path, &config, false)) {
s32 index = al_str_find(&config, '|');
if (index > 2) {
str *id = al_str_substr(&config, 0, index - 2);
@@ -200,7 +200,7 @@ static void write_selected_entry_to_config(struct ui *u)
config.len--;
}
}
- aki_file_open_and_replace(&u->m.selection_path, &config, true);
+ nn_file_open_and_replace(&u->m.selection_path, &config, true);
}
// ---------
@@ -302,7 +302,7 @@ static bool init_monitors(struct ui *u, struct monitors *m)
al_str_clone(&monitors_path, &u->conf.config_dir);
al_str_cat(&monitors_path, al_str_c("/monitors"));
str monitors;
- bool ret = aki_file_open_and_read_wholly(&monitors_path, &monitors, false);
+ bool ret = nn_file_open_and_read_wholly(&monitors_path, &monitors, false);
al_str_free(&monitors_path);
if (!ret) {
al_log_error("taro", "failed to open monitor list, has `tarod` run?");
@@ -314,7 +314,7 @@ static bool init_monitors(struct ui *u, struct monitors *m)
al_str_clone(&monitor_dir, &u->conf.config_dir);
al_str_cat(&monitor_dir, al_str_c("/"));
al_str_cat(&monitor_dir, &monitor);
- if (aki_dir_exists(&monitor_dir)) {
+ if (nn_dir_exists(&monitor_dir)) {
char *c_str = al_str_to_c_str(&monitor);
al_array_push(m->monitors, c_str);
}
@@ -1121,7 +1121,7 @@ static void input_poll_callback(void *userdata, s32 revents)
draw_grid_tiles(u, &u->g, false);
should_render = true;
} else if (input.id == 'q') {
- aki_event_loop_break(&u->loop);
+ nn_event_loop_break(&u->loop);
}
switch (u->selected_menu) {
case MENU_GRID:
@@ -1139,7 +1139,7 @@ static void input_poll_callback(void *userdata, s32 revents)
if (should_render) notcurses_render(u->nc);
}
-static void timer_callback(void *userdata, struct aki_timer *timer)
+static void timer_callback(void *userdata, struct nn_timer *timer)
{
struct ui *u = (struct ui *)userdata;
(void)timer;
@@ -1163,15 +1163,15 @@ static void timer_callback(void *userdata, struct aki_timer *timer)
notcurses_render(u->nc);
- aki_timer_set_repeat(&u->timer, AKI_TS_FROM_USEC(u->delay));
- aki_timer_again(&u->timer);
+ nn_timer_set_repeat(&u->timer, NNWT_TS_FROM_USEC(u->delay));
+ nn_timer_again(&u->timer);
}
static struct ui u = { 0 };
s32 main(void)
{
- if (!aki_common_init()) return EXIT_FAILURE;
+ if (!nn_common_init()) return EXIT_FAILURE;
if (!open_config(&u.conf, false)) {
al_log_error("taro", "failed to open config, run `tarod` at least once to generate needed config");
@@ -1201,17 +1201,17 @@ s32 main(void)
u.layed_out = true;
draw_monitors(&u, &u.m);
- aki_event_loop_init(&u.loop);
+ nn_event_loop_init(&u.loop);
- aki_poll_init(&u.input_poll, input_poll_callback, &u);
- aki_poll_set(&u.input_poll, notcurses_inputready_fd(u.nc), AKI_POLL_READ);
- aki_poll_start(&u.input_poll, &u.loop);
+ nn_poll_init(&u.input_poll, input_poll_callback, &u);
+ nn_poll_set(&u.input_poll, notcurses_inputready_fd(u.nc), NNWT_POLL_READ);
+ nn_poll_start(&u.input_poll, &u.loop);
- aki_timer_init(&u.timer, &u.loop, timer_callback, &u);
+ nn_timer_init(&u.timer, &u.loop, timer_callback, &u);
u.delay = 1000000; // 1fps.
timer_callback(&u, NULL);
- aki_event_loop_run(&u.loop);
+ nn_event_loop_run(&u.loop);
notcurses_stop(u.nc);
@@ -1220,7 +1220,7 @@ s32 main(void)
out:
close_config(&u.conf);
- aki_common_close();
+ nn_common_close();
return ret;
}