static size_t UngetLen = 0;
static event_t *UngetKeyEvents;
-mutt_window_t *MuttHelpWindow = NULL;
-mutt_window_t *MuttIndexWindow = NULL;
-mutt_window_t *MuttStatusWindow = NULL;
-mutt_window_t *MuttMessageWindow = NULL;
+struct MuttWindow *MuttHelpWindow = NULL;
+struct MuttWindow *MuttIndexWindow = NULL;
+struct MuttWindow *MuttStatusWindow = NULL;
+struct MuttWindow *MuttMessageWindow = NULL;
#ifdef USE_SIDEBAR
-mutt_window_t *MuttSidebarWindow = NULL;
+struct MuttWindow *MuttSidebarWindow = NULL;
#endif
static void reflow_message_window_rows(int mw_rows);
void mutt_init_windows(void)
{
- MuttHelpWindow = safe_calloc(sizeof(mutt_window_t), 1);
- MuttIndexWindow = safe_calloc(sizeof(mutt_window_t), 1);
- MuttStatusWindow = safe_calloc(sizeof(mutt_window_t), 1);
- MuttMessageWindow = safe_calloc(sizeof(mutt_window_t), 1);
+ MuttHelpWindow = safe_calloc(sizeof(struct MuttWindow), 1);
+ MuttIndexWindow = safe_calloc(sizeof(struct MuttWindow), 1);
+ MuttStatusWindow = safe_calloc(sizeof(struct MuttWindow), 1);
+ MuttMessageWindow = safe_calloc(sizeof(struct MuttWindow), 1);
#ifdef USE_SIDEBAR
- MuttSidebarWindow = safe_calloc(sizeof(mutt_window_t), 1);
+ MuttSidebarWindow = safe_calloc(sizeof(struct MuttWindow), 1);
#endif
}
MuttStatusWindow->row_offset = option(OPTSTATUSONTOP) ? 0 : LINES - 2;
MuttStatusWindow->col_offset = 0;
- memcpy(MuttHelpWindow, MuttStatusWindow, sizeof(mutt_window_t));
+ memcpy(MuttHelpWindow, MuttStatusWindow, sizeof(struct MuttWindow));
if (!option(OPTHELP))
MuttHelpWindow->rows = 0;
else
MuttHelpWindow->row_offset = option(OPTSTATUSONTOP) ? LINES - 2 : 0;
- memcpy(MuttMessageWindow, MuttStatusWindow, sizeof(mutt_window_t));
+ memcpy(MuttMessageWindow, MuttStatusWindow, sizeof(struct MuttWindow));
MuttMessageWindow->row_offset = LINES - 1;
- memcpy(MuttIndexWindow, MuttStatusWindow, sizeof(mutt_window_t));
+ memcpy(MuttIndexWindow, MuttStatusWindow, sizeof(struct MuttWindow));
MuttIndexWindow->rows = MAX(
LINES - MuttStatusWindow->rows - MuttHelpWindow->rows - MuttMessageWindow->rows, 0);
MuttIndexWindow->row_offset =
#ifdef USE_SIDEBAR
if (option(OPTSIDEBAR))
{
- memcpy(MuttSidebarWindow, MuttIndexWindow, sizeof(mutt_window_t));
+ memcpy(MuttSidebarWindow, MuttIndexWindow, sizeof(struct MuttWindow));
MuttSidebarWindow->cols = SidebarWidth;
MuttIndexWindow->cols -= SidebarWidth;
mutt_set_current_menu_redraw_full();
}
-int mutt_window_move(mutt_window_t *win, int row, int col)
+int mutt_window_move(struct MuttWindow *win, int row, int col)
{
return move(win->row_offset + row, win->col_offset + col);
}
-int mutt_window_mvaddch(mutt_window_t *win, int row, int col, const chtype ch)
+int mutt_window_mvaddch(struct MuttWindow *win, int row, int col, const chtype ch)
{
return mvaddch(win->row_offset + row, win->col_offset + col, ch);
}
-int mutt_window_mvaddstr(mutt_window_t *win, int row, int col, const char *str)
+int mutt_window_mvaddstr(struct MuttWindow *win, int row, int col, const char *str)
{
return mvaddstr(win->row_offset + row, win->col_offset + col, str);
}
}
#endif
-int mutt_window_mvprintw(mutt_window_t *win, int row, int col, const char *fmt, ...)
+int mutt_window_mvprintw(struct MuttWindow *win, int row, int col, const char *fmt, ...)
{
va_list ap;
int rv;
/* Assumes the cursor has already been positioned within the
* window.
*/
-void mutt_window_clrtoeol(mutt_window_t *win)
+void mutt_window_clrtoeol(struct MuttWindow *win)
{
int row, col, curcol;
}
}
-void mutt_window_clearline(mutt_window_t *win, int row)
+void mutt_window_clearline(struct MuttWindow *win, int row)
{
mutt_window_move(win, row, 0);
mutt_window_clrtoeol(win);
* Otherwise it will happily return negative or values outside
* the window boundaries
*/
-void mutt_window_getyx(mutt_window_t *win, int *y, int *x)
+void mutt_window_getyx(struct MuttWindow *win, int *y, int *x)
{
int row, col;
void mutt_progress_update(progress_t *progress, long pos, int percent);
/* Windows for different parts of the screen */
-typedef struct
+struct MuttWindow
{
int rows;
int cols;
int row_offset;
int col_offset;
-} mutt_window_t;
+};
-extern mutt_window_t *MuttHelpWindow;
-extern mutt_window_t *MuttIndexWindow;
-extern mutt_window_t *MuttStatusWindow;
-extern mutt_window_t *MuttMessageWindow;
+extern struct MuttWindow *MuttHelpWindow;
+extern struct MuttWindow *MuttIndexWindow;
+extern struct MuttWindow *MuttStatusWindow;
+extern struct MuttWindow *MuttMessageWindow;
#ifdef USE_SIDEBAR
-extern mutt_window_t *MuttSidebarWindow;
+extern struct MuttWindow *MuttSidebarWindow;
#endif
void mutt_init_windows(void);
void mutt_free_windows(void);
void mutt_reflow_windows(void);
-int mutt_window_move(mutt_window_t *win, int row, int col);
-int mutt_window_mvaddch(mutt_window_t *win, int row, int col, const chtype ch);
-int mutt_window_mvaddstr(mutt_window_t *win, int row, int col, const char *str);
-int mutt_window_mvprintw(mutt_window_t *win, int row, int col, const char *fmt, ...);
-void mutt_window_clrtoeol(mutt_window_t *win);
-void mutt_window_clearline(mutt_window_t *win, int row);
-void mutt_window_getyx(mutt_window_t *win, int *y, int *x);
+int mutt_window_move(struct MuttWindow *win, int row, int col);
+int mutt_window_mvaddch(struct MuttWindow *win, int row, int col, const chtype ch);
+int mutt_window_mvaddstr(struct MuttWindow *win, int row, int col, const char *str);
+int mutt_window_mvprintw(struct MuttWindow *win, int row, int col, const char *fmt, ...);
+void mutt_window_clrtoeol(struct MuttWindow *win);
+void mutt_window_clearline(struct MuttWindow *win, int row);
+void mutt_window_getyx(struct MuttWindow *win, int *y, int *x);
-static inline int mutt_window_wrap_cols(mutt_window_t *win, short wrap)
+static inline int mutt_window_wrap_cols(struct MuttWindow *win, short wrap)
{
if (wrap < 0)
return win->cols > -wrap ? win->cols + wrap : win->cols;
int pagelen; /* number of entries per screen */
int tagprefix;
int is_mailbox_list;
- mutt_window_t *indexwin;
- mutt_window_t *statuswin;
- mutt_window_t *helpwin;
- mutt_window_t *messagewin;
+ struct MuttWindow *indexwin;
+ struct MuttWindow *statuswin;
+ struct MuttWindow *helpwin;
+ struct MuttWindow *messagewin;
/* Setting dialog != NULL overrides normal menu behavior.
* In dialog mode menubar is hidden and prompt keys are checked before
static int format_line(struct line_t **lineInfo, int n, unsigned char *buf,
int flags, ansi_attr *pa, int cnt, int *pspace, int *pvch,
- int *pcol, int *pspecial, mutt_window_t *pager_window)
+ int *pcol, int *pspecial, struct MuttWindow *pager_window)
{
int space = -1; /* index of the last space or TAB */
int col = option(OPTMARKERS) ? (*lineInfo)[n].continuation : 0;
static int display_line(FILE *f, LOFF_T *last_pos, struct line_t **lineInfo,
int n, int *last, int *max, int flags,
struct q_class_t **QuoteList, int *q_level, int *force_redraw,
- regex_t *SearchRE, mutt_window_t *pager_window)
+ regex_t *SearchRE, struct MuttWindow *pager_window)
{
unsigned char *buf = NULL, *fmt = NULL;
size_t buflen = 0;
struct q_class_t *QuoteList;
LOFF_T last_pos;
LOFF_T last_offset;
- mutt_window_t *index_status_window;
- mutt_window_t *index_window;
- mutt_window_t *pager_status_window;
- mutt_window_t *pager_window;
+ struct MuttWindow *index_status_window;
+ struct MuttWindow *index_window;
+ struct MuttWindow *pager_status_window;
+ struct MuttWindow *pager_window;
struct Menu *index; /* the Pager Index (PI) */
regex_t SearchRE;
int SearchCompiled;
rd->indicator = rd->indexlen / 3;
- memcpy(rd->pager_window, MuttIndexWindow, sizeof(mutt_window_t));
- memcpy(rd->pager_status_window, MuttStatusWindow, sizeof(mutt_window_t));
+ memcpy(rd->pager_window, MuttIndexWindow, sizeof(struct MuttWindow));
+ memcpy(rd->pager_status_window, MuttStatusWindow, sizeof(struct MuttWindow));
rd->index_status_window->rows = rd->index_window->rows = 0;
if (IsHeader(rd->extra) && PagerIndexLines)
{
- memcpy(rd->index_window, MuttIndexWindow, sizeof(mutt_window_t));
+ memcpy(rd->index_window, MuttIndexWindow, sizeof(struct MuttWindow));
rd->index_window->rows = rd->indexlen > 0 ? rd->indexlen - 1 : 0;
if (option(OPTSTATUSONTOP))
{
- memcpy(rd->index_status_window, MuttStatusWindow, sizeof(mutt_window_t));
+ memcpy(rd->index_status_window, MuttStatusWindow, sizeof(struct MuttWindow));
- memcpy(rd->pager_status_window, MuttIndexWindow, sizeof(mutt_window_t));
+ memcpy(rd->pager_status_window, MuttIndexWindow, sizeof(struct MuttWindow));
rd->pager_status_window->rows = 1;
rd->pager_status_window->row_offset += rd->index_window->rows;
}
else
{
- memcpy(rd->index_status_window, MuttIndexWindow, sizeof(mutt_window_t));
+ memcpy(rd->index_status_window, MuttIndexWindow, sizeof(struct MuttWindow));
rd->index_status_window->rows = 1;
rd->index_status_window->row_offset += rd->index_window->rows;
snprintf(helpstr, sizeof(helpstr), "%s %s", tmphelp, buffer);
}
- rd.index_status_window = safe_calloc(1, sizeof(mutt_window_t));
- rd.index_window = safe_calloc(1, sizeof(mutt_window_t));
- rd.pager_status_window = safe_calloc(1, sizeof(mutt_window_t));
- rd.pager_window = safe_calloc(1, sizeof(mutt_window_t));
+ rd.index_status_window = safe_calloc(1, sizeof(struct MuttWindow));
+ rd.index_window = safe_calloc(1, sizeof(struct MuttWindow));
+ rd.pager_status_window = safe_calloc(1, sizeof(struct MuttWindow));
+ rd.pager_window = safe_calloc(1, sizeof(struct MuttWindow));
pager_menu = mutt_new_menu(MENU_PAGER);
pager_menu->custom_menu_redraw = pager_menu_redraw;