From f1db462136800702cf48214b687b0a07c3634f4e Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 29 Mar 2008 15:07:52 +0100 Subject: Fixed bug with bars refresh --- src/gui/curses/gui-curses-bar.c | 83 ++++++++++++++++++++++---------------- src/gui/curses/gui-curses-window.c | 1 + src/gui/curses/gui-curses.h | 1 + 3 files changed, 50 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/gui/curses/gui-curses-bar.c b/src/gui/curses/gui-curses-bar.c index eddfb3704..1b81a9e10 100644 --- a/src/gui/curses/gui-curses-bar.c +++ b/src/gui/curses/gui-curses-bar.c @@ -144,6 +144,53 @@ gui_bar_window_calculate_pos_size (struct t_gui_bar_window *bar_window, } } +/* + * gui_bar_window_create_win: create curses window for bar + */ + +void +gui_bar_window_create_win (struct t_gui_bar_window *bar_window) +{ + if (bar_window->win_bar) + delwin (bar_window->win_bar); + + bar_window->win_bar = newwin (bar_window->height, + bar_window->width, + bar_window->y, + bar_window->x); + bar_window->win_separator = NULL; + if (bar_window->bar->separator) + { + switch (bar_window->bar->position) + { + case GUI_BAR_POSITION_BOTTOM: + bar_window->win_separator = newwin (bar_window->height, + bar_window->width, + bar_window->y - 1, + bar_window->x); + break; + case GUI_BAR_POSITION_TOP: + bar_window->win_separator = newwin (bar_window->height, + bar_window->width, + bar_window->y + bar_window->height, + bar_window->x); + break; + case GUI_BAR_POSITION_LEFT: + bar_window->win_separator = newwin (bar_window->height, + bar_window->width, + bar_window->y, + bar_window->x + bar_window->width); + break; + case GUI_BAR_POSITION_RIGHT: + bar_window->win_separator = newwin (bar_window->height, + bar_window->width, + bar_window->y, + bar_window->x - 1); + break; + } + } +} + /* * gui_bar_window_new: create a new "window bar" for a bar, in screen or a window * if window is not NULL, bar window will be in this window @@ -175,42 +222,8 @@ gui_bar_window_new (struct t_gui_bar *bar, struct t_gui_window *window) } gui_bar_window_calculate_pos_size (new_bar_window, window); + gui_bar_window_create_win (new_bar_window); - new_bar_window->win_bar = newwin (new_bar_window->height, - new_bar_window->width, - new_bar_window->y, - new_bar_window->x); - new_bar_window->win_separator = NULL; - if (new_bar_window->bar->separator) - { - switch (bar->position) - { - case GUI_BAR_POSITION_BOTTOM: - new_bar_window->win_separator = newwin (1, - new_bar_window->width, - new_bar_window->y - 1, - new_bar_window->x); - break; - case GUI_BAR_POSITION_TOP: - new_bar_window->win_separator = newwin (1, - new_bar_window->width, - new_bar_window->y + new_bar_window->height, - new_bar_window->x); - break; - case GUI_BAR_POSITION_LEFT: - new_bar_window->win_separator = newwin (new_bar_window->height, - 1, - new_bar_window->y, - new_bar_window->x + new_bar_window->width); - break; - case GUI_BAR_POSITION_RIGHT: - new_bar_window->win_separator = newwin (new_bar_window->height, - 1, - new_bar_window->y, - new_bar_window->x - 1); - break; - } - } return 1; } diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c index 953ef7882..9a356150e 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -972,6 +972,7 @@ gui_window_refresh_windows () if (ptr_bar->type == GUI_BAR_TYPE_ROOT) { 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); } } diff --git a/src/gui/curses/gui-curses.h b/src/gui/curses/gui-curses.h index aa1bb107e..d42cbe9da 100644 --- a/src/gui/curses/gui-curses.h +++ b/src/gui/curses/gui-curses.h @@ -73,6 +73,7 @@ extern void gui_color_end (); /* bar functions */ extern void gui_bar_window_calculate_pos_size (struct t_gui_bar_window *bar_window, struct t_gui_window *window); +extern void gui_bar_window_create_win (struct t_gui_bar_window *bar_window); /* chat functions */ extern void gui_chat_calculate_line_diff (struct t_gui_window *window, -- cgit v1.2.3