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

Added blinking notifications

When something happens in the a active window,
the status bar shows a blinking notification.

Moving to the window stops the blinking.
This commit is contained in:
James Booth 2012-04-19 23:32:44 +01:00
parent 4f454b6a64
commit 6ab1a84c65
3 changed files with 34 additions and 8 deletions

View File

@ -96,6 +96,23 @@ void status_bar_active(const int win)
dirty = TRUE;
}
void status_bar_new(const int win)
{
int active_pos = 1 + ((win -1) * 3);
int rows, cols;
getmaxyx(stdscr, rows, cols);
wattron(status_bar, A_BLINK);
if (win < 9)
mvwprintw(status_bar, 0, cols - 29 + active_pos, "%d", win+1);
else
mvwprintw(status_bar, 0, cols - 29 + active_pos, "10");
wattroff(status_bar, A_BLINK);
dirty = TRUE;
}
void status_bar_get_password(void)
{
mvwprintw(status_bar, 0, 9, "Enter password:");

View File

@ -159,11 +159,14 @@ void win_show_incomming_msg(const char * const from, const char * const message)
_win_show_user(win, short_from, 1);
_win_show_message(win, message);
status_bar_active(win_index);
_cons_show_incoming_message(short_from, win_index);
if (win_index == _curr_prof_win)
if (win_index == _curr_prof_win) {
status_bar_active(win_index);
dirty = TRUE;
} else {
status_bar_new(win_index);
_cons_show_incoming_message(short_from, win_index);
}
}
void win_show_outgoing_msg(const char * const from, const char * const to,
@ -180,8 +183,11 @@ void win_show_outgoing_msg(const char * const from, const char * const to,
status_bar_active(win_index);
if (win_index == _curr_prof_win)
if (win_index == _curr_prof_win) {
dirty = TRUE;
} else {
status_bar_new(win_index);
}
}
void win_contact_online(const char * const from, const char * const show,
@ -425,10 +431,12 @@ static void _win_switch_if_active(const int i)
_curr_prof_win = i;
win_page_off();
if (i == 0)
if (i == 0) {
title_bar_title();
else
} else {
title_bar_show(_wins[i].from);
status_bar_active(i);
}
}
dirty = TRUE;

View File

@ -84,6 +84,7 @@ void status_bar_get_password(void);
void status_bar_print_message(const char * const msg);
void status_bar_inactive(const int win);
void status_bar_active(const int win);
void status_bar_new(const int win);
void status_bar_update_time(void);
// input window actions