From f94b679a4a97365de29bb99ede3b2bc5c44cd93f Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sun, 6 Jan 2008 12:44:54 +0100 Subject: Added hotlist option for buffer in plugins API, improved buffer refreshs --- src/gui/curses/gui-curses-main.c | 26 ++++++++++++++++++++++++-- src/gui/curses/gui-curses-status.c | 9 +++------ src/gui/curses/gui-curses-window.c | 25 +++++++++++-------------- src/gui/curses/gui-curses.h | 1 - 4 files changed, 38 insertions(+), 23 deletions(-) (limited to 'src/gui/curses') diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c index 22c04bf54..db3aa0a39 100644 --- a/src/gui/curses/gui-curses-main.c +++ b/src/gui/curses/gui-curses-main.c @@ -44,6 +44,7 @@ #include "../gui-input.h" #include "../gui-history.h" #include "../gui-nicklist.h" +#include "../gui-status.h" #include "../gui-window.h" #include "gui-curses.h" @@ -161,23 +162,44 @@ gui_main_loop () /* execute hook timers */ hook_timer_exec (); - /* refresh needed ? */ - if (gui_refresh_screen_needed) + /* refresh window if needed */ + if (gui_window_refresh_needed) gui_window_refresh_screen (0); + + /* refresh status bar if needed */ + if (gui_status_refresh_needed) + { + gui_status_draw (1); + gui_status_refresh_needed = 0; + } for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer) { + /* refresh title if needed */ + if (ptr_buffer->title_refresh_needed) + { + gui_chat_draw_title (ptr_buffer, 1); + ptr_buffer->title_refresh_needed = 0; + } + /* refresh chat if needed */ if (ptr_buffer->chat_refresh_needed) { gui_chat_draw (ptr_buffer, 0); ptr_buffer->chat_refresh_needed = 0; } + /* refresh nicklist if needed */ if (ptr_buffer->nicklist_refresh_needed) { gui_nicklist_draw (ptr_buffer, 0); ptr_buffer->nicklist_refresh_needed = 0; } + /* refresh input if needed */ + if (ptr_buffer->input_refresh_needed) + { + gui_input_draw (ptr_buffer, 1); + ptr_buffer->input_refresh_needed = 0; + } } /* wait for keyboard or network activity */ diff --git a/src/gui/curses/gui-curses-status.c b/src/gui/curses/gui-curses-status.c index b8b1596c5..495dfd943 100644 --- a/src/gui/curses/gui-curses-status.c +++ b/src/gui/curses/gui-curses-status.c @@ -40,11 +40,11 @@ /* - * gui_status_draw: draw status window for a buffer + * gui_status_draw: draw status window */ void -gui_status_draw (struct t_gui_buffer *buffer, int erase) +gui_status_draw (int erase) { struct t_gui_window *ptr_win; struct t_gui_hotlist *ptr_hotlist; @@ -52,9 +52,6 @@ gui_status_draw (struct t_gui_buffer *buffer, int erase) int x; int display_name, names_count; - /* make C compiler happy */ - (void) buffer; - if (!gui_ok) return; @@ -139,7 +136,7 @@ gui_status_draw (struct t_gui_buffer *buffer, int erase) GUI_COLOR_STATUS_DATA_OTHER); display_name = ((CONFIG_INTEGER(config_look_hotlist_names_level) & 1) != 0); break; - case GUI_HOTLIST_MSG: + case GUI_HOTLIST_MESSAGE: gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, GUI_COLOR_STATUS_DATA_MSG); display_name = ((CONFIG_INTEGER(config_look_hotlist_names_level) & 2) != 0); diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c index a78009bfb..951de91db 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -46,9 +46,6 @@ #include "gui-curses.h" -int gui_refresh_screen_needed = 0; - - /* * gui_window_get_width: get screen width (terminal width in chars for Curses) */ @@ -444,7 +441,7 @@ gui_window_redraw_buffer (struct t_gui_buffer *buffer) gui_chat_draw (buffer, 1); if (GUI_CURSES(ptr_win)->win_nick) gui_nicklist_draw (buffer, 1); - gui_status_draw (buffer, 1); + gui_status_draw (1); if (CONFIG_BOOLEAN(config_look_infobar)) gui_infobar_draw (buffer, 1); gui_input_draw (buffer, 1); @@ -576,7 +573,7 @@ gui_window_page_up (struct t_gui_window *window) window->start_line = NULL; window->start_line_pos = 0; } - gui_status_draw (window->buffer, 1); + gui_status_refresh_needed = 1; } } @@ -618,7 +615,7 @@ gui_window_page_down (struct t_gui_window *window) window->start_line_pos = 0; gui_hotlist_remove_buffer (window->buffer); } - gui_status_draw (window->buffer, 1); + gui_status_refresh_needed = 1; } } @@ -646,7 +643,7 @@ gui_window_scroll_up (struct t_gui_window *window) window->start_line = NULL; window->start_line_pos = 0; } - gui_status_draw (window->buffer, 1); + gui_status_refresh_needed = 1; } } @@ -689,7 +686,7 @@ gui_window_scroll_down (struct t_gui_window *window) window->start_line_pos = 0; gui_hotlist_remove_buffer (window->buffer); } - gui_status_draw (window->buffer, 1); + gui_status_refresh_needed = 1; } } @@ -713,7 +710,7 @@ gui_window_scroll_top (struct t_gui_window *window) window->start_line = NULL; window->start_line_pos = 0; } - gui_status_draw (window->buffer, 1); + gui_status_refresh_needed = 1; } } @@ -738,7 +735,7 @@ gui_window_scroll_bottom (struct t_gui_window *window) window->start_line_pos = 0; gui_hotlist_remove_buffer (window->buffer); } - gui_status_draw (window->buffer, 1); + gui_status_refresh_needed = 1; } } @@ -1308,7 +1305,7 @@ gui_window_refresh_screen (int force) { int new_height, new_width; - if (force || (gui_refresh_screen_needed == 1)) + if (force || (gui_window_refresh_needed == 1)) { endwin (); refresh (); @@ -1324,8 +1321,8 @@ gui_window_refresh_screen (int force) } } - if (!force && (gui_refresh_screen_needed > 0)) - gui_refresh_screen_needed--; + if (!force && (gui_window_refresh_needed > 0)) + gui_window_refresh_needed--; } /* @@ -1335,7 +1332,7 @@ gui_window_refresh_screen (int force) void gui_window_refresh_screen_sigwinch () { - gui_refresh_screen_needed = 1; + gui_window_refresh_needed = 1; //gui_window_refresh_screen (0); signal (SIGWINCH, &gui_window_refresh_screen_sigwinch); } diff --git a/src/gui/curses/gui-curses.h b/src/gui/curses/gui-curses.h index 7122877f8..2dc52e34c 100644 --- a/src/gui/curses/gui-curses.h +++ b/src/gui/curses/gui-curses.h @@ -47,7 +47,6 @@ struct t_gui_curses_objects }; extern struct t_gui_color gui_weechat_colors[]; -extern int gui_refresh_screen_needed; /* color functions */ extern int gui_color_get_pair (int num_color); -- cgit v1.2.3