From af54e6510f2f701db3b3a533514076c04cea4c66 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Wed, 30 Apr 2025 10:08:46 -0400 Subject: Separate erasing for re-render and clearing in tui Signed-off-by: Andrew Opalach --- src/fruits/cmc/ui/widgets/now_playing.c | 7 +++++++ src/fruits/cmc/ui/widgets/now_playing.h | 1 + src/fruits/cmc/ui/widgets/tile.h | 11 ++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src/fruits/cmc/ui/widgets') diff --git a/src/fruits/cmc/ui/widgets/now_playing.c b/src/fruits/cmc/ui/widgets/now_playing.c index 845a572..ebb8361 100644 --- a/src/fruits/cmc/ui/widgets/now_playing.c +++ b/src/fruits/cmc/ui/widgets/now_playing.c @@ -80,6 +80,13 @@ void cmc_now_playing_erase(struct cmc_now_playing *np) ncplane_erase(np->n); } +void cmc_now_playing_clear(struct cmc_now_playing *np) +{ + cmc_now_playing_erase(np); + ncplane_erase(np->wave); + np->blitted = NULL; +} + void cmc_now_playing_render(struct cmc_now_playing *np, struct cmc_list_entry *entry) { u64 duration = 0, pos = 0; diff --git a/src/fruits/cmc/ui/widgets/now_playing.h b/src/fruits/cmc/ui/widgets/now_playing.h index 5993c59..5c89940 100644 --- a/src/fruits/cmc/ui/widgets/now_playing.h +++ b/src/fruits/cmc/ui/widgets/now_playing.h @@ -22,4 +22,5 @@ void cmc_now_playing_init(struct cmc_now_playing *np); bool cmc_now_playing_layout(struct cmc_now_playing *np, struct ncplane *parent, u32 y); bool cmc_now_playing_tick(struct cmc_now_playing *np, struct cmc_list_entry *entry); void cmc_now_playing_erase(struct cmc_now_playing *np); +void cmc_now_playing_clear(struct cmc_now_playing *np); void cmc_now_playing_render(struct cmc_now_playing *np, struct cmc_list_entry *entry); diff --git a/src/fruits/cmc/ui/widgets/tile.h b/src/fruits/cmc/ui/widgets/tile.h index 6f15c7d..a410207 100644 --- a/src/fruits/cmc/ui/widgets/tile.h +++ b/src/fruits/cmc/ui/widgets/tile.h @@ -1,5 +1,14 @@ #pragma once -struct cmc_tile { +/* + Use-case examples: + - Twitter timeline type. + - Image grid (static/dynamic size, with or without title). + + Implementation: + - Tile sets it's own size. + - Reel. +*/ +struct cmc_tile { }; -- cgit v1.2.3-101-g0448