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

Moved windows on resize

This commit is contained in:
James Booth 2012-04-22 20:59:36 +01:00
parent e5d4e09f6a
commit 6f69ce267b
6 changed files with 24 additions and 18 deletions

View File

@ -60,6 +60,15 @@ void create_input_window(void)
wrefresh(inp_win);
}
void inp_win_resize(const char * const input, const int size)
{
int rows, cols;
getmaxyx(stdscr, rows, cols);
mvwin(inp_win, rows-1, 0);
wresize(inp_win, 1, cols);
wrefresh(inp_win);
}
void inp_clear(void)
{
wclear(inp_win);
@ -83,7 +92,8 @@ void inp_get_char(int *ch, char *input, int *size)
int inp_x = 0;
int i;
// echo off, and get some more input
// echo off, and get some more input
noecho();
*ch = wgetch(inp_win);
@ -131,15 +141,6 @@ void inp_put_back(void)
wrefresh(inp_win);
}
void inp_win_write(const char * const new_input, const int size)
{
int i;
inp_clear();
for (i = 0; i < size; i++)
waddch(inp_win, new_input[i]);
}
/*
* Deal with command editing, return 1 if ch was an edit
* key press: up, down, left, right or backspace

View File

@ -45,13 +45,16 @@ void profanity_run(void)
int size = 0;
while(ch != '\n') {
gui_refresh();
jabber_process_events();
inp_get_char(&ch, inp, &size);
win_handle_special_keys(&ch);
if (ch == KEY_RESIZE) {
gui_resize(ch, inp, size);
}
gui_refresh();
jabber_process_events();
inp_get_char(&ch, inp, &size);
}
inp[size++] = '\0';

View File

@ -80,8 +80,10 @@ void status_bar_resize(void)
int rows, cols, i;
getmaxyx(stdscr, rows, cols);
status_bar = newwin(1, cols, rows-2, 0);
mvwin(status_bar, rows-2, 0);
wresize(status_bar, 1, cols);
wbkgd(status_bar, COLOR_PAIR(3));
wclear(status_bar);
wattron(status_bar, COLOR_PAIR(4));
mvwprintw(status_bar, 0, cols - 29, _active);
wattroff(status_bar, COLOR_PAIR(4));

View File

@ -68,8 +68,9 @@ void title_bar_resize(void)
int rows, cols;
getmaxyx(stdscr, rows, cols);
title_bar = newwin(1, cols, 0, 0);
wresize(title_bar, 1, cols);
wbkgd(title_bar, COLOR_PAIR(3));
wclear(title_bar);
_title_bar_draw_title();
_title_bar_draw_status();
dirty = TRUE;

View File

@ -110,9 +110,8 @@ void gui_resize(const int ch, const char * const input, const int size)
{
title_bar_resize();
status_bar_resize();
create_input_window();
inp_win_write(input, size);
_current_window_refresh();
inp_win_resize(input, size);
dirty = TRUE;
}

View File

@ -94,10 +94,10 @@ void status_bar_update_time(void);
// input window actions
void inp_get_char(int *ch, char *input, int *size);
void inp_clear(void);
void inp_win_resize(const char * input, const int size);
void inp_put_back(void);
void inp_non_block(void);
void inp_block(void);
void inp_get_password(char *passwd);
void inp_win_write(const char * const new_input, const int size);
#endif