diff options
author | James Booth <boothj5@gmail.com> | 2015-06-15 18:59:20 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-06-15 18:59:20 +0100 |
commit | 6b44b988f4bf8b8f63e6d9261b7ae9a05635bbc8 (patch) | |
tree | 11704305641a76d1eaac838716a85e04808af608 | |
parent | 989dde77cd545ea4cfdf23fbcd445eb121f4ae33 (diff) | |
download | profani-tty-6b44b988f4bf8b8f63e6d9261b7ae9a05635bbc8.tar.gz |
Moved refresh subwin logic to window.c
-rw-r--r-- | src/ui/window.c | 31 | ||||
-rw-r--r-- | src/ui/window.h | 3 | ||||
-rw-r--r-- | src/ui/windows.c | 23 |
3 files changed, 36 insertions, 21 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index b84755b5..92db25fa 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -571,6 +571,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) { window->layout->paged = 0; diff --git a/src/ui/window.h b/src/ui/window.h index f799b1a6..6678da07 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -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); diff --git a/src/ui/windows.c b/src/ui/windows.c index 54bdb55e..6472ce0c 100644 --- a/src/ui/windows.c +++ b/src/ui/windows.c @@ -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 * |