Skip to content
Snippets Groups Projects
Commit ca110833 authored by Yorhel's avatar Yorhel
Browse files

Moved minimum screen size handling to main.c

And with that, finally managed to get rid of sflags in ncdu.h
parent b24c3dee
No related branches found
No related tags found
No related merge requests found
...@@ -35,9 +35,10 @@ ...@@ -35,9 +35,10 @@
#include <unistd.h> #include <unistd.h>
int sflags;
int pstate; int pstate;
int min_rows = 17,
min_cols = 60;
void screen_draw() { void screen_draw() {
int n = 1; int n = 1;
...@@ -57,8 +58,8 @@ int input_handle(int wait) { ...@@ -57,8 +58,8 @@ int input_handle(int wait) {
screen_draw(); screen_draw();
while((ch = getch()) != ERR) { while((ch = getch()) != ERR) {
if(ch == KEY_RESIZE) { if(ch == KEY_RESIZE) {
if(ncresize((sflags & SF_IGNS ? 0 : 17), (sflags * SF_IGNS ? 0 : 60))) if(ncresize(min_rows, min_cols))
sflags |= SF_IGNS; min_rows = min_cols = 0;
screen_draw(); screen_draw();
continue; continue;
} }
...@@ -79,7 +80,6 @@ void argv_parse(int argc, char **argv, char *dir) { ...@@ -79,7 +80,6 @@ void argv_parse(int argc, char **argv, char *dir) {
/* load defaults */ /* load defaults */
memset(dir, 0, PATH_MAX); memset(dir, 0, PATH_MAX);
getcwd(dir, PATH_MAX); getcwd(dir, PATH_MAX);
sflags = 0;
calc_delay = 100; calc_delay = 100;
calc_smfs = 0; calc_smfs = 0;
...@@ -150,8 +150,8 @@ int main(int argc, char **argv) { ...@@ -150,8 +150,8 @@ int main(int argc, char **argv) {
noecho(); noecho();
curs_set(0); curs_set(0);
keypad(stdscr, TRUE); keypad(stdscr, TRUE);
if(ncresize((sflags & SF_IGNS ? 0 : 17), (sflags * SF_IGNS ? 0 : 60))) if(ncresize(min_rows, min_cols))
sflags |= SF_IGNS; min_rows = min_cols = 0;
while(pstate != ST_QUIT) { while(pstate != ST_QUIT) {
if(pstate == ST_CALC) if(pstate == ST_CALC)
......
...@@ -58,11 +58,6 @@ ...@@ -58,11 +58,6 @@
#define FF_SERR 0x20 /* error in subdirectory */ #define FF_SERR 0x20 /* error in subdirectory */
#define FF_BSEL 0x40 /* selected */ #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 */ /* Program states */
#define ST_CALC 0 #define ST_CALC 0
#define ST_BROWSE 1 #define ST_BROWSE 1
...@@ -80,9 +75,6 @@ struct dir { ...@@ -80,9 +75,6 @@ struct dir {
unsigned char flags; unsigned char flags;
}; };
/* global settings */
extern int sflags;
/* program state */ /* program state */
extern int pstate; extern int pstate;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment