mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Added gui_refresh
Refreshing all windows now done in main loop
This commit is contained in:
parent
6f90464619
commit
b79e61fd80
12
profanity.c
12
profanity.c
@ -53,24 +53,14 @@ static void _profanity_main(void)
|
|||||||
static void _profanity_event_loop(int *ch, char *cmd, int *size)
|
static void _profanity_event_loop(int *ch, char *cmd, int *size)
|
||||||
{
|
{
|
||||||
usleep(1);
|
usleep(1);
|
||||||
|
gui_refresh();
|
||||||
// refresh gui
|
|
||||||
title_bar_refresh();
|
|
||||||
status_bar_refresh();
|
|
||||||
|
|
||||||
// handle XMPP events
|
|
||||||
jabber_process_events();
|
jabber_process_events();
|
||||||
|
|
||||||
// deal with special keys
|
|
||||||
_process_special_keys(ch);
|
_process_special_keys(ch);
|
||||||
|
|
||||||
// try for another character on input
|
|
||||||
inp_poll_char(ch, cmd, size);
|
inp_poll_char(ch, cmd, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _process_special_keys(int *ch)
|
static void _process_special_keys(int *ch)
|
||||||
{
|
{
|
||||||
// change window
|
|
||||||
if (*ch == KEY_F(1)) {
|
if (*ch == KEY_F(1)) {
|
||||||
if (win_is_active(0))
|
if (win_is_active(0))
|
||||||
win_switch_to(0);
|
win_switch_to(0);
|
||||||
|
27
windows.c
27
windows.c
@ -8,7 +8,7 @@ static int _curr_win = 0;
|
|||||||
|
|
||||||
static void _create_windows(void);
|
static void _create_windows(void);
|
||||||
static void _send_message_to_win(char *contact, char *line);
|
static void _send_message_to_win(char *contact, char *line);
|
||||||
static void _refresh_if_current(int i);
|
static void _current_window_refresh();
|
||||||
|
|
||||||
void gui_init(void)
|
void gui_init(void)
|
||||||
{
|
{
|
||||||
@ -34,6 +34,14 @@ void gui_init(void)
|
|||||||
_create_windows();
|
_create_windows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gui_refresh(void)
|
||||||
|
{
|
||||||
|
title_bar_refresh();
|
||||||
|
status_bar_refresh();
|
||||||
|
_current_window_refresh();
|
||||||
|
inp_put_back();
|
||||||
|
}
|
||||||
|
|
||||||
void gui_close(void)
|
void gui_close(void)
|
||||||
{
|
{
|
||||||
endwin();
|
endwin();
|
||||||
@ -49,8 +57,6 @@ int win_is_active(int i)
|
|||||||
|
|
||||||
void win_switch_to(int i)
|
void win_switch_to(int i)
|
||||||
{
|
{
|
||||||
touchwin(_wins[i].win);
|
|
||||||
wrefresh(_wins[i].win);
|
|
||||||
_curr_win = i;
|
_curr_win = i;
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
@ -71,8 +77,6 @@ void win_close_win(void)
|
|||||||
|
|
||||||
// go back to console window
|
// go back to console window
|
||||||
_curr_win = 0;
|
_curr_win = 0;
|
||||||
touchwin(_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");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,8 +141,6 @@ void cons_help(void)
|
|||||||
" [%s] F1 : Console window.\n", tstmp);
|
" [%s] F1 : Console window.\n", tstmp);
|
||||||
wprintw(_wins[0].win,
|
wprintw(_wins[0].win,
|
||||||
" [%s] F2-10 : Chat windows.\n", tstmp);
|
" [%s] F2-10 : Chat windows.\n", tstmp);
|
||||||
|
|
||||||
_refresh_if_current(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cons_show(char *msg)
|
void cons_show(char *msg)
|
||||||
@ -147,7 +149,6 @@ void cons_show(char *msg)
|
|||||||
get_time(tstmp);
|
get_time(tstmp);
|
||||||
|
|
||||||
wprintw(_wins[0].win, " [%s] %s\n", tstmp, msg);
|
wprintw(_wins[0].win, " [%s] %s\n", tstmp, msg);
|
||||||
_refresh_if_current(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cons_bad_command(char *cmd)
|
void cons_bad_command(char *cmd)
|
||||||
@ -156,7 +157,6 @@ void cons_bad_command(char *cmd)
|
|||||||
get_time(tstmp);
|
get_time(tstmp);
|
||||||
|
|
||||||
wprintw(_wins[0].win, " [%s] Unknown command: %s\n", tstmp, cmd);
|
wprintw(_wins[0].win, " [%s] Unknown command: %s\n", tstmp, cmd);
|
||||||
_refresh_if_current(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _create_windows(void)
|
static void _create_windows(void)
|
||||||
@ -212,13 +212,10 @@ static void _send_message_to_win(char *contact, char *line)
|
|||||||
// send message to it
|
// send message to it
|
||||||
wprintw(_wins[i].win, line);
|
wprintw(_wins[i].win, line);
|
||||||
status_bar_active(i);
|
status_bar_active(i);
|
||||||
_refresh_if_current(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _refresh_if_current(int i)
|
static void _current_window_refresh()
|
||||||
{
|
{
|
||||||
if (_curr_win == i) {
|
touchwin(_wins[_curr_win].win);
|
||||||
touchwin(_wins[i].win);
|
wrefresh(_wins[_curr_win].win);
|
||||||
wrefresh(_wins[i].win);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user