summaryrefslogtreecommitdiff
path: root/src/fruits/cmc
diff options
context:
space:
mode:
Diffstat (limited to 'src/fruits/cmc')
-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
4 files changed, 29 insertions, 5 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);