mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Added status bar refresh to main loop
This commit is contained in:
parent
bff2210b7f
commit
e112ef5aac
@ -25,10 +25,12 @@ int handle_start_command(char *cmd)
|
||||
user = strndup(cmd+9, strlen(cmd)-9);
|
||||
|
||||
status_bar_get_password();
|
||||
status_bar_refresh();
|
||||
char passwd[20];
|
||||
inp_get_password(passwd);
|
||||
|
||||
status_bar_print_message(user);
|
||||
status_bar_refresh();
|
||||
jabber_connect(user, passwd);
|
||||
result = START_MAIN;
|
||||
} else {
|
||||
|
@ -18,6 +18,7 @@ void profanity_start(void)
|
||||
char cmd[50];
|
||||
|
||||
while (cmd_result == AWAIT_COMMAND) {
|
||||
status_bar_refresh();
|
||||
inp_get_command_str(cmd);
|
||||
cmd_result = handle_start_command(cmd);
|
||||
}
|
||||
@ -51,7 +52,7 @@ static void _profanity_event_loop(int *ch, char *cmd, int *size)
|
||||
{
|
||||
usleep(1);
|
||||
|
||||
status_bar_update_time();
|
||||
status_bar_refresh();
|
||||
|
||||
// handle incoming messages
|
||||
jabber_process_events();
|
||||
|
31
status_bar.c
31
status_bar.c
@ -4,6 +4,8 @@
|
||||
|
||||
static WINDOW *status_bar;
|
||||
|
||||
static void _status_bar_update_time(void);
|
||||
|
||||
void create_status_bar(void)
|
||||
{
|
||||
int rows, cols;
|
||||
@ -14,34 +16,42 @@ void create_status_bar(void)
|
||||
wrefresh(status_bar);
|
||||
}
|
||||
|
||||
void status_bar_refresh(void)
|
||||
{
|
||||
_status_bar_update_time();
|
||||
touchwin(status_bar);
|
||||
wrefresh(status_bar);
|
||||
inp_put_back();
|
||||
}
|
||||
|
||||
void status_bar_inactive(int win)
|
||||
{
|
||||
mvwaddch(status_bar, 0, 30 + win, ' ');
|
||||
if (win == 9)
|
||||
mvwaddch(status_bar, 0, 30 + win + 1, ' ');
|
||||
wrefresh(status_bar);
|
||||
}
|
||||
|
||||
void status_bar_active(int win)
|
||||
{
|
||||
mvwprintw(status_bar, 0, 30 + win, "%d", win+1);
|
||||
touchwin(status_bar);
|
||||
wrefresh(status_bar);
|
||||
}
|
||||
|
||||
void status_bar_get_password(void)
|
||||
{
|
||||
mvwprintw(status_bar, 0, 1, "Enter password:");
|
||||
wrefresh(status_bar);
|
||||
mvwprintw(status_bar, 0, 9, "Enter password:");
|
||||
}
|
||||
|
||||
void status_bar_print_message(char *msg)
|
||||
{
|
||||
mvwprintw(status_bar, 0, 9, msg);
|
||||
wrefresh(status_bar);
|
||||
}
|
||||
|
||||
void status_bar_update_time(void)
|
||||
void status_bar_clear(void)
|
||||
{
|
||||
wclear(status_bar);
|
||||
}
|
||||
|
||||
static void _status_bar_update_time(void)
|
||||
{
|
||||
char bar_time[8];
|
||||
char tstmp[80];
|
||||
@ -49,12 +59,5 @@ void status_bar_update_time(void)
|
||||
sprintf(bar_time, "[%s]", tstmp);
|
||||
|
||||
mvwprintw(status_bar, 0, 1, bar_time);
|
||||
wrefresh(status_bar);
|
||||
inp_put_back();
|
||||
}
|
||||
|
||||
void status_bar_clear(void)
|
||||
{
|
||||
wclear(status_bar);
|
||||
wrefresh(status_bar);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user