summaryrefslogtreecommitdiff
path: root/src/fruits
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2025-03-18 10:56:12 -0400
committerAndrew Opalach <andrew@akon.city> 2025-03-18 10:56:12 -0400
commit191d98d306d48ba36d5a5a2eb3583b805a03b2c3 (patch)
tree3c917adaf66e6d348046beee510a9a1ed1dc1a41 /src/fruits
parentf0accac221a53633380f15b4953ca4f4fdfbeca7 (diff)
downloadcamu-191d98d306d48ba36d5a5a2eb3583b805a03b2c3.tar.gz
camu-191d98d306d48ba36d5a5a2eb3583b805a03b2c3.tar.bz2
camu-191d98d306d48ba36d5a5a2eb3583b805a03b2c3.zip
Cleanup
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/fruits')
-rw-r--r--src/fruits/cmc/ui/ext.h20
-rw-r--r--src/fruits/cmc/ui/pane_list.c3
-rw-r--r--src/fruits/cmc/ui/pane_search.c2
-rw-r--r--src/fruits/cmc/ui/ui.c9
-rw-r--r--src/fruits/cmsrv/ui.c2
-rw-r--r--src/fruits/cmv/cmv.c11
-rw-r--r--src/fruits/ctv/ctv.c2
7 files changed, 37 insertions, 12 deletions
diff --git a/src/fruits/cmc/ui/ext.h b/src/fruits/cmc/ui/ext.h
new file mode 100644
index 0000000..b09754e
--- /dev/null
+++ b/src/fruits/cmc/ui/ext.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include <al/types.h>
+#include <notcurses/notcurses.h>
+
+// Copy-paste from notcurses.h
+static inline s32 ncplane_light_box(struct ncplane *n, u16 attr, u64 channels, s32 ystop, s32 xstop, u32 ctlword)
+{
+ s32 ret = 0;
+ nccell ul = NCCELL_TRIVIAL_INITIALIZER, ur = NCCELL_TRIVIAL_INITIALIZER;
+ nccell ll = NCCELL_TRIVIAL_INITIALIZER, lr = NCCELL_TRIVIAL_INITIALIZER;
+ nccell hl = NCCELL_TRIVIAL_INITIALIZER, vl = NCCELL_TRIVIAL_INITIALIZER;
+ if((ret = nccells_light_box(n, attr, channels, &ul, &ur, &ll, &lr, &hl, &vl)) == 0){
+ ret = ncplane_box(n, &ul, &ur, &ll, &lr, &hl, &vl, ystop, xstop, ctlword);
+ }
+ nccell_release(n, &ul); nccell_release(n, &ur);
+ nccell_release(n, &ll); nccell_release(n, &lr);
+ nccell_release(n, &hl); nccell_release(n, &vl);
+ return ret;
+}
diff --git a/src/fruits/cmc/ui/pane_list.c b/src/fruits/cmc/ui/pane_list.c
index 9a04211..5fc9f81 100644
--- a/src/fruits/cmc/ui/pane_list.c
+++ b/src/fruits/cmc/ui/pane_list.c
@@ -5,6 +5,7 @@
#include "../cmc.h"
#include "ui.h"
+#include "ext.h"
void cmc_lp_init(struct cmc_ui *ui)
{
@@ -137,7 +138,7 @@ static void render_now_playing(struct cmc_ui *ui, struct cmc_list_tab *tab, u32
u64 c = 0;
ncchannels_set_fg_default(&c);
ncplane_cursor_move_yx(ui->lp.n, y, 0);
- ncplane_rounded_box(ui->lp.n, NCSTYLE_NONE, c, height - 1, width - 1, 0);
+ ncplane_light_box(ui->lp.n, NCSTYLE_NONE, c, height - 1, width - 1, 0);
}
void cmc_lp_render(struct cmc_ui *ui)
diff --git a/src/fruits/cmc/ui/pane_search.c b/src/fruits/cmc/ui/pane_search.c
index e273504..3b427ce 100644
--- a/src/fruits/cmc/ui/pane_search.c
+++ b/src/fruits/cmc/ui/pane_search.c
@@ -2,6 +2,8 @@
#include "ui.h"
+AL_ASSERT_TYPE_SIZE(wchar_t, 4);
+
void cmc_sp_init(struct cmc_ui *ui)
{
al_array_init(ui->sp.tabs);
diff --git a/src/fruits/cmc/ui/ui.c b/src/fruits/cmc/ui/ui.c
index 84e514e..9931620 100644
--- a/src/fruits/cmc/ui/ui.c
+++ b/src/fruits/cmc/ui/ui.c
@@ -1,6 +1,7 @@
#include <al/lib.h>
#include "ui.h"
+#include "ext.h"
void cmc_ui_putnwstr_yx(struct ncplane *n, u32 y, u32 x, u32 width, wstr *w)
{
@@ -67,7 +68,7 @@ void cmc_ui_queue_render(struct cmc_ui *ui)
ncplane_erase(ui->oln);
}
- notcurses_render(ui->nc);
+ //notcurses_render(ui->nc);
switch (ui->pane) {
case CMC_PANE_LIST:
@@ -92,7 +93,7 @@ void cmc_ui_queue_render(struct cmc_ui *ui)
u64 c = 0;
ncchannels_set_fg_default(&c);
ncplane_cursor_move_yx(ui->oln, 0, 0);
- ncplane_rounded_box(ui->oln, NCSTYLE_NONE, c, height - 1, width - 1, 0);
+ ncplane_light_box(ui->oln, NCSTYLE_NONE, c, height - 1, width - 1, 0);
}
notcurses_render(ui->nc);
@@ -190,8 +191,8 @@ static bool relayout(struct cmc_ui *ui)
if (ui->oln) ncplane_destroy(ui->oln);
u32 width = ncplane_dim_x(ui->n);
u32 height = ncplane_dim_y(ui->n);
- nopts.margin_r = MAX(6u, (u32)(width / 1.5));
- nopts.margin_b = MAX(2u, height / 3);
+ nopts.margin_r = MAX(6u, width / 2);
+ nopts.margin_b = MAX(2u, height / 2);
nopts.x = nopts.margin_r / 2;
nopts.y = nopts.margin_b / 2;
ui->oln = ncplane_create(ui->n, &nopts);
diff --git a/src/fruits/cmsrv/ui.c b/src/fruits/cmsrv/ui.c
index 9059632..dced71d 100644
--- a/src/fruits/cmsrv/ui.c
+++ b/src/fruits/cmsrv/ui.c
@@ -83,7 +83,7 @@ static void render_log(struct cmsrv_ui *ui)
u32 max_height = ncplane_dim_y(n) - 2;
u32 size = ui->log.messages.count;
- u32 index = size > max_height ? size - max_height : 0;
+ u32 index = (size > max_height) ? size - max_height : 0;
for (u32 i = index; i < size; i++) {
// We can't use putnstr here to control the width because lots of
// these messages will have wide characters.
diff --git a/src/fruits/cmv/cmv.c b/src/fruits/cmv/cmv.c
index 6285c39..e539f01 100644
--- a/src/fruits/cmv/cmv.c
+++ b/src/fruits/cmv/cmv.c
@@ -1,3 +1,4 @@
+#define AL_LOG_SECTION "cmv"
#include <al/log.h>
#include <nnwt/event_loop.h>
#include <nnwt/thread.h>
@@ -124,6 +125,10 @@ s32 window_system_main(s32 argc, str *argv)
#ifndef CAMU_SINK_ONLY
bool local = argc > 1;
+#else
+ if (argc > 1) {
+ warn("Got arguments in a sink-only configuration.");
+ }
#endif
u8 type;
@@ -167,7 +172,6 @@ s32 window_system_main(s32 argc, str *argv)
if (local) {
c.desktop.exit_callback = exit_callback;
c.desktop.userdata = &c;
- c.desktop.sink.local_server = &c.server.data.server;
}
#endif
if (!camu_desktop_connect(&c.desktop, type, &c.loop, &addr, CAMU_PORT)) {
@@ -199,9 +203,6 @@ s32 window_system_main(s32 argc, str *argv)
nn_packet_free(packet);
}
}
-#else
- (void)argc;
- (void)argv;
#endif
struct nn_thread thread0;
@@ -247,7 +248,7 @@ s32 main(s32 argc, char *cargv[])
str arg;
#ifdef NAUNET_ON_WINDOWS
if (!al_str_from_wstr(&arg, &al_wstr_cr(wargv[i]))) {
- al_log_error("cmv", "Failed to parse argument #%i.", i);
+ error("Failed to parse argument #%i.", i);
continue;
}
#else
diff --git a/src/fruits/ctv/ctv.c b/src/fruits/ctv/ctv.c
index c3af943..452cd39 100644
--- a/src/fruits/ctv/ctv.c
+++ b/src/fruits/ctv/ctv.c
@@ -1,5 +1,5 @@
-#include <stl/platform.h>
#include <al/log.h>
+#include <android/log.h>
#include "../../libsink/sink.h"
#include "../../sink/desktop.h"