From 6cb945f3d543d0d5aa184c83c23332b22228147d Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 5 Jan 2020 01:45:04 -0500 Subject: [PATCH] panelreel: initial tablet count based on height --- src/demo/panelreel.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/demo/panelreel.c b/src/demo/panelreel.c index 83125d125..0e81e781b 100644 --- a/src/demo/panelreel.c +++ b/src/demo/panelreel.c @@ -293,14 +293,15 @@ panelreel_demo_core(struct notcurses* nc, int efd, tabletctx** tctxs){ ncplane_printf(w, "a, b, c create tablets, DEL deletes."); ncplane_styles_off(w, CELL_STYLE_BOLD | CELL_STYLE_ITALIC); // FIXME clrtoeol(); - unsigned id = 0; struct timespec deadline; clock_gettime(CLOCK_MONOTONIC, &deadline); ns_to_timespec((timespec_to_ns(&demodelay) * 5) + timespec_to_ns(&deadline), &deadline); - + unsigned id = 0; struct tabletctx* newtablet; - while(id < INITIAL_TABLET_COUNT){ + int dimy = ncplane_dim_y(w); + // Make an initial number of tablets suitable for the screen's height + while(id < dimy / 8u){ newtablet = new_tabletctx(pr, &id); if(newtablet == NULL){ return NULL;