1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00

Tidied up message window handling

This commit is contained in:
James Booth 2012-02-13 01:05:11 +00:00
parent 181c423636
commit 6f90464619

View File

@ -15,12 +15,11 @@ void gui_init(void)
initscr(); initscr();
cbreak(); cbreak();
keypad(stdscr, TRUE); keypad(stdscr, TRUE);
start_color(); start_color();
init_color(COLOR_WHITE, 1000, 1000, 1000); init_color(COLOR_WHITE, 1000, 1000, 1000);
init_pair(1, COLOR_WHITE, COLOR_BLACK); init_pair(1, COLOR_WHITE, COLOR_BLACK);
init_pair(2, COLOR_GREEN, COLOR_BLACK); init_pair(2, COLOR_GREEN, COLOR_BLACK);
init_color(COLOR_BLUE, 0, 0, 250); init_color(COLOR_BLUE, 0, 0, 250);
init_pair(3, COLOR_WHITE, COLOR_BLUE); init_pair(3, COLOR_WHITE, COLOR_BLUE);
@ -32,7 +31,6 @@ void gui_init(void)
create_title_bar(); create_title_bar();
create_status_bar(); create_status_bar();
create_input_window(); create_input_window();
_create_windows(); _create_windows();
} }
@ -75,7 +73,6 @@ void win_close_win(void)
_curr_win = 0; _curr_win = 0;
touchwin(_wins[0].win); touchwin(_wins[0].win);
wrefresh(_wins[0].win); wrefresh(_wins[0].win);
title_bar_show("Console, type /help for help information"); title_bar_show("Console, type /help for help information");
} }
@ -207,19 +204,15 @@ static void _send_message_to_win(char *contact, char *line)
if (strcmp(_wins[i].from, "") == 0) if (strcmp(_wins[i].from, "") == 0)
break; break;
// set it up and use it // set it up
strcpy(_wins[i].from, contact); strcpy(_wins[i].from, contact);
wclear(_wins[i].win); wclear(_wins[i].win);
wprintw(_wins[i].win, line);
status_bar_active(i);
_refresh_if_current(i);
}
// otherwise, just use it
else {
wprintw(_wins[i].win, line);
status_bar_active(i);
_refresh_if_current(i);
} }
// send message to it
wprintw(_wins[i].win, line);
status_bar_active(i);
_refresh_if_current(i);
} }
static void _refresh_if_current(int i) static void _refresh_if_current(int i)