diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-04-22 18:11:33 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-04-22 18:11:33 +0200 |
commit | 06fd80e21079f80e7ff61537de42431205bd911a (patch) | |
tree | 53a29b06c89ed0772c88b6458f7cb113f2268d5b /src/gui/curses/gui-curses-window.c | |
parent | 9d49beabf1fe1a6e9347afe6a25db4744df28abe (diff) | |
download | weechat-06fd80e21079f80e7ff61537de42431205bd911a.zip |
Added conditions for bar display and bar max size
Diffstat (limited to 'src/gui/curses/gui-curses-window.c')
-rw-r--r-- | src/gui/curses/gui-curses-window.c | 112 |
1 files changed, 60 insertions, 52 deletions
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c index 0b56b7b1a..68207c6d5 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -502,40 +502,6 @@ gui_window_redraw_all_buffers () } /* - * gui_window_switch: switch to another window - */ - -void -gui_window_switch (struct t_gui_window *window) -{ - struct t_gui_window *old_window; - int changes; - - if (gui_current_window == window) - return; - - old_window = gui_current_window; - - gui_current_window = window; - changes = gui_bar_window_remove_unused_bars (old_window) - || gui_bar_window_add_missing_bars (old_window); - if (changes) - { - gui_current_window = old_window; - gui_window_switch_to_buffer (gui_current_window, - gui_current_window->buffer); - gui_current_window = window; - } - - gui_bar_window_remove_unused_bars (gui_current_window); - gui_bar_window_add_missing_bars (gui_current_window); - gui_window_switch_to_buffer (gui_current_window, - gui_current_window->buffer); - - gui_window_redraw_buffer (gui_current_window->buffer); -} - -/* * gui_window_switch_to_buffer: switch to another buffer in a window */ @@ -544,6 +510,7 @@ gui_window_switch_to_buffer (struct t_gui_window *window, struct t_gui_buffer *buffer) { struct t_gui_bar_window *ptr_bar_win; + struct t_gui_buffer *old_buffer; if (!gui_ok) return; @@ -551,6 +518,8 @@ gui_window_switch_to_buffer (struct t_gui_window *window, if (window->buffer->num_displayed > 0) window->buffer->num_displayed--; + old_buffer = window->buffer; + if (window->buffer != buffer) { window->start_line = NULL; @@ -565,8 +534,14 @@ gui_window_switch_to_buffer (struct t_gui_window *window, window->win_title_start = 0; window->win_nick_start = 0; + if (old_buffer == buffer) + { + gui_bar_window_remove_unused_bars (window); + gui_bar_window_add_missing_bars (window); + } + gui_window_calculate_pos_size (window, 1); - + /* create bar windows */ for (ptr_bar_win = GUI_CURSES(window)->bar_windows; ptr_bar_win; ptr_bar_win = ptr_bar_win->next_bar_window) @@ -624,6 +599,12 @@ gui_window_switch_to_buffer (struct t_gui_window *window, buffer->num_displayed++; gui_hotlist_remove_buffer (buffer); + + if (buffer != old_buffer) + { + gui_bar_window_remove_unused_bars (window); + gui_bar_window_add_missing_bars (window); + } /* redraw bars in window */ for (ptr_bar_win = GUI_CURSES(window)->bar_windows; ptr_bar_win; @@ -637,6 +618,38 @@ gui_window_switch_to_buffer (struct t_gui_window *window, } /* + * gui_window_switch: switch to another window + */ + +void +gui_window_switch (struct t_gui_window *window) +{ + struct t_gui_window *old_window; + int changes; + + if (gui_current_window == window) + return; + + old_window = gui_current_window; + + gui_current_window = window; + changes = gui_bar_window_remove_unused_bars (old_window) + || gui_bar_window_add_missing_bars (old_window); + if (changes) + { + gui_current_window = old_window; + gui_window_switch_to_buffer (gui_current_window, + gui_current_window->buffer); + gui_current_window = window; + } + + gui_window_switch_to_buffer (gui_current_window, + gui_current_window->buffer); + + gui_window_redraw_buffer (gui_current_window->buffer); +} + +/* * gui_window_page_up: display previous page on buffer */ @@ -1548,29 +1561,25 @@ gui_window_switch_right (struct t_gui_window *window) */ void -gui_window_refresh_screen (int force) +gui_window_refresh_screen () { int new_height, new_width; - if (force || (gui_window_refresh_needed == 1)) + endwin (); + refresh (); + + getmaxyx (stdscr, new_height, new_width); + + gui_ok = ((new_width >= GUI_WINDOW_MIN_WIDTH) + && (new_height >= GUI_WINDOW_MIN_HEIGHT)); + + if (gui_ok) { - endwin (); refresh (); - - getmaxyx (stdscr, new_height, new_width); - - gui_ok = ((new_width >= GUI_WINDOW_MIN_WIDTH) - && (new_height >= GUI_WINDOW_MIN_HEIGHT)); - - if (gui_ok) - { - refresh (); - gui_window_refresh_windows (); - } + gui_window_refresh_windows (); } - if (gui_window_refresh_needed > 0) - gui_window_refresh_needed = 0; + gui_window_refresh_needed = 0; } /* @@ -1581,7 +1590,6 @@ void gui_window_refresh_screen_sigwinch () { gui_window_refresh_needed = 1; - //gui_window_refresh_screen (0); } /* |