about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/ui/window.c33
-rw-r--r--src/ui/window.h1
-rw-r--r--src/ui/windows.c30
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);