2 * Copyright notice from original mutt:
3 * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
5 * This file is part of mutt-ng, see http://www.muttng.org/.
6 * It's licensed under the GNU General Public License,
7 * please see the file GPL in the top level source directory.
14 #include <lib-ui/curses.h>
23 #ifdef HAVE_SYS_IOCTL_H
24 #include <sys/ioctl.h>
31 /* this routine should be called after receiving SIGWINCH */
32 void mutt_resize_screen (void)
38 #ifdef HAVE_RESIZETERM
39 int SLtt_Screen_Rows, SLtt_Screen_Cols;
42 SLtt_Screen_Rows = -1;
43 SLtt_Screen_Cols = -1;
44 if ((fd = open ("/dev/tty", O_RDONLY)) != -1) {
45 if (ioctl (fd, TIOCGWINSZ, &w) != -1) {
46 SLtt_Screen_Rows = w.ws_row;
47 SLtt_Screen_Cols = w.ws_col;
51 if (SLtt_Screen_Rows <= 0) {
52 if ((cp = getenv ("LINES")) != NULL) {
53 SLtt_Screen_Rows = atoi (cp);
56 SLtt_Screen_Rows = 24;
58 if (SLtt_Screen_Cols <= 0) {
59 if ((cp = getenv ("COLUMNS")) != NULL)
60 SLtt_Screen_Cols = atoi (cp);
62 SLtt_Screen_Cols = 80;
64 #ifdef USE_SLANG_CURSES
68 stdscr = newwin (0, 0, 0, 0);
69 keypad (stdscr, TRUE);
71 resizeterm (SLtt_Screen_Rows, SLtt_Screen_Cols);