diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2009-01-25 09:03:53 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2009-01-25 09:03:53 +0100 |
commit | f6ebe7a9911f0b490d1a1e2a960cc37c59196870 (patch) | |
tree | a5f5fa921d28cc85281d0ab29453d5d52a8a096e /src/gui/curses | |
parent | 6e76c45447469652cc5887375e3db10bd3a0d056 (diff) | |
download | weechat-f6ebe7a9911f0b490d1a1e2a960cc37c59196870.zip |
Improve refreshs of windows/buffers/bars, fix refresh bug when some bars are hidden
Diffstat (limited to 'src/gui/curses')
-rw-r--r-- | src/gui/curses/gui-curses-bar-window.c | 8 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-main.c | 58 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-window.c | 58 |
3 files changed, 53 insertions, 71 deletions
diff --git a/src/gui/curses/gui-curses-bar-window.c b/src/gui/curses/gui-curses-bar-window.c index 072b0c150..a874f0122 100644 --- a/src/gui/curses/gui-curses-bar-window.c +++ b/src/gui/curses/gui-curses-bar-window.c @@ -384,7 +384,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, if (items_count == 0) { if (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_SIZE]) == 0) - gui_bar_window_set_current_size (bar_window->bar, 1); + gui_bar_window_set_current_size (bar_window, window, 1); gui_window_clear (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG])); } @@ -426,12 +426,12 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, num_lines = optimal_number_of_lines; else num_lines = items_count; - gui_bar_window_set_current_size (bar_window->bar, + gui_bar_window_set_current_size (bar_window, window, num_lines); break; case GUI_BAR_POSITION_LEFT: case GUI_BAR_POSITION_RIGHT: - gui_bar_window_set_current_size (bar_window->bar, + gui_bar_window_set_current_size (bar_window, window, max_length); break; case GUI_BAR_NUM_POSITIONS: @@ -558,7 +558,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window, else { if (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_SIZE]) == 0) - gui_bar_window_set_current_size (bar_window->bar, 1); + gui_bar_window_set_current_size (bar_window, window, 1); gui_window_clear (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar, CONFIG_COLOR(bar_window->bar->options[GUI_BAR_OPTION_COLOR_BG])); } diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c index 615b45678..843ae66e4 100644 --- a/src/gui/curses/gui-curses-main.c +++ b/src/gui/curses/gui-curses-main.c @@ -256,41 +256,41 @@ gui_main_loop () gui_window_refresh_screen (); gui_window_refresh_needed = 0; } - else + + /* refresh bars if needed */ + for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) { - /* refresh bars if needed */ - for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) - { - if (ptr_bar->bar_refresh_needed) - gui_bar_draw (ptr_bar); - } - - for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) + if (ptr_bar->bar_refresh_needed) + gui_bar_draw (ptr_bar); + } + + for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) + { + if (ptr_win->refresh_needed) { - if (ptr_win->refresh_needed) - { - gui_window_switch_to_buffer (ptr_win, ptr_win->buffer, 0); - gui_window_redraw_buffer (ptr_win->buffer); - ptr_win->refresh_needed = 0; - } + gui_window_switch_to_buffer (ptr_win, ptr_win->buffer, 0); + gui_window_redraw_buffer (ptr_win->buffer); + ptr_win->refresh_needed = 0; } - - for (ptr_buffer = gui_buffers; ptr_buffer; - ptr_buffer = ptr_buffer->next_buffer) + } + + for (ptr_buffer = gui_buffers; ptr_buffer; + ptr_buffer = ptr_buffer->next_buffer) + { + /* refresh chat if needed */ + if (ptr_buffer->chat_refresh_needed) { - /* refresh chat if needed */ - if (ptr_buffer->chat_refresh_needed) - { - gui_chat_draw (ptr_buffer, - (ptr_buffer->chat_refresh_needed) > 1 ? 1 : 0); - } + gui_chat_draw (ptr_buffer, + (ptr_buffer->chat_refresh_needed) > 1 ? 1 : 0); } - - /* refresh bars if needed */ - for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) + } + + /* refresh bars if needed */ + for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) + { + if (ptr_bar->bar_refresh_needed) { - if (ptr_bar->bar_refresh_needed) - gui_bar_draw (ptr_bar); + gui_bar_draw (ptr_bar); } } diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c index e125fb121..5daf5b7ff 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -477,24 +477,26 @@ gui_window_switch_to_buffer (struct t_gui_window *window, } window->buffer = buffer; + buffer->num_displayed++; - if (gui_ok && (old_buffer == buffer)) - { - gui_bar_window_remove_unused_bars (window); - gui_bar_window_add_missing_bars (window); - } - - gui_window_calculate_pos_size (window); + gui_hotlist_remove_buffer (buffer); if (gui_ok) { + gui_bar_window_remove_unused_bars (window); + gui_bar_window_add_missing_bars (window); + /* create bar windows */ for (ptr_bar_window = window->bar_windows; ptr_bar_window; ptr_bar_window = ptr_bar_window->next_bar_window) { + gui_bar_window_content_build (ptr_bar_window, window); + gui_bar_window_calculate_pos_size (ptr_bar_window, window); gui_bar_window_create_win (ptr_bar_window); } + gui_window_calculate_pos_size (window); + /* destroy Curses windows */ gui_window_objects_free (window, 0); @@ -505,34 +507,21 @@ gui_window_switch_to_buffer (struct t_gui_window *window, window->win_chat_width, window->win_chat_y, window->win_chat_x); + gui_buffer_ask_chat_refresh (window->buffer, 2); } - buffer->num_displayed++; - - gui_hotlist_remove_buffer (buffer); - - if (gui_ok && (buffer != old_buffer)) + if (window->buffer->type == GUI_BUFFER_TYPE_FREE) { - gui_bar_window_remove_unused_bars (window); - gui_bar_window_add_missing_bars (window); + window->scroll = 0; + window->scroll_lines_after = 0; } - /* redraw bars in window */ for (ptr_bar_window = window->bar_windows; ptr_bar_window; ptr_bar_window = ptr_bar_window->next_bar_window) { - gui_bar_window_content_build (ptr_bar_window, window); ptr_bar_window->bar->bar_refresh_needed = 1; } - if (window->buffer->type == GUI_BUFFER_TYPE_FREE) - { - window->scroll = 0; - window->scroll_lines_after = 0; - } - - window->refresh_needed = 1; - hook_signal_send ("buffer_switch", WEECHAT_HOOK_SIGNAL_POINTER, buffer); } @@ -927,7 +916,7 @@ gui_window_refresh_windows () { gui_bar_window_calculate_pos_size (ptr_bar->bar_window, NULL); gui_bar_window_create_win (ptr_bar->bar_window); - gui_bar_draw (ptr_bar); + gui_bar_ask_refresh (ptr_bar); } } @@ -946,15 +935,7 @@ gui_window_refresh_windows () for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) { - gui_window_switch_to_buffer (ptr_win, ptr_win->buffer, 0); - gui_window_draw_separator (ptr_win); - ptr_win->refresh_needed = 0; - } - - for (ptr_buffer = gui_buffers; ptr_buffer; - ptr_buffer = ptr_buffer->next_buffer) - { - gui_window_redraw_buffer (ptr_buffer); + ptr_win->refresh_needed = 1; } gui_current_window = old_current_window; @@ -995,8 +976,9 @@ gui_window_split_horizontal (struct t_gui_window *window, int percentage) /* assign same buffer for new window (top window) */ new_window->buffer->num_displayed++; - gui_window_switch_to_buffer (window, window->buffer, 1); - + window->refresh_needed = 1; + new_window->refresh_needed = 1; + gui_window_switch (new_window); } } @@ -1038,7 +1020,8 @@ gui_window_split_vertical (struct t_gui_window *window, int percentage) /* assign same buffer for new window (right window) */ new_window->buffer->num_displayed++; - gui_window_switch_to_buffer (window, window->buffer, 1); + window->refresh_needed = 1; + new_window->refresh_needed = 1; gui_window_switch (new_window); @@ -1130,7 +1113,6 @@ gui_window_merge (struct t_gui_window *window) gui_window_tree_node_to_leaf (parent, window); gui_window_switch_to_buffer (window, window->buffer, 1); - window->refresh_needed = 1; return 1; } return 0; |