diff options
author | James Booth <boothj5@gmail.com> | 2015-06-15 18:08:47 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-06-15 18:08:47 +0100 |
commit | 989dde77cd545ea4cfdf23fbcd445eb121f4ae33 (patch) | |
tree | 67d283455dbe7966d83178a1127a8c57c13a2e39 /src/ui | |
parent | a849b200b368a74da18291e875b3e6d37ea729f2 (diff) | |
download | profani-tty-989dde77cd545ea4cfdf23fbcd445eb121f4ae33.tar.gz |
Added win_resize() function
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/window.c | 33 | ||||
-rw-r--r-- | src/ui/window.h | 1 | ||||
-rw-r--r-- | src/ui/windows.c | 30 |
3 files changed, 35 insertions, 29 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index d6446ff1..b84755b5 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -466,6 +466,39 @@ win_clear(ProfWin *window) } void +win_resize(ProfWin *window) +{ + int subwin_cols = 0; + int cols = getmaxx(stdscr); + + if (window->layout->type == LAYOUT_SPLIT) { + ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout; + if (layout->subwin) { + if (window->type == WIN_CONSOLE) { + subwin_cols = win_roster_cols(); + } else if (window->type == WIN_MUC) { + subwin_cols = win_occpuants_cols(); + } + wresize(layout->base.win, PAD_SIZE, cols - subwin_cols); + wresize(layout->subwin, PAD_SIZE, subwin_cols); + if (window->type == WIN_CONSOLE) { + rosterwin_roster(); + } else if (window->type == WIN_MUC) { + ProfMucWin *mucwin = (ProfMucWin *)window; + assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); + occupantswin_occupants(mucwin->roomjid); + } + } else { + wresize(layout->base.win, PAD_SIZE, cols); + } + } else { + wresize(window->layout->win, PAD_SIZE, cols); + } + + win_redraw(window); +} + +void win_mouse(ProfWin *window, const wint_t ch, const int result) { int rows = getmaxy(stdscr); diff --git a/src/ui/window.h b/src/ui/window.h index 8e5d17e8..f799b1a6 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -193,6 +193,7 @@ int win_unread(ProfWin *window); gboolean win_has_active_subwin(ProfWin *window); void win_clear(ProfWin *window); +void win_resize(ProfWin *window); void win_page_up(ProfWin *window); void win_page_down(ProfWin *window); diff --git a/src/ui/windows.c b/src/ui/windows.c index cb0f00de..54bdb55e 100644 --- a/src/ui/windows.c +++ b/src/ui/windows.c @@ -464,39 +464,11 @@ wins_get_total_unread(void) void wins_resize_all(void) { - int cols = getmaxx(stdscr); - GList *values = g_hash_table_get_values(windows); GList *curr = values; while (curr) { ProfWin *window = curr->data; - int subwin_cols = 0; - - if (window->layout->type == LAYOUT_SPLIT) { - ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout; - if (layout->subwin) { - if (window->type == WIN_CONSOLE) { - subwin_cols = win_roster_cols(); - } else if (window->type == WIN_MUC) { - subwin_cols = win_occpuants_cols(); - } - wresize(layout->base.win, PAD_SIZE, cols - subwin_cols); - wresize(layout->subwin, PAD_SIZE, subwin_cols); - if (window->type == WIN_CONSOLE) { - rosterwin_roster(); - } else if (window->type == WIN_MUC) { - ProfMucWin *mucwin = (ProfMucWin *)window; - assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); - occupantswin_occupants(mucwin->roomjid); - } - } else { - wresize(layout->base.win, PAD_SIZE, cols); - } - } else { - wresize(window->layout->win, PAD_SIZE, cols); - } - - win_redraw(window); + win_resize(window); curr = g_list_next(curr); } g_list_free(values); |