mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Refactor marking windows as dirty and status bar new indicator
This commit is contained in:
parent
9a59631cbc
commit
9373f41fa4
209
src/ui/console.c
209
src/ui/console.c
@ -40,46 +40,31 @@
|
|||||||
#define CONS_WIN_TITLE "_cons"
|
#define CONS_WIN_TITLE "_cons"
|
||||||
|
|
||||||
static ProfWin* console;
|
static ProfWin* console;
|
||||||
static int dirty;
|
|
||||||
|
|
||||||
static void _cons_splash_logo(void);
|
static void _cons_splash_logo(void);
|
||||||
static void _cons_show_basic_help(void);
|
static void _cons_show_basic_help(void);
|
||||||
|
static void _cons_alert(void);
|
||||||
|
|
||||||
ProfWin *
|
ProfWin *
|
||||||
cons_create(void)
|
cons_create(void)
|
||||||
{
|
{
|
||||||
int cols = getmaxx(stdscr);
|
int cols = getmaxx(stdscr);
|
||||||
console = win_create(CONS_WIN_TITLE, cols, WIN_CONSOLE);
|
console = win_create(CONS_WIN_TITLE, cols, WIN_CONSOLE);
|
||||||
dirty = FALSE;
|
|
||||||
return console;
|
return console;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
cons_refresh(void)
|
|
||||||
{
|
|
||||||
int rows, cols;
|
|
||||||
if (dirty == TRUE) {
|
|
||||||
getmaxyx(stdscr, rows, cols);
|
|
||||||
prefresh(console->win, console->y_pos, 0, 1, 0, rows-3, cols-1);
|
|
||||||
dirty = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cons_show_time(void)
|
cons_show_time(void)
|
||||||
{
|
{
|
||||||
win_print_time(console, '-');
|
win_print_time(console, '-');
|
||||||
|
ui_console_dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cons_show_word(const char * const word)
|
cons_show_word(const char * const word)
|
||||||
{
|
{
|
||||||
wprintw(console->win, "%s", word);
|
wprintw(console->win, "%s", word);
|
||||||
|
ui_console_dirty();
|
||||||
dirty = TRUE;
|
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -95,10 +80,8 @@ cons_debug(const char * const msg, ...)
|
|||||||
g_string_free(fmt_msg, TRUE);
|
g_string_free(fmt_msg, TRUE);
|
||||||
va_end(arg);
|
va_end(arg);
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_current_page_off();
|
ui_current_page_off();
|
||||||
ui_refresh();
|
ui_refresh();
|
||||||
@ -116,8 +99,7 @@ cons_show(const char * const msg, ...)
|
|||||||
wprintw(console->win, "%s\n", fmt_msg->str);
|
wprintw(console->win, "%s\n", fmt_msg->str);
|
||||||
g_string_free(fmt_msg, TRUE);
|
g_string_free(fmt_msg, TRUE);
|
||||||
va_end(arg);
|
va_end(arg);
|
||||||
|
ui_console_dirty();
|
||||||
dirty = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -134,10 +116,8 @@ cons_show_error(const char * const msg, ...)
|
|||||||
g_string_free(fmt_msg, TRUE);
|
g_string_free(fmt_msg, TRUE);
|
||||||
va_end(arg);
|
va_end(arg);
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -147,6 +127,9 @@ cons_show_typing(const char * const short_from)
|
|||||||
wattron(console->win, COLOUR_TYPING);
|
wattron(console->win, COLOUR_TYPING);
|
||||||
wprintw(console->win, "!! %s is typing a message...\n", short_from);
|
wprintw(console->win, "!! %s is typing a message...\n", short_from);
|
||||||
wattroff(console->win, COLOUR_TYPING);
|
wattroff(console->win, COLOUR_TYPING);
|
||||||
|
|
||||||
|
ui_console_dirty();
|
||||||
|
_cons_alert();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -156,6 +139,9 @@ cons_show_incoming_message(const char * const short_from, const int win_index)
|
|||||||
wattron(console->win, COLOUR_INCOMING);
|
wattron(console->win, COLOUR_INCOMING);
|
||||||
wprintw(console->win, "<< incoming from %s (%d)\n", short_from, win_index + 1);
|
wprintw(console->win, "<< incoming from %s (%d)\n", short_from, win_index + 1);
|
||||||
wattroff(console->win, COLOUR_INCOMING);
|
wattroff(console->win, COLOUR_INCOMING);
|
||||||
|
|
||||||
|
ui_console_dirty();
|
||||||
|
_cons_alert();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -199,10 +185,8 @@ cons_about(void)
|
|||||||
|
|
||||||
prefresh(console->win, 0, 0, 1, 0, rows-3, cols-1);
|
prefresh(console->win, 0, 0, 1, 0, rows-3, cols-1);
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -229,10 +213,8 @@ cons_check_version(gboolean not_available_msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,6 +234,8 @@ cons_show_login_success(ProfAccount *account)
|
|||||||
wprintw(console->win, " (priority %d)",
|
wprintw(console->win, " (priority %d)",
|
||||||
accounts_get_priority_for_presence_type(account->name, presence));
|
accounts_get_priority_for_presence_type(account->name, presence));
|
||||||
wprintw(console->win, ".\n");
|
wprintw(console->win, ".\n");
|
||||||
|
ui_console_dirty();
|
||||||
|
_cons_alert();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -324,10 +308,8 @@ cons_show_wins(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cons_show("");
|
cons_show("");
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -458,10 +440,8 @@ cons_show_info(PContact pcontact)
|
|||||||
ordered_resources = g_list_next(ordered_resources);
|
ordered_resources = g_list_next(ordered_resources);
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -534,10 +514,8 @@ cons_show_caps(const char * const contact, Resource *resource)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -562,10 +540,8 @@ cons_show_software_version(const char * const jid, const char * const presence,
|
|||||||
cons_show("OS : %s", os);
|
cons_show("OS : %s", os);
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -587,10 +563,8 @@ cons_show_room_list(GSList *rooms, const char * const conference_node)
|
|||||||
cons_show("No chat rooms at %s", conference_node);
|
cons_show("No chat rooms at %s", conference_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -631,10 +605,8 @@ cons_show_disco_info(const char *jid, GSList *identities, GSList *features)
|
|||||||
features = g_slist_next(features);
|
features = g_slist_next(features);
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -658,10 +630,8 @@ cons_show_disco_items(GSList *items, const char * const jid)
|
|||||||
cons_show("");
|
cons_show("");
|
||||||
cons_show("No service discovery items for %s", jid);
|
cons_show("No service discovery items for %s", jid);
|
||||||
}
|
}
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -674,6 +644,8 @@ cons_show_status(const char * const contact)
|
|||||||
} else {
|
} else {
|
||||||
cons_show("No such contact \"%s\" in roster.", contact);
|
cons_show("No such contact \"%s\" in roster.", contact);
|
||||||
}
|
}
|
||||||
|
ui_console_dirty();
|
||||||
|
_cons_alert();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -706,10 +678,8 @@ cons_show_room_invite(const char * const invitor, const char * const room,
|
|||||||
jid_destroy(room_jid);
|
jid_destroy(room_jid);
|
||||||
g_string_free(default_service, TRUE);
|
g_string_free(default_service, TRUE);
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -737,10 +707,8 @@ cons_show_account_list(gchar **accounts)
|
|||||||
cons_show("");
|
cons_show("");
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -852,10 +820,8 @@ cons_show_account(ProfAccount *account)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -911,10 +877,8 @@ cons_show_ui_prefs(void)
|
|||||||
else
|
else
|
||||||
cons_show("Status (/statuses) : OFF");
|
cons_show("Status (/statuses) : OFF");
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -941,6 +905,9 @@ cons_show_desktop_prefs(void)
|
|||||||
} else {
|
} else {
|
||||||
cons_show("Reminder period (/notify remind) : %d seconds", remind_period);
|
cons_show("Reminder period (/notify remind) : %d seconds", remind_period);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui_console_dirty();
|
||||||
|
_cons_alert();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -968,10 +935,8 @@ cons_show_chat_prefs(void)
|
|||||||
cons_show("Leave conversation (/gone) : %d minutes", gone_time);
|
cons_show("Leave conversation (/gone) : %d minutes", gone_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -987,10 +952,8 @@ cons_show_log_prefs(void)
|
|||||||
else
|
else
|
||||||
cons_show("Chat logging (/chlog) : OFF");
|
cons_show("Chat logging (/chlog) : OFF");
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1020,10 +983,8 @@ cons_show_presence_prefs(void)
|
|||||||
cons_show("Autoaway check (/autoaway check) : OFF");
|
cons_show("Autoaway check (/autoaway check) : OFF");
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1050,10 +1011,8 @@ cons_show_connection_prefs(void)
|
|||||||
cons_show("Autoping interval (/autoping) : %d seconds", autoping_interval);
|
cons_show("Autoping interval (/autoping) : %d seconds", autoping_interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1071,10 +1030,8 @@ cons_show_themes(GSList *themes)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1094,10 +1051,8 @@ cons_prefs(void)
|
|||||||
cons_show_connection_prefs();
|
cons_show_connection_prefs();
|
||||||
cons_show("");
|
cons_show("");
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1114,10 +1069,8 @@ cons_help(void)
|
|||||||
cons_show("/help [command] - Detailed help on a specific command.");
|
cons_show("/help [command] - Detailed help on a specific command.");
|
||||||
cons_show("");
|
cons_show("");
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1127,10 +1080,8 @@ cons_basic_help(void)
|
|||||||
cons_show("Basic Commands:");
|
cons_show("Basic Commands:");
|
||||||
_cons_show_basic_help();
|
_cons_show_basic_help();
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1149,10 +1100,8 @@ cons_settings_help(void)
|
|||||||
|
|
||||||
cons_show("");
|
cons_show("");
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1171,10 +1120,8 @@ cons_presence_help(void)
|
|||||||
|
|
||||||
cons_show("");
|
cons_show("");
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1194,10 +1141,8 @@ cons_navigation_help(void)
|
|||||||
cons_show("PAGE UP, PAGE DOWN : Page the main window.");
|
cons_show("PAGE UP, PAGE DOWN : Page the main window.");
|
||||||
cons_show("");
|
cons_show("");
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1213,10 +1158,8 @@ cons_show_contacts(GSList *list)
|
|||||||
curr = g_slist_next(curr);
|
curr = g_slist_next(curr);
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty = TRUE;
|
ui_console_dirty();
|
||||||
if (ui_current_win_type() != WIN_CONSOLE) {
|
_cons_alert();
|
||||||
status_bar_new(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1283,5 +1226,15 @@ _cons_show_basic_help(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cons_show("");
|
cons_show("");
|
||||||
|
ui_console_dirty();
|
||||||
|
_cons_alert();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cons_alert(void)
|
||||||
|
{
|
||||||
|
if (ui_current_win_type() != WIN_CONSOLE) {
|
||||||
|
status_bar_new(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ static ProfWin *current;
|
|||||||
static ProfWin *console;
|
static ProfWin *console;
|
||||||
|
|
||||||
// current window state
|
// current window state
|
||||||
static int dirty;
|
static gboolean current_win_dirty;
|
||||||
|
|
||||||
// max columns for main windows, never resize below
|
// max columns for main windows, never resize below
|
||||||
static int max_cols = 0;
|
static int max_cols = 0;
|
||||||
@ -112,7 +112,7 @@ ui_init(void)
|
|||||||
display = XOpenDisplay(0);
|
display = XOpenDisplay(0);
|
||||||
#endif
|
#endif
|
||||||
ui_idle_time = g_timer_new();
|
ui_idle_time = g_timer_new();
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -122,16 +122,23 @@ ui_refresh(void)
|
|||||||
|
|
||||||
title_bar_refresh();
|
title_bar_refresh();
|
||||||
status_bar_refresh();
|
status_bar_refresh();
|
||||||
cons_refresh();
|
|
||||||
|
|
||||||
if (dirty) {
|
if (current_win_dirty) {
|
||||||
_current_window_refresh();
|
_current_window_refresh();
|
||||||
dirty = FALSE;
|
current_win_dirty = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
inp_put_back();
|
inp_put_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ui_console_dirty(void)
|
||||||
|
{
|
||||||
|
if (ui_current_win_type() == WIN_CONSOLE) {
|
||||||
|
current_win_dirty = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsigned long
|
unsigned long
|
||||||
ui_get_idle_time(void)
|
ui_get_idle_time(void)
|
||||||
{
|
{
|
||||||
@ -172,7 +179,7 @@ ui_resize(const int ch, const char * const input, const int size)
|
|||||||
status_bar_resize();
|
status_bar_resize();
|
||||||
_win_resize_all();
|
_win_resize_all();
|
||||||
inp_win_resize(input, size);
|
inp_win_resize(input, size);
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -211,7 +218,7 @@ ui_contact_typing(const char * const from)
|
|||||||
// have chat window but not currently in it
|
// have chat window but not currently in it
|
||||||
} else if (win_index != current_index) {
|
} else if (win_index != current_index) {
|
||||||
cons_show_typing(from);
|
cons_show_typing(from);
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
|
|
||||||
// in chat window with user
|
// in chat window with user
|
||||||
} else {
|
} else {
|
||||||
@ -219,7 +226,7 @@ ui_contact_typing(const char * const from)
|
|||||||
title_bar_draw();
|
title_bar_draw();
|
||||||
|
|
||||||
status_bar_active(win_index);
|
status_bar_active(win_index);
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,7 +306,7 @@ ui_incoming_msg(const char * const from, const char * const message,
|
|||||||
cons_show("Windows all used, close a window to respond.");
|
cons_show("Windows all used, close a window to respond.");
|
||||||
|
|
||||||
if (current_index == 0) {
|
if (current_index == 0) {
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
} else {
|
} else {
|
||||||
status_bar_new(0);
|
status_bar_new(0);
|
||||||
}
|
}
|
||||||
@ -335,7 +342,7 @@ ui_incoming_msg(const char * const from, const char * const message,
|
|||||||
title_bar_set_typing(FALSE);
|
title_bar_set_typing(FALSE);
|
||||||
title_bar_draw();
|
title_bar_draw();
|
||||||
status_bar_active(win_index);
|
status_bar_active(win_index);
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
|
|
||||||
// not currently viewing chat window with sender
|
// not currently viewing chat window with sender
|
||||||
} else {
|
} else {
|
||||||
@ -408,7 +415,7 @@ ui_contact_online(const char * const barejid, const char * const resource,
|
|||||||
jid_destroy(jid);
|
jid_destroy(jid);
|
||||||
|
|
||||||
if (win_index == current_index)
|
if (win_index == current_index)
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -433,7 +440,7 @@ ui_contact_offline(const char * const from, const char * const show,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (win_index == current_index)
|
if (win_index == current_index)
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -449,9 +456,9 @@ ui_disconnected(void)
|
|||||||
wprintw(window->win, "%s\n", "Lost connection.");
|
wprintw(window->win, "%s\n", "Lost connection.");
|
||||||
wattroff(window->win, COLOUR_ERROR);
|
wattroff(window->win, COLOUR_ERROR);
|
||||||
|
|
||||||
// if current win, set dirty
|
// if current win, set current_win_dirty
|
||||||
if (i == current_index) {
|
if (i == current_index) {
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -494,14 +501,14 @@ ui_switch_win(const int i)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ui_clear_current(void)
|
ui_clear_current(void)
|
||||||
{
|
{
|
||||||
werase(current->win);
|
werase(current->win);
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -518,7 +525,7 @@ ui_close_current(void)
|
|||||||
status_bar_active(0);
|
status_bar_active(0);
|
||||||
title_bar_title();
|
title_bar_title();
|
||||||
|
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
win_type_t
|
win_type_t
|
||||||
@ -545,7 +552,7 @@ ui_current_print_line(const char * const msg, ...)
|
|||||||
g_string_free(fmt_msg, TRUE);
|
g_string_free(fmt_msg, TRUE);
|
||||||
va_end(arg);
|
va_end(arg);
|
||||||
|
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -556,7 +563,7 @@ ui_current_error_line(const char * const msg)
|
|||||||
wprintw(current->win, "%s\n", msg);
|
wprintw(current->win, "%s\n", msg);
|
||||||
wattroff(current->win, COLOUR_ERROR);
|
wattroff(current->win, COLOUR_ERROR);
|
||||||
|
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -575,7 +582,7 @@ ui_current_page_off(void)
|
|||||||
if (window->y_pos < 0)
|
if (window->y_pos < 0)
|
||||||
window->y_pos = 0;
|
window->y_pos = 0;
|
||||||
|
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -594,7 +601,7 @@ ui_print_error_from_recipient(const char * const from, const char *err_msg)
|
|||||||
win_print_time(window, '-');
|
win_print_time(window, '-');
|
||||||
_win_show_error_msg(window->win, err_msg);
|
_win_show_error_msg(window->win, err_msg);
|
||||||
if (win_index == current_index) {
|
if (win_index == current_index) {
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -617,7 +624,7 @@ ui_print_system_msg_from_recipient(const char * const from, const char *message)
|
|||||||
if (win_index == NUM_WINS) {
|
if (win_index == NUM_WINS) {
|
||||||
win_index = _new_prof_win(bare_jid, WIN_CHAT);
|
win_index = _new_prof_win(bare_jid, WIN_CHAT);
|
||||||
status_bar_active(win_index);
|
status_bar_active(win_index);
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
window = windows[win_index];
|
window = windows[win_index];
|
||||||
|
|
||||||
@ -626,7 +633,7 @@ ui_print_system_msg_from_recipient(const char * const from, const char *message)
|
|||||||
|
|
||||||
// this is the current window
|
// this is the current window
|
||||||
if (win_index == current_index) {
|
if (win_index == current_index) {
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -650,7 +657,7 @@ ui_recipient_gone(const char * const from)
|
|||||||
wprintw(window->win, "\n");
|
wprintw(window->win, "\n");
|
||||||
wattroff(window->win, COLOUR_GONE);
|
wattroff(window->win, COLOUR_GONE);
|
||||||
if (win_index == current_index) {
|
if (win_index == current_index) {
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -810,7 +817,7 @@ ui_room_roster(const char * const room, GList *roster, const char * const presen
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (win_index == current_index)
|
if (win_index == current_index)
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -825,7 +832,7 @@ ui_room_member_offline(const char * const room, const char * const nick)
|
|||||||
wattroff(window->win, COLOUR_OFFLINE);
|
wattroff(window->win, COLOUR_OFFLINE);
|
||||||
|
|
||||||
if (win_index == current_index)
|
if (win_index == current_index)
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -841,7 +848,7 @@ ui_room_member_online(const char * const room, const char * const nick,
|
|||||||
wattroff(window->win, COLOUR_ONLINE);
|
wattroff(window->win, COLOUR_ONLINE);
|
||||||
|
|
||||||
if (win_index == current_index)
|
if (win_index == current_index)
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -855,7 +862,7 @@ ui_room_member_presence(const char * const room, const char * const nick,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (win_index == current_index)
|
if (win_index == current_index)
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -871,7 +878,7 @@ ui_room_member_nick_change(const char * const room,
|
|||||||
wattroff(window->win, COLOUR_THEM);
|
wattroff(window->win, COLOUR_THEM);
|
||||||
|
|
||||||
if (win_index == current_index)
|
if (win_index == current_index)
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -886,7 +893,7 @@ ui_room_nick_change(const char * const room, const char * const nick)
|
|||||||
wattroff(window->win, COLOUR_ME);
|
wattroff(window->win, COLOUR_ME);
|
||||||
|
|
||||||
if (win_index == current_index)
|
if (win_index == current_index)
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -912,7 +919,7 @@ ui_room_history(const char * const room_jid, const char * const nick,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (win_index == current_index)
|
if (win_index == current_index)
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -951,14 +958,14 @@ ui_room_message(const char * const room_jid, const char * const nick,
|
|||||||
// currently in groupchat window
|
// currently in groupchat window
|
||||||
if (win_index == current_index) {
|
if (win_index == current_index) {
|
||||||
status_bar_active(win_index);
|
status_bar_active(win_index);
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
|
|
||||||
// not currenlty on groupchat window
|
// not currenlty on groupchat window
|
||||||
} else {
|
} else {
|
||||||
status_bar_new(win_index);
|
status_bar_new(win_index);
|
||||||
cons_show_incoming_message(nick, win_index);
|
cons_show_incoming_message(nick, win_index);
|
||||||
if (current_index == 0) {
|
if (current_index == 0) {
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(nick, muc_get_room_nick(room_jid)) != 0) {
|
if (strcmp(nick, muc_get_room_nick(room_jid)) != 0) {
|
||||||
@ -995,7 +1002,7 @@ ui_room_subject(const char * const room_jid, const char * const subject)
|
|||||||
// currently in groupchat window
|
// currently in groupchat window
|
||||||
if (win_index == current_index) {
|
if (win_index == current_index) {
|
||||||
status_bar_active(win_index);
|
status_bar_active(win_index);
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
|
|
||||||
// not currenlty on groupchat window
|
// not currenlty on groupchat window
|
||||||
} else {
|
} else {
|
||||||
@ -1018,7 +1025,7 @@ ui_room_broadcast(const char * const room_jid, const char * const message)
|
|||||||
// currently in groupchat window
|
// currently in groupchat window
|
||||||
if (win_index == current_index) {
|
if (win_index == current_index) {
|
||||||
status_bar_active(win_index);
|
status_bar_active(win_index);
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
|
|
||||||
// not currenlty on groupchat window
|
// not currenlty on groupchat window
|
||||||
} else {
|
} else {
|
||||||
@ -1355,7 +1362,7 @@ _win_handle_page(const wint_t * const ch)
|
|||||||
*page_start = y - page_space;
|
*page_start = y - page_space;
|
||||||
|
|
||||||
current->paged = 1;
|
current->paged = 1;
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
} else if (mouse_event.bstate & BUTTON4_PRESSED) { // mouse wheel up
|
} else if (mouse_event.bstate & BUTTON4_PRESSED) { // mouse wheel up
|
||||||
*page_start -= 4;
|
*page_start -= 4;
|
||||||
|
|
||||||
@ -1364,7 +1371,7 @@ _win_handle_page(const wint_t * const ch)
|
|||||||
*page_start = 0;
|
*page_start = 0;
|
||||||
|
|
||||||
current->paged = 1;
|
current->paged = 1;
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1379,7 +1386,7 @@ _win_handle_page(const wint_t * const ch)
|
|||||||
*page_start = 0;
|
*page_start = 0;
|
||||||
|
|
||||||
current->paged = 1;
|
current->paged = 1;
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
|
|
||||||
// page down
|
// page down
|
||||||
} else if (*ch == KEY_NPAGE) {
|
} else if (*ch == KEY_NPAGE) {
|
||||||
@ -1394,7 +1401,7 @@ _win_handle_page(const wint_t * const ch)
|
|||||||
*page_start = y - page_space;
|
*page_start = y - page_space;
|
||||||
|
|
||||||
current->paged = 1;
|
current->paged = 1;
|
||||||
dirty = TRUE;
|
current_win_dirty = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ void ui_new_chat_win(const char * const to);
|
|||||||
void ui_print_error_from_recipient(const char * const from, const char *err_msg);
|
void ui_print_error_from_recipient(const char * const from, const char *err_msg);
|
||||||
void ui_print_system_msg_from_recipient(const char * const from, const char *message);
|
void ui_print_system_msg_from_recipient(const char * const from, const char *message);
|
||||||
gint ui_unread(void);
|
gint ui_unread(void);
|
||||||
|
void ui_console_dirty(void);
|
||||||
|
|
||||||
// current window actions
|
// current window actions
|
||||||
void ui_close_current(void);
|
void ui_close_current(void);
|
||||||
@ -126,7 +127,6 @@ void title_bar_draw(void);
|
|||||||
|
|
||||||
// console window actions
|
// console window actions
|
||||||
ProfWin* cons_create(void);
|
ProfWin* cons_create(void);
|
||||||
void cons_refresh(void);
|
|
||||||
void cons_show(const char * const msg, ...);
|
void cons_show(const char * const msg, ...);
|
||||||
void cons_about(void);
|
void cons_about(void);
|
||||||
void cons_help(void);
|
void cons_help(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user