From: Richard Russon Date: Mon, 15 May 2017 13:46:34 +0000 (+0100) Subject: replace 'mutt_window_t' with 'struct MuttWindow' X-Git-Tag: neomutt-20170526~21^2~63 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fda015686de9eacc171b96ccf6eb0c9a8b956c0e;p=neomutt replace 'mutt_window_t' with 'struct MuttWindow' --- diff --git a/curs_lib.c b/curs_lib.c index 6bcaa3058..5eac76ec6 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -59,12 +59,12 @@ static size_t UngetCount = 0; 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); @@ -588,12 +588,12 @@ out: 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 } @@ -620,16 +620,16 @@ void mutt_reflow_windows(void) 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 = @@ -638,7 +638,7 @@ void mutt_reflow_windows(void) #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; @@ -681,17 +681,17 @@ static void reflow_message_window_rows(int mw_rows) 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); } @@ -707,7 +707,7 @@ static int vw_printw(SLcurses_Window_Type *win, const char *fmt, va_list ap) } #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; @@ -725,7 +725,7 @@ int mutt_window_mvprintw(mutt_window_t *win, int row, int col, const char *fmt, /* 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; @@ -744,7 +744,7 @@ void mutt_window_clrtoeol(mutt_window_t *win) } } -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); @@ -754,7 +754,7 @@ void mutt_window_clearline(mutt_window_t *win, int row) * 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; diff --git a/mutt_curses.h b/mutt_curses.h index c9856904f..3fa073c58 100644 --- a/mutt_curses.h +++ b/mutt_curses.h @@ -220,35 +220,35 @@ void mutt_progress_init(progress_t *progress, const char *msg, 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; diff --git a/mutt_menu.h b/mutt_menu.h index 980433cbc..b92d2c841 100644 --- a/mutt_menu.h +++ b/mutt_menu.h @@ -53,10 +53,10 @@ struct Menu 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 diff --git a/pager.c b/pager.c index 999cff467..3c9b8bbd5 100644 --- a/pager.c +++ b/pager.c @@ -1164,7 +1164,7 @@ static int fill_buffer(FILE *f, LOFF_T *last_pos, LOFF_T offset, unsigned char * 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; @@ -1359,7 +1359,7 @@ static int format_line(struct line_t **lineInfo, int n, unsigned char *buf, 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; @@ -1655,10 +1655,10 @@ typedef struct 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; @@ -1698,20 +1698,20 @@ static void pager_menu_redraw(struct Menu *pager_menu) 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; @@ -1722,7 +1722,7 @@ static void pager_menu_redraw(struct Menu *pager_menu) } 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; @@ -2036,10 +2036,10 @@ int mutt_pager(const char *banner, const char *fname, int flags, pager_t *extra) 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;