diff options
author | James Booth <boothj5@gmail.com> | 2012-04-23 01:03:11 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-04-23 01:03:11 +0100 |
commit | 3a8c86c6cad9d4d1cd2fde538a52c8f4a5d6587f (patch) | |
tree | 47f3bf4de449aa27665b1fbbbb6e024fbb735779 | |
parent | 9dad7a7ffd21de27c32ffa3f5fa0ca23eea74ac2 (diff) | |
download | profani-tty-3a8c86c6cad9d4d1cd2fde538a52c8f4a5d6587f.tar.gz |
Make pads bigger on resize
Text is not visible but not lost, resizing will bring it back
-rw-r--r-- | windows.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/windows.c b/windows.c index a6c68833..ad6c1743 100644 --- a/windows.c +++ b/windows.c @@ -42,6 +42,9 @@ static WINDOW * _cons_win = NULL; // current window state static int dirty; +// max columns for main windows, never resize below +static int max_cols = 0; + static void _create_windows(void); static int _find_prof_win_index(const char * const contact); static int _new_prof_win(const char * const contact); @@ -376,6 +379,7 @@ static void _create_windows(void) { int rows, cols; getmaxyx(stdscr, rows, cols); + max_cols = cols; // create the console window in 0 struct prof_win cons; @@ -489,8 +493,18 @@ void _win_resize_all(void) int rows, cols; getmaxyx(stdscr, rows, cols); + // only make the pads bigger, to avoid data loss on cropping + if (cols > max_cols) { + cons_show("RESIZING PAD"); + max_cols = cols; + + int i; + for (i = 0; i < NUM_WINS; i++) { + wresize(_wins[i].win, PAD_SIZE, cols); + } + } + WINDOW *current = _wins[_curr_prof_win].win; - wresize(current, PAD_SIZE, cols); prefresh(current, _wins[_curr_prof_win].y_pos, 0, 1, 0, rows-3, cols-1); } |