1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Make pads bigger on resize

Text is not visible but not lost, resizing
will bring it back
This commit is contained in:
James Booth 2012-04-23 01:03:11 +01:00
parent 9dad7a7ffd
commit 3a8c86c6ca

View File

@ -42,6 +42,9 @@ static WINDOW * _cons_win = NULL;
// current window state // current window state
static int dirty; static int dirty;
// max columns for main windows, never resize below
static int max_cols = 0;
static void _create_windows(void); static void _create_windows(void);
static int _find_prof_win_index(const char * const contact); static int _find_prof_win_index(const char * const contact);
static int _new_prof_win(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; int rows, cols;
getmaxyx(stdscr, rows, cols); getmaxyx(stdscr, rows, cols);
max_cols = cols;
// create the console window in 0 // create the console window in 0
struct prof_win cons; struct prof_win cons;
@ -489,8 +493,18 @@ void _win_resize_all(void)
int rows, cols; int rows, cols;
getmaxyx(stdscr, 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; 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); prefresh(current, _wins[_curr_prof_win].y_pos, 0, 1, 0, rows-3, cols-1);
} }