demo: remove obsolete postinit_checks()

This commit is contained in:
nick black 2021-07-06 16:17:09 -04:00
parent 3c2fe36fc9
commit 6e19e0536e
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
3 changed files with 5 additions and 37 deletions

View File

@ -503,39 +503,6 @@ scrub_stdplane(struct notcurses* nc){
return 0;
}
// mainly, we want something up on the screen indicating that terminal
// interrogation is the culprit, should we lock up looking for bitmaps
static int
postinit_checks(struct notcurses* nc, struct ncplane* n){
if(ncplane_cursor_move_yx(n, ncplane_dim_y(n) - 1, 0)){
return -1;
}
ncplane_set_fg_rgb(n, 0x888888);
ncplane_set_styles(n, NCSTYLE_NONE);
ncplane_putstr(n, " Enabling mouse...");
notcurses_render(nc);
if(notcurses_mouse_enable(nc)){
return -1;
}
ncplane_set_fg_rgb(n, 0x22cc22);
ncplane_set_styles(n, NCSTYLE_ITALIC);
ncplane_putstr(n, "done.");
ncplane_set_fg_rgb(n, 0x888888);
ncplane_set_styles(n, NCSTYLE_NONE);
ncplane_putstr(n, " Checking for bitmap support...");
notcurses_render(nc);
int bitmaps = notcurses_check_pixel_support(nc);
if(bitmaps > 0){
ncplane_set_fg_rgb(n, 0x22cc22);
ncplane_set_styles(n, NCSTYLE_ITALIC);
ncplane_putstr(n, "yes!");
}else{
ncplane_set_fg_rgb(n, 0xff9999);
ncplane_putstr(n, "no.");
}
return notcurses_render(nc);
}
int main(int argc, char** argv){
sigset_t sigmask;
// ensure SIGWINCH is delivered only to a thread doing input
@ -568,8 +535,7 @@ int main(int argc, char** argv){
const bool canimage = notcurses_canopen_images(nc);
const bool canvideo = notcurses_canopen_videos(nc);
int dimx, dimy;
struct ncplane* stdn = notcurses_stddim_yx(nc, &dimy, &dimx);
postinit_checks(nc, stdn);
ncplane_dim_yx(notcurses_stdplane(nc), &dimy, &dimx);
if(input_dispatcher(nc)){
goto err;
}

View File

@ -219,11 +219,13 @@ void summarize_stats(notcurses* nc){
(stats->bgelisions * 100.0) / (stats->bgemissions + stats->bgelisions));
char totalbuf[BPREFIXSTRLEN + 1];
bprefix(stats->sprixelbytes, 1, totalbuf, 1);
fprintf(stderr, "Sprixel emits:elides: %ju:%ju (%.2f%%) %sB SUM: %ju (%.2f%%)\n",
fprintf(stderr, "Bitmap emits:elides: %ju:%ju (%.2f%%) %sB (%.2f%%) SuM: %ju (%.2f%%)\n",
stats->sprixelemissions, stats->sprixelelisions,
(stats->sprixelemissions + stats->sprixelelisions) == 0 ? 0 :
(stats->sprixelelisions * 100.0) / (stats->sprixelemissions + stats->sprixelelisions),
totalbuf, stats->appsync_updates,
totalbuf,
stats->render_bytes ? (stats->sprixelbytes * 100.0) / stats->render_bytes : 0,
stats->appsync_updates,
stats->writeouts ? stats->appsync_updates * 100.0 / stats->writeouts : 0);
}
}