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 #if defined(USE_SLANG_CURSES) || defined(HAVE_RESIZETERM)
16 #include <lib-ui/curses.h>
25 #ifdef HAVE_SYS_IOCTL_H
26 #include <sys/ioctl.h>
33 /* this routine should be called after receiving SIGWINCH */
34 void mutt_resize_screen (void)
40 #ifdef HAVE_RESIZETERM
41 int SLtt_Screen_Rows, SLtt_Screen_Cols;
44 SLtt_Screen_Rows = -1;
45 SLtt_Screen_Cols = -1;
46 if ((fd = open ("/dev/tty", O_RDONLY)) != -1) {
47 if (ioctl (fd, TIOCGWINSZ, &w) != -1) {
48 SLtt_Screen_Rows = w.ws_row;
49 SLtt_Screen_Cols = w.ws_col;
53 if (SLtt_Screen_Rows <= 0) {
54 if ((cp = getenv ("LINES")) != NULL) {
55 SLtt_Screen_Rows = atoi (cp);
58 SLtt_Screen_Rows = 24;
60 if (SLtt_Screen_Cols <= 0) {
61 if ((cp = getenv ("COLUMNS")) != NULL)
62 SLtt_Screen_Cols = atoi (cp);
64 SLtt_Screen_Cols = 80;
66 #ifdef USE_SLANG_CURSES
70 stdscr = newwin (0, 0, 0, 0);
71 keypad (stdscr, TRUE);
73 resizeterm (SLtt_Screen_Rows, SLtt_Screen_Cols);
77 #endif /* defined(USE_SLANG_CURSES) || defined(HAVE_RESIZETERM) */