From ca110833858e341a398749eaa5c0df9366557114 Mon Sep 17 00:00:00 2001 From: Yorhel <git@yorhel.nl> Date: Sat, 18 Apr 2009 14:12:30 +0200 Subject: [PATCH] Moved minimum screen size handling to main.c And with that, finally managed to get rid of sflags in ncdu.h --- src/main.c | 12 ++++++------ src/ncdu.h | 8 -------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/main.c b/src/main.c index 97239aa..1835afc 100644 --- a/src/main.c +++ b/src/main.c @@ -35,9 +35,10 @@ #include <unistd.h> -int sflags; int pstate; +int min_rows = 17, + min_cols = 60; void screen_draw() { int n = 1; @@ -57,8 +58,8 @@ int input_handle(int wait) { screen_draw(); while((ch = getch()) != ERR) { if(ch == KEY_RESIZE) { - if(ncresize((sflags & SF_IGNS ? 0 : 17), (sflags * SF_IGNS ? 0 : 60))) - sflags |= SF_IGNS; + if(ncresize(min_rows, min_cols)) + min_rows = min_cols = 0; screen_draw(); continue; } @@ -79,7 +80,6 @@ void argv_parse(int argc, char **argv, char *dir) { /* load defaults */ memset(dir, 0, PATH_MAX); getcwd(dir, PATH_MAX); - sflags = 0; calc_delay = 100; calc_smfs = 0; @@ -150,8 +150,8 @@ int main(int argc, char **argv) { noecho(); curs_set(0); keypad(stdscr, TRUE); - if(ncresize((sflags & SF_IGNS ? 0 : 17), (sflags * SF_IGNS ? 0 : 60))) - sflags |= SF_IGNS; + if(ncresize(min_rows, min_cols)) + min_rows = min_cols = 0; while(pstate != ST_QUIT) { if(pstate == ST_CALC) diff --git a/src/ncdu.h b/src/ncdu.h index 5bdf1c6..5493ec3 100644 --- a/src/ncdu.h +++ b/src/ncdu.h @@ -58,11 +58,6 @@ #define FF_SERR 0x20 /* error in subdirectory */ #define FF_BSEL 0x40 /* selected */ -/* Settings Flags (int sflags) */ -#define SF_IGNS 0x04 /* ignore too small terminal sizes */ -#define SF_NOCFM 0x08 /* don't confirm file deletion */ -#define SF_IGNE 0x10 /* ignore errors when deleting */ - /* Program states */ #define ST_CALC 0 #define ST_BROWSE 1 @@ -80,9 +75,6 @@ struct dir { unsigned char flags; }; -/* global settings */ -extern int sflags; - /* program state */ extern int pstate; -- GitLab