1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Moved refresh subwin logic to window.c

This commit is contained in:
James Booth 2015-06-15 18:59:20 +01:00
parent 989dde77cd
commit 6b44b988f4
3 changed files with 36 additions and 21 deletions

View File

@ -570,6 +570,37 @@ win_update_virtual(ProfWin *window)
}
}
void
win_refresh_without_subwin(ProfWin *window)
{
int rows, cols;
getmaxyx(stdscr, rows, cols);
if ((window->type == WIN_MUC) || (window->type == WIN_CONSOLE)) {
pnoutrefresh(window->layout->win, window->layout->y_pos, 0, 1, 0, rows-3, cols-1);
}
}
void
win_refresh_with_subwin(ProfWin *window)
{
int rows, cols;
getmaxyx(stdscr, rows, cols);
int subwin_cols = 0;
if (window->type == WIN_MUC) {
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
subwin_cols = win_occpuants_cols();
pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1);
pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1);
} else if (window->type == WIN_CONSOLE) {
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
subwin_cols = win_roster_cols();
pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1);
pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1);
}
}
void
win_move_to_end(ProfWin *window)
{

View File

@ -195,6 +195,9 @@ gboolean win_has_active_subwin(ProfWin *window);
void win_clear(ProfWin *window);
void win_resize(ProfWin *window);
void win_refresh_without_subwin(ProfWin *window);
void win_refresh_with_subwin(ProfWin *window);
void win_page_up(ProfWin *window);
void win_page_down(ProfWin *window);
void win_sub_page_down(ProfWin *window);

View File

@ -480,38 +480,19 @@ wins_resize_all(void)
void
wins_hide_subwin(ProfWin *window)
{
int rows, cols;
getmaxyx(stdscr, rows, cols);
win_hide_subwin(window);
ProfWin *current_win = wins_get_current();
if ((current_win->type == WIN_MUC) || (current_win->type == WIN_CONSOLE)) {
pnoutrefresh(current_win->layout->win, current_win->layout->y_pos, 0, 1, 0, rows-3, cols-1);
}
win_refresh_without_subwin(current_win);
}
void
wins_show_subwin(ProfWin *window)
{
int rows, cols;
getmaxyx(stdscr, rows, cols);
int subwin_cols = 0;
win_show_subwin(window);
ProfWin *current_win = wins_get_current();
if (current_win->type == WIN_MUC) {
ProfLayoutSplit *layout = (ProfLayoutSplit*)current_win->layout;
subwin_cols = win_occpuants_cols();
pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1);
pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1);
} else if (current_win->type == WIN_CONSOLE) {
ProfLayoutSplit *layout = (ProfLayoutSplit*)current_win->layout;
subwin_cols = win_roster_cols();
pnoutrefresh(layout->base.win, layout->base.y_pos, 0, 1, 0, rows-3, (cols-subwin_cols)-1);
pnoutrefresh(layout->subwin, layout->sub_y_pos, 0, 1, (cols-subwin_cols), rows-3, cols-1);
}
win_refresh_with_subwin(current_win);
}
ProfXMLWin *