X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=lib-ui%2Fresize.c;h=fe0e9655ed7fae74f5410bffb4fa109db390d86a;hb=84bc6d1930165b21919541b3b24294a9d99c3541;hp=82fe316075f7721b38cddd9e65b95ad62478bcea;hpb=c8102caaf1221828c06752f9ac69271fb999c145;p=apps%2Fmadmutt.git diff --git a/lib-ui/resize.c b/lib-ui/resize.c index 82fe316..fe0e965 100644 --- a/lib-ui/resize.c +++ b/lib-ui/resize.c @@ -7,29 +7,20 @@ * please see the file GPL in the top level source directory. */ -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#if defined(USE_SLANG_CURSES) || defined(HAVE_RESIZETERM) - -#include +#include -#include "mutt.h" +#if defined(HAVE_RESIZETERM) -#include -#include -#include #include - #ifdef HAVE_SYS_IOCTL_H -#include -#else -# ifdef HAVE_IOCTL_H -# include -# endif +# include +#elif defined(HAVE_IOCTL_H) +# include #endif +#include +#include "mutt.h" + /* this routine should be called after receiving SIGWINCH */ void mutt_resize_screen (void) { @@ -37,41 +28,31 @@ void mutt_resize_screen (void) int fd; struct winsize w; -#ifdef HAVE_RESIZETERM - int SLtt_Screen_Rows, SLtt_Screen_Cols; -#endif + int rows, cols; - SLtt_Screen_Rows = -1; - SLtt_Screen_Cols = -1; + rows = -1; + cols = -1; if ((fd = open ("/dev/tty", O_RDONLY)) != -1) { if (ioctl (fd, TIOCGWINSZ, &w) != -1) { - SLtt_Screen_Rows = w.ws_row; - SLtt_Screen_Cols = w.ws_col; + rows = w.ws_row; + cols = w.ws_col; } close (fd); } - if (SLtt_Screen_Rows <= 0) { + if (rows <= 0) { if ((cp = getenv ("LINES")) != NULL) { - SLtt_Screen_Rows = atoi (cp); + rows = atoi (cp); } else - SLtt_Screen_Rows = 24; + rows = 24; } - if (SLtt_Screen_Cols <= 0) { + if (cols <= 0) { if ((cp = getenv ("COLUMNS")) != NULL) - SLtt_Screen_Cols = atoi (cp); + cols = atoi (cp); else - SLtt_Screen_Cols = 80; + cols = 80; } -#ifdef USE_SLANG_CURSES - delwin (stdscr); - SLsmg_reset_smg (); - SLsmg_init_smg (); - stdscr = newwin (0, 0, 0, 0); - keypad (stdscr, TRUE); -#else - resizeterm (SLtt_Screen_Rows, SLtt_Screen_Cols); -#endif + resizeterm (rows, cols); } -#endif /* defined(USE_SLANG_CURSES) || defined(HAVE_RESIZETERM) */ +#endif /* defined(HAVE_RESIZETERM) */