]> granicus.if.org Git - neomutt/commitdiff
window: initial size
authorRichard Russon <rich@flatcap.org>
Fri, 2 Aug 2019 20:41:44 +0000 (21:41 +0100)
committerRichard Russon <rich@flatcap.org>
Sun, 27 Oct 2019 03:31:08 +0000 (03:31 +0000)
main.c
mutt_window.c
mutt_window.h
resize.c

diff --git a/main.c b/main.c
index f9d3c2d45b167cb0ccf5942e655b4f66d95adb66..89fa84a0cb62f8c552fab78aeeea1171e5f466f7 100644 (file)
--- a/main.c
+++ b/main.c
@@ -691,13 +691,12 @@ int main(int argc, char *argv[], char *envp[])
   if (!OptNoCurses)
   {
     int crc = start_curses();
-
     if (crc != 0)
       goto main_curses; // TEST08: can't test -- fake term?
 
     /* check whether terminal status is supported (must follow curses init) */
     TsSupported = mutt_ts_capability();
-    mutt_window_reflow(NULL);
+    mutt_window_set_root(LINES, COLS);
   }
 
   /* set defaults and read init files */
index defed202d5d00b3dbb6b6122a539ac8e4532328f..5109c5c19cf6acdf6a39d6722141de20e431563f 100644 (file)
@@ -204,8 +204,7 @@ void mutt_window_init(void)
     return;
 
   struct MuttWindow *w1 =
-      mutt_window_new(MUTT_WIN_ORIENT_VERTICAL, MUTT_WIN_SIZE_MAXIMISE,
-                      MUTT_WIN_SIZE_UNLIMITED, MUTT_WIN_SIZE_UNLIMITED);
+      mutt_window_new(MUTT_WIN_ORIENT_VERTICAL, MUTT_WIN_SIZE_FIXED, 0, 0);
   struct MuttWindow *w2 =
       mutt_window_new(MUTT_WIN_ORIENT_VERTICAL, MUTT_WIN_SIZE_MAXIMISE,
                       MUTT_WIN_SIZE_UNLIMITED, MUTT_WIN_SIZE_UNLIMITED);
@@ -346,9 +345,6 @@ void mutt_window_copy_size(const struct MuttWindow *win_src, struct MuttWindow *
  */
 void mutt_window_reflow_prep(void)
 {
-  RootWindow->state.cols = COLS; // From curses
-  RootWindow->state.rows = LINES;
-
   MuttHelpWindow->state.visible = C_Help;
   MuttSidebarWindow->state.visible = C_SidebarVisible;
   MuttSidebarWindow->req_cols = C_SidebarWidth;
@@ -428,6 +424,10 @@ void mutt_window_reflow(struct MuttWindow *win)
   mutt_debug(LL_DEBUG2, "entering\n");
   mutt_window_reflow_prep();
   window_reflow(win ? win : RootWindow);
+
+  mutt_menu_set_current_redraw_full();
+  /* the pager menu needs this flag set to recalc line_info */
+  mutt_menu_set_current_redraw(REDRAW_FLOW);
 }
 
 /**
@@ -578,3 +578,33 @@ void mutt_winlist_free(struct MuttWindowList *head)
     FREE(&np);
   }
 }
+
+/**
+ * mutt_window_set_root - XXX
+ * @param rows
+ * @param cols
+ */
+void mutt_window_set_root(int rows, int cols)
+{
+  if (!RootWindow)
+    return;
+
+  bool changed = false;
+
+  if (RootWindow->state.rows != rows)
+  {
+    RootWindow->state.rows = rows;
+    changed = true;
+  }
+
+  if (RootWindow->state.cols != cols)
+  {
+    RootWindow->state.cols = cols;
+    changed = true;
+  }
+
+  if (changed)
+  {
+    mutt_window_reflow(RootWindow);
+  }
+}
index 4cb971006931895d6a4efacc98f02288fbba1aae..30e95b289073646e263d4e71f5b9cdca100355a2 100644 (file)
@@ -101,6 +101,7 @@ void               mutt_window_init               (void);
 struct MuttWindow *mutt_window_new                (enum MuttWindowOrientation orient, enum MuttWindowSize size, int rows, int cols);
 void               mutt_window_reflow             (struct MuttWindow *win);
 void               mutt_window_reflow_message_rows(int mw_rows);
+void               mutt_window_set_root           (int rows, int cols);
 int                mutt_window_wrap_cols          (int width, short wrap);
 
 // Functions for drawing on the Window
index 54112c5c8df6092be829263830f926ab793e467c..fadd1b59093df682c5710280e25fd6d54ca25325 100644 (file)
--- a/resize.c
+++ b/resize.c
@@ -91,6 +91,7 @@ void mutt_resize_screen(void)
   SLsmg_init_smg();
   stdscr = newwin(0, 0, 0, 0);
   keypad(stdscr, true);
+  mutt_window_set_root(w.ws_row, w.ws_col);
   mutt_window_reflow(NULL);
 }
 #else
@@ -119,6 +120,7 @@ void mutt_resize_screen(void)
   }
 
   resizeterm(screenrows, screencols);
+  mutt_window_set_root(w.ws_row, w.ws_col);
   mutt_window_reflow(NULL);
 }
 #endif