Mercurial > hg > nnchat
changeset 118:9e7f52878725
Use getmaxyx() instead of LINES and COLS globals as recommended by curses programming guidelines.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 25 Oct 2010 01:35:12 +0300 |
parents | da05b766b8c0 |
children | 4bc63a535acb |
files | nnchat.c |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/nnchat.c Mon Oct 25 01:34:27 2010 +0300 +++ b/nnchat.c Mon Oct 25 01:35:12 2010 +0300 @@ -629,13 +629,17 @@ BOOL initializeWindows(void) { + int w, h; + + getmaxyx(stdscr, h, w); + if (mainWin) delwin(mainWin); if (statusWin) delwin(statusWin); if (editWin) delwin(editWin); - - mainWin = newwin(LINES - 4, COLS, 0, 0); - statusWin = newwin(1, COLS, LINES - 4, 0); - editWin = newwin(3, COLS, LINES - 3, 0); + + mainWin = newwin(h - 4, w, 0, 0); + statusWin = newwin(1, w, h - 4, 0); + editWin = newwin(3, w, h - 3, 0); if (mainWin == NULL || statusWin == NULL || editWin == NULL) { THERR("Could not create ncurses windows!\n"); @@ -848,7 +852,6 @@ if (!optDaemon) { if (LINES < 0 || LINES > 1000) LINES = 24; if (COLS < 0 || COLS > 1000) COLS = 80; - LINES=24; initscr(); raw(); keypad(stdscr, TRUE);