mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added win_resize() function
This commit is contained in:
parent
a849b200b3
commit
989dde77cd
@ -465,6 +465,39 @@ win_clear(ProfWin *window)
|
||||
win_update_virtual(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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user