Mercurial > hg > nnchat
comparison nnchat.c @ 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 |
comparison
equal
deleted
inserted
replaced
117:da05b766b8c0 | 118:9e7f52878725 |
---|---|
627 } | 627 } |
628 | 628 |
629 | 629 |
630 BOOL initializeWindows(void) | 630 BOOL initializeWindows(void) |
631 { | 631 { |
632 int w, h; | |
633 | |
634 getmaxyx(stdscr, h, w); | |
635 | |
632 if (mainWin) delwin(mainWin); | 636 if (mainWin) delwin(mainWin); |
633 if (statusWin) delwin(statusWin); | 637 if (statusWin) delwin(statusWin); |
634 if (editWin) delwin(editWin); | 638 if (editWin) delwin(editWin); |
635 | 639 |
636 mainWin = newwin(LINES - 4, COLS, 0, 0); | 640 mainWin = newwin(h - 4, w, 0, 0); |
637 statusWin = newwin(1, COLS, LINES - 4, 0); | 641 statusWin = newwin(1, w, h - 4, 0); |
638 editWin = newwin(3, COLS, LINES - 3, 0); | 642 editWin = newwin(3, w, h - 3, 0); |
639 | 643 |
640 if (mainWin == NULL || statusWin == NULL || editWin == NULL) { | 644 if (mainWin == NULL || statusWin == NULL || editWin == NULL) { |
641 THERR("Could not create ncurses windows!\n"); | 645 THERR("Could not create ncurses windows!\n"); |
642 return FALSE; | 646 return FALSE; |
643 } | 647 } |
846 | 850 |
847 /* Initialize NCurses */ | 851 /* Initialize NCurses */ |
848 if (!optDaemon) { | 852 if (!optDaemon) { |
849 if (LINES < 0 || LINES > 1000) LINES = 24; | 853 if (LINES < 0 || LINES > 1000) LINES = 24; |
850 if (COLS < 0 || COLS > 1000) COLS = 80; | 854 if (COLS < 0 || COLS > 1000) COLS = 80; |
851 LINES=24; | |
852 initscr(); | 855 initscr(); |
853 raw(); | 856 raw(); |
854 keypad(stdscr, TRUE); | 857 keypad(stdscr, TRUE); |
855 noecho(); | 858 noecho(); |
856 meta(stdscr, TRUE); | 859 meta(stdscr, TRUE); |