From: Pierre Habouzit Date: Sat, 11 Aug 2007 10:37:05 +0000 (+0200) Subject: Do not use implicit ncurses functions, now we can grep for 'stdscr' to find them. X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=8e39affbf1cd8a2a5ff5c9991650d54fdcea4997;p=apps%2Fmadmutt.git Do not use implicit ncurses functions, now we can grep for 'stdscr' to find them. Signed-off-by: Pierre Habouzit --- diff --git a/compose.c b/compose.c index 8b489c9..6fa6ad3 100644 --- a/compose.c +++ b/compose.c @@ -96,45 +96,45 @@ static void redraw_crypt_lines (HEADER * msg) int off = 0; if (!msg->security) - mvaddstr (HDR_CRYPT, SW, " Security: "); + mvwaddstr (stdscr, HDR_CRYPT, SW, " Security: "); else if (msg->security & APPLICATION_SMIME) - mvaddstr (HDR_CRYPT, SW, " S/MIME: "); + mvwaddstr (stdscr, HDR_CRYPT, SW, " S/MIME: "); else if (msg->security & APPLICATION_PGP) - mvaddstr (HDR_CRYPT, SW, " PGP: "); + mvwaddstr (stdscr, HDR_CRYPT, SW, " PGP: "); if ((msg->security & (ENCRYPT | SIGN)) == (ENCRYPT | SIGN)) - addstr (_("Sign, Encrypt")); + waddstr (stdscr, _("Sign, Encrypt")); else if (msg->security & ENCRYPT) - addstr (_("Encrypt")); + waddstr (stdscr, _("Encrypt")); else if (msg->security & SIGN) - addstr (_("Sign")); + waddstr (stdscr, _("Sign")); else - addstr (_("Clear")); + waddstr (stdscr, _("Clear")); if ((msg->security & APPLICATION_PGP) && (msg->security & (ENCRYPT | SIGN))) { if ((msg->security & INLINE)) - addstr (_(" (inline)")); + waddstr (stdscr, _(" (inline)")); else - addstr (_(" (PGP/MIME)")); + waddstr (stdscr, _(" (PGP/MIME)")); } - clrtoeol (); + wclrtoeol (stdscr); - move (HDR_CRYPTINFO, SW); - clrtoeol (); + wmove (stdscr, HDR_CRYPTINFO, SW); + wclrtoeol (stdscr); if (msg->security & APPLICATION_PGP && msg->security & SIGN) - printw ("%s%s", _(" sign as: "), + wprintw (stdscr, "%s%s", _(" sign as: "), PgpSignAs ? PgpSignAs : _("")); if (msg->security & APPLICATION_SMIME && msg->security & SIGN) { - printw ("%s%s", _(" sign as: "), + wprintw (stdscr, "%s%s", _(" sign as: "), SmimeDefaultKey ? SmimeDefaultKey : _("")); } if ((msg->security & APPLICATION_SMIME) && (msg->security & ENCRYPT) && SmimeCryptAlg && *SmimeCryptAlg) { - mvprintw (HDR_CRYPTINFO, SW + 40, "%s%s", _("Encrypt with: "), + mvwprintw (stdscr, HDR_CRYPTINFO, SW + 40, "%s%s", _("Encrypt with: "), NONULL (SmimeCryptAlg)); off = 20; } @@ -145,11 +145,11 @@ static void redraw_mix_line (string_list_t * chain) int c; const char *t; - mvaddstr (HDR_MIX, SW, " Mix: "); + mvwaddstr (stdscr, HDR_MIX, SW, " Mix: "); if (!chain) { - addstr (""); - clrtoeol (); + waddstr (stdscr, ""); + wclrtoeol (stdscr); return; } @@ -161,9 +161,9 @@ static void redraw_mix_line (string_list_t * chain) if (c + m_strlen(t) + 2 >= COLS - SW) break; - addstr (NONULL (t)); + waddstr (stdscr, NONULL (t)); if (chain->next) - addstr (", "); + waddstr (stdscr, ", "); c += m_strlen(t) + 2; } @@ -204,7 +204,7 @@ static void draw_envelope_addr (int line, address_t * addr) buf[0] = 0; rfc822_addrcat(buf, sizeof (buf), addr, 1); - mvprintw (line, SW, TITLE_FMT, Prompts[line - 1]); + mvwprintw (stdscr, line, SW, TITLE_FMT, Prompts[line - 1]); mutt_paddstr (W, buf); } @@ -219,25 +219,25 @@ static void draw_envelope (HEADER * msg, char *fcc) draw_envelope_addr (HDR_BCC, msg->env->bcc); #ifdef USE_NNTP } else { - mvprintw (HDR_TO, SW, TITLE_FMT, Prompts[HDR_NEWSGROUPS - 1]); + mvwprintw (stdscr, HDR_TO, SW, TITLE_FMT, Prompts[HDR_NEWSGROUPS - 1]); mutt_paddstr (W, NONULL (msg->env->newsgroups)); - mvprintw (HDR_CC, SW, TITLE_FMT, Prompts[HDR_FOLLOWUPTO - 1]); + mvwprintw (stdscr, HDR_CC, SW, TITLE_FMT, Prompts[HDR_FOLLOWUPTO - 1]); mutt_paddstr (W, NONULL (msg->env->followup_to)); } #endif - mvprintw (HDR_SUBJECT, SW, TITLE_FMT, Prompts[HDR_SUBJECT - 1]); + mvwprintw (stdscr, HDR_SUBJECT, SW, TITLE_FMT, Prompts[HDR_SUBJECT - 1]); mutt_paddstr (W, NONULL (msg->env->subject)); draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to); - mvprintw (HDR_FCC, SW, TITLE_FMT, Prompts[HDR_FCC - 1]); + mvwprintw (stdscr, HDR_FCC, SW, TITLE_FMT, Prompts[HDR_FCC - 1]); mutt_paddstr (W, fcc); redraw_crypt_lines (msg); redraw_mix_line (msg->chain); SETCOLOR (MT_COLOR_STATUS); - mvaddstr (HDR_ATTACH - 1, SW, _("-- Attachments")); + mvwaddstr (stdscr, HDR_ATTACH - 1, SW, _("-- Attachments")); BKGDSET (MT_COLOR_STATUS); - clrtoeol (); + wclrtoeol (stdscr); BKGDSET (MT_COLOR_NORMAL); SETCOLOR (MT_COLOR_NORMAL); @@ -270,7 +270,7 @@ static int edit_address_list (int line, address_t ** addr) /* redraw the expanded list so the user can see the result */ buf[0] = 0; rfc822_addrcat(buf, sizeof (buf), *addr, 1); - move (line, HDR_XOFFSET + SW); + wmove (stdscr, line, HDR_XOFFSET + SW); mutt_paddstr (W, buf); return 0; @@ -533,10 +533,10 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ p_delete(&msg->env->newsgroups); m_strrtrim(buf); msg->env->newsgroups = m_strdup(skipspaces(buf)); - move (HDR_TO, HDR_XOFFSET); - clrtoeol (); + wmove (stdscr, HDR_TO, HDR_XOFFSET); + wclrtoeol (stdscr); if (msg->env->newsgroups) - printw ("%-*.*s", W, W, msg->env->newsgroups); + wprintw (stdscr, "%-*.*s", W, W, msg->env->newsgroups); } } break; @@ -551,10 +551,10 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ p_delete(&msg->env->followup_to); m_strrtrim(buf); msg->env->followup_to = m_strdup(skipspaces(buf)); - move (HDR_CC, HDR_XOFFSET); - clrtoeol (); + wmove (stdscr, HDR_CC, HDR_XOFFSET); + wclrtoeol (stdscr); if (msg->env->followup_to) - printw ("%-*.*s", W, W, msg->env->followup_to); + wprintw (stdscr, "%-*.*s", W, W, msg->env->followup_to); } } break; @@ -567,8 +567,8 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ buf[0] = 0; if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) { m_strreplace(&msg->env->subject, buf); - move (HDR_SUBJECT, HDR_XOFFSET + SW); - clrtoeol (); + wmove (stdscr, HDR_SUBJECT, HDR_XOFFSET + SW); + wclrtoeol (stdscr); if (msg->env->subject) mutt_paddstr (W, msg->env->subject); } @@ -583,7 +583,7 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ if (mutt_get_field ("Fcc: ", buf, sizeof (buf), M_FILE | M_CLEAR) == 0) { m_strcpy(fcc, _POSIX_PATH_MAX, buf); mutt_pretty_mailbox (fcc); - move (HDR_FCC, HDR_XOFFSET + SW); + wmove (stdscr, HDR_FCC, HDR_XOFFSET + SW); mutt_paddstr (W, fcc); fccSet = 1; } @@ -1213,8 +1213,8 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ compose_status_line (buf, sizeof (buf), menu, NONULL (ComposeFormat)); CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES - 2); SETCOLOR (MT_COLOR_STATUS); - move (option (OPTSTATUSONTOP) ? 0 : LINES - 2, SW); - printw ("%-*.*s", COLS-SW, COLS-SW, buf); + wmove (stdscr, option (OPTSTATUSONTOP) ? 0 : LINES - 2, SW); + wprintw (stdscr, "%-*.*s", COLS-SW, COLS-SW, buf); SETCOLOR (MT_COLOR_NORMAL); menu->redraw &= ~REDRAW_STATUS; } diff --git a/flags.c b/flags.c index c767ac6..afadb4c 100644 --- a/flags.c +++ b/flags.c @@ -331,9 +331,9 @@ int mutt_change_flag(HEADER * h, int bf) int c; - mvprintw(LINES - 1, 0, "%s? (D/N/O/r/*/!): ", + mvwprintw(stdscr, LINES - 1, 0, "%s? (D/N/O/r/*/!): ", bf ? _("Set flag") : _("Clear flag")); - clrtoeol(); + wclrtoeol(stdscr); c = mutt_getch().ch; if (c == -1) { diff --git a/keymap.c b/keymap.c index 106df72..ccce5c7 100644 --- a/keymap.c +++ b/keymap.c @@ -335,12 +335,12 @@ int km_dokey (int menu) for (;;) { /* ncurses doesn't return on resized screen when timeout is set to zero */ if (menu != MENU_EDITOR) - timeout ((Timeout > 0 ? Timeout : 60) * 1000); + wtimeout (stdscr, (Timeout > 0 ? Timeout : 60) * 1000); tmp = mutt_getch (); if (menu != MENU_EDITOR) - timeout (-1); /* restore blocking operation */ + wtimeout (stdscr, -1); /* restore blocking operation */ LastKey = tmp.ch; if (LastKey == -1) @@ -865,9 +865,9 @@ void mutt_what_key (void) { int ch; - mvprintw (LINES - 1, 0, _("Enter keys (^G to abort): ")); + mvwprintw (stdscr, LINES - 1, 0, _("Enter keys (^G to abort): ")); do { - ch = getch (); + ch = wgetch (stdscr); if (ch != ERR && ch != ctrl ('G')) { mutt_message (_("Char = %s, Octal = %o, Decimal = %d"), km_keyname (ch), ch, ch); diff --git a/lib-sys/mutt_signal.c b/lib-sys/mutt_signal.c index f8e0dba..8be8fce 100644 --- a/lib-sys/mutt_signal.c +++ b/lib-sys/mutt_signal.c @@ -49,7 +49,7 @@ static void sighandler (int sig) case SIGCONT: if (!IsEndwin) - refresh (); + wrefresh (stdscr); mutt_curs_set (-1); /* We don't receive SIGWINCH when suspended; however, no harm is done by * just assuming we received one, and triggering the 'resize' anyway. */ diff --git a/lib-ui/curs_lib.c b/lib-ui/curs_lib.c index 72560b6..53609b5 100644 --- a/lib-ui/curs_lib.c +++ b/lib-ui/curs_lib.c @@ -52,7 +52,7 @@ void mutt_refresh (void) return; /* else */ - refresh (); + wrefresh (stdscr); } void mutt_need_hard_redraw (void) @@ -73,7 +73,7 @@ event_t mutt_getch (void) SigInt = 0; mutt_allow_interrupt (1); - ch = getch (); + ch = wgetch (stdscr); mutt_allow_interrupt (0); if (SigInt) @@ -97,7 +97,7 @@ int _mutt_get_field ( const char *field, char *buf, ssize_t buflen, do { CLEARLINE (LINES - 1); - addstr (field); + waddstr (stdscr, field); mutt_refresh (); getyx (stdscr, y, x); ret = _mutt_enter_string(buf, buflen, y, x, complete, multiple, files, @@ -172,7 +172,7 @@ int mutt_yesorno (const char *msg, int def) snprintf (answer_string, COLS + 1, " ([%s]/%s): ", def == M_YES ? yes : no, def == M_YES ? no : yes); answer_string_len = m_strlen(answer_string); - printw ("%.*s%s", COLS - answer_string_len, msg, answer_string); + wprintw (stdscr, "%.*s%s", COLS - answer_string_len, msg, answer_string); p_delete(&answer_string); for (;;) { @@ -207,7 +207,7 @@ int mutt_yesorno (const char *msg, int def) regfree (&reno); if (def != -1) { - addstr ((char *) (def == M_YES ? yes : no)); + waddstr (stdscr, (char *) (def == M_YES ? yes : no)); mutt_refresh (); } return (def); @@ -219,7 +219,7 @@ void mutt_query_exit (void) mutt_flushinp (); curs_set (1); if (Timeout) - timeout (-1); /* restore blocking operation */ + wtimeout (stdscr, -1); /* restore blocking operation */ if (mutt_yesorno (_("Exit Madmutt?"), M_YES) == M_YES) { mutt_endwin (NULL); exit (1); @@ -245,8 +245,8 @@ void mutt_curses_error (const char *fmt, ...) if (!option (OPTKEEPQUIET)) { BEEP (); SETCOLOR (MT_COLOR_ERROR); - mvaddstr (LINES - 1, 0, Errorbuf); - clrtoeol (); + mvwaddstr (stdscr, LINES - 1, 0, Errorbuf); + wclrtoeol (stdscr); SETCOLOR (MT_COLOR_NORMAL); mutt_refresh (); } @@ -297,8 +297,8 @@ void mutt_curses_message (const char *fmt, ...) if (!option (OPTKEEPQUIET)) { SETCOLOR (MT_COLOR_MESSAGE); - mvaddstr (LINES - 1, 0, Errorbuf); - clrtoeol (); + mvwaddstr (stdscr, LINES - 1, 0, Errorbuf); + wclrtoeol (stdscr); SETCOLOR (MT_COLOR_NORMAL); mutt_refresh (); } @@ -313,7 +313,7 @@ void mutt_show_error (void) SETCOLOR (option (OPTMSGERR) ? MT_COLOR_ERROR : MT_COLOR_MESSAGE); CLEARLINE (LINES - 1); - addstr (Errorbuf); + waddstr (stdscr, Errorbuf); SETCOLOR (MT_COLOR_NORMAL); } @@ -322,7 +322,7 @@ void mutt_endwin (const char *msg) if (!option (OPTNOCURSES)) { CLEARLINE (LINES - 1); - attrset (A_NORMAL); + wattrset (stdscr, A_NORMAL); mutt_refresh (); endwin (); } @@ -373,11 +373,11 @@ int _mutt_enter_fname (const char *prompt, char *buf, ssize_t blen, { event_t ch; - mvaddstr (LINES - 1, 0, (char *) prompt); - addstr (_(" ('?' for list): ")); + mvwaddstr (stdscr, LINES - 1, 0, (char *) prompt); + waddstr (stdscr, _(" ('?' for list): ")); if (buf[0]) - addstr (buf); - clrtoeol (); + waddstr (stdscr, buf); + wclrtoeol (stdscr); mutt_refresh (); ch = mutt_getch (); @@ -454,8 +454,8 @@ int mutt_multi_choice (const char *prompt, const char *letters) int choice; char *p; - mvaddstr (LINES - 1, 0, prompt); - clrtoeol (); + mvwaddstr (stdscr, LINES - 1, 0, prompt); + wclrtoeol (stdscr); for (;;) { mutt_refresh (); ch = mutt_getch (); @@ -497,7 +497,7 @@ int mutt_addwch (wchar_t wc) (n2 = wcrtomb(buf + n1, 0, &mbstate)) == -1) return -1; /* ERR */ else - return addstr (buf); + return waddstr (stdscr, buf); } ssize_t mutt_pretty_size(char *s, ssize_t len, ssize_t n) @@ -625,7 +625,7 @@ void mutt_format_s_tree (char *dest, ssize_t destlen, /* * mutt_paddstr (n, s) is almost equivalent to - * mutt_format_string (bigbuf, big, n, n, 0, ' ', s, big, 0), addstr (bigbuf) + * mutt_format_string (bigbuf, big, n, n, 0, ' ', s, big, 0), waddstr (stdscr, bigbuf) */ void mutt_paddstr (int n, const char *s) @@ -648,12 +648,12 @@ void mutt_paddstr (int n, const char *s) if (w >= 0) { if (w > n) break; - addnstr ((char *) s, k); + waddnstr (stdscr, (char *) s, k); n -= w; } } while (n-- > 0) - addch (' '); + waddch (stdscr, ' '); } /* this routine should be called after receiving SIGWINCH */ diff --git a/lib-ui/curs_main.c b/lib-ui/curs_main.c index 6ed90a1..3ba1c56 100644 --- a/lib-ui/curs_main.c +++ b/lib-ui/curs_main.c @@ -503,7 +503,7 @@ int mutt_index_menu (void) sidebar_draw_frames(); SETCOLOR (MT_COLOR_STATUS); BKGDSET (MT_COLOR_STATUS); - move(option (OPTSTATUSONTOP) ? 0 : LINES - 2,SW); + wmove(stdscr, option (OPTSTATUSONTOP) ? 0 : LINES - 2,SW); mutt_paddstr (COLS-SW, buf); SETCOLOR (MT_COLOR_NORMAL); BKGDSET (MT_COLOR_NORMAL); @@ -525,9 +525,9 @@ int mutt_index_menu (void) menu->oldcurrent = -1; if (option (OPTBRAILLEFRIENDLY)) - move (menu->current - menu->top + menu->offset, 0); + wmove (stdscr, menu->current - menu->top + menu->offset, 0); else - move (menu->current - menu->top + menu->offset, COLS - 1); + wmove (stdscr, menu->current - menu->top + menu->offset, COLS - 1); mutt_refresh (); if (SigWinch) { @@ -538,7 +538,7 @@ int mutt_index_menu (void) SigWinch = 0; menu->top = 0; /* so we scroll the right amount */ /* - * force a real complete redraw. clrtobot() doesn't seem to be able + * force a real complete redraw. wclrtobot(stdscr) doesn't seem to be able * to handle every case without this. */ clearok (stdscr, TRUE); @@ -567,8 +567,8 @@ int mutt_index_menu (void) tag = 1; /* give visual indication that the next command is a tag- command */ - mvaddstr (LINES - 1, 0, "tag-"); - clrtoeol (); + mvwaddstr (stdscr, LINES - 1, 0, "tag-"); + wclrtoeol (stdscr); /* get the real command */ if ((op = km_dokey (MENU_MAIN)) == OP_TAG_PREFIX) { @@ -602,8 +602,8 @@ int mutt_index_menu (void) tag = 1; /* give visual indication that the next command is a tag- command */ - mvaddstr (LINES - 1, 0, "tag-"); - clrtoeol (); + mvwaddstr (stdscr, LINES - 1, 0, "tag-"); + wclrtoeol (stdscr); /* get the real command */ if ((op = km_dokey (MENU_MAIN)) == OP_TAG_PREFIX) { diff --git a/lib-ui/curses.h b/lib-ui/curses.h index c639c86..f438395 100644 --- a/lib-ui/curses.h +++ b/lib-ui/curses.h @@ -30,12 +30,12 @@ #undef lines #endif /* lines */ -#define CLEARLINE_WIN(x) move(x,(option(OPTMBOXPANE)?SidebarWidth:0)), clrtoeol() -#define CLEARLINE(x) move(x,0), clrtoeol() -#define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x) +#define CLEARLINE_WIN(x) wmove(stdscr, x,(option(OPTMBOXPANE)?SidebarWidth:0)), wclrtoeol(stdscr) +#define CLEARLINE(x) wmove(stdscr, x,0), wclrtoeol(stdscr) +#define CENTERLINE(x,y) wmove(stdscr, y, (COLS-strlen(x))/2), waddstr(stdscr, x) #define BEEP() do { if (mod_core.beep) beep(); } while (0) -#define BKGDSET(x) bkgdset(ColorDefs[x] | ' ') +#define BKGDSET(x) wbkgdset(stdscr, ColorDefs[x] | ' ') void mutt_curs_set (int); #define PAGELEN (LINES-3) @@ -163,8 +163,8 @@ void _mutt_make_string (char *, ssize_t, const char *, CONTEXT *, HEADER *, format_flag); -#define SETCOLOR(X) attrset(ColorDefs[X]) -#define ADDCOLOR(X) attron(ColorDefs[X]) +#define SETCOLOR(X) wattrset(stdscr, ColorDefs[X]) +#define ADDCOLOR(X) wattron(stdscr, ColorDefs[X]) #define MAYBE_REDRAW(x) if (option (OPTNEEDREDRAW)) { unset_option (OPTNEEDREDRAW); x = REDRAW_FULL; } diff --git a/lib-ui/enter.c b/lib-ui/enter.c index 1005365..dcd5bcf 100644 --- a/lib-ui/enter.c +++ b/lib-ui/enter.c @@ -58,10 +58,10 @@ static int my_addwch (wchar_t wc) if (iswprint(wc) && n > 0) return mutt_addwch (wc); if (!(wc & ~0x7f)) - return printw ("^%c", ((int) wc + 0x40) & 0x7f); + return wprintw (stdscr, "^%c", ((int) wc + 0x40) & 0x7f); if (!(wc & ~0xffff)) - return printw ("\\u%04x", (int) wc); - return printw ("\\u%08x", (int) wc); + return wprintw (stdscr, "\\u%04x", (int) wc); + return wprintw (stdscr, "\\u%08x", (int) wc); } static size_t width_ceiling (const wchar_t * s, size_t n, int w1) @@ -243,7 +243,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, width_ceiling (state->wbuf, state->lastchar, my_wcswidth (state->wbuf, state->curpos) - width / 2); - move (y, x); + wmove (stdscr, y, x); w = 0; for (i = state->begin; i < state->lastchar; i++) { w += my_wcwidth (state->wbuf[i]); @@ -251,10 +251,10 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, break; my_addwch (state->wbuf[i]); } - clrtoeol (); - move (y, - x + my_wcswidth (state->wbuf + state->begin, - state->curpos - state->begin)); + wclrtoeol (stdscr); + wmove (stdscr, y, + x + my_wcswidth (state->wbuf + state->begin, + state->curpos - state->begin)); } mutt_refresh (); diff --git a/lib-ui/menu.c b/lib-ui/menu.c index 94619a3..9bd9e7b 100644 --- a/lib-ui/menu.c +++ b/lib-ui/menu.c @@ -38,52 +38,52 @@ static void print_enriched_string (int attr, unsigned char *s, int do_color) while (*s && *s < M_TREE_MAX) { switch (*s) { case M_TREE_LLCORNER: - addch (ACS_LLCORNER); + waddch (stdscr, ACS_LLCORNER); break; case M_TREE_ULCORNER: - addch (ACS_ULCORNER); + waddch (stdscr, ACS_ULCORNER); break; case M_TREE_LTEE: - addch (ACS_LTEE); + waddch (stdscr, ACS_LTEE); break; case M_TREE_HLINE: - addch (ACS_HLINE); + waddch (stdscr, ACS_HLINE); break; case M_TREE_VLINE: - addch (ACS_VLINE); + waddch (stdscr, ACS_VLINE); break; case M_TREE_TTEE: - addch (ACS_TTEE); + waddch (stdscr, ACS_TTEE); break; case M_TREE_BTEE: - addch (ACS_BTEE); + waddch (stdscr, ACS_BTEE); break; case M_TREE_SPACE: - addch (' '); + waddch (stdscr, ' '); break; case M_TREE_RARROW: - addch ('>'); + waddch (stdscr, '>'); break; case M_TREE_STAR: - addch ('*'); /* fake thread indicator */ + waddch (stdscr, '*'); /* fake thread indicator */ break; case M_TREE_HIDDEN: - addch ('&'); + waddch (stdscr, '&'); break; case M_TREE_EQUALS: - addch ('='); + waddch (stdscr, '='); break; case M_TREE_MISSING: - addch ('?'); + waddch (stdscr, '?'); break; } s++, n--; } if (do_color) - attrset (attr); + wattrset (stdscr, attr); } else if ((k = mbrtowc (&wc, (char *) s, n, &mbstate)) != (size_t)-1) { - addnstr ((char *) s, k); + waddnstr (stdscr, (char *) s, k); s += k, n -= k; } else @@ -115,13 +115,13 @@ static void menu_pad_string (char *s, size_t n) void menu_redraw_full (MUTTMENU * menu) { SETCOLOR (MT_COLOR_NORMAL); - /* clear() doesn't optimize screen redraws */ - move (0, 0); - clrtobot (); + /* wclear(stdscr) doesn't optimize screen redraws */ + wmove (stdscr, 0, 0); + wclrtobot (stdscr); if (option (OPTHELP)) { SETCOLOR (MT_COLOR_STATUS); - move (option (OPTSTATUSONTOP) ? LINES - 2 : 0, SW); + wmove (stdscr, option (OPTSTATUSONTOP) ? LINES - 2 : 0, SW); mutt_paddstr (COLS-SW, ""); SETCOLOR (MT_COLOR_NORMAL); menu->offset = 1; @@ -145,7 +145,7 @@ void menu_redraw_status (MUTTMENU * menu) snprintf (buf, sizeof (buf), M_MODEFMT, menu->title); SETCOLOR (MT_COLOR_STATUS); - move (option (OPTSTATUSONTOP) ? 0 : LINES - 2, SW); + wmove (stdscr, option (OPTSTATUSONTOP) ? 0 : LINES - 2, SW); mutt_paddstr (COLS-SW, buf); SETCOLOR (MT_COLOR_NORMAL); menu->redraw &= ~REDRAW_STATUS; @@ -162,7 +162,7 @@ void menu_redraw_index (MUTTMENU * menu) menu_make_entry (buf, sizeof (buf), menu, i); menu_pad_string (buf, sizeof (buf)); - attrset (menu->color (i)); + wattrset (stdscr, menu->color (i)); if (i == menu->current) { ADDCOLOR (MT_COLOR_INDICATOR); @@ -171,7 +171,7 @@ void menu_redraw_index (MUTTMENU * menu) CLEARLINE_WIN (i - menu->top + menu->offset); - move (i - menu->top + menu->offset, SW); + wmove (stdscr, i - menu->top + menu->offset, SW); print_enriched_string (menu->color (i), (unsigned char *) buf, i != menu->current); SETCOLOR (MT_COLOR_NORMAL); @@ -194,13 +194,13 @@ void menu_redraw_motion (MUTTMENU * menu) return; } - move (menu->oldcurrent + menu->offset - menu->top, SW); + wmove (stdscr, menu->oldcurrent + menu->offset - menu->top, SW); SETCOLOR (MT_COLOR_NORMAL); BKGDSET (MT_COLOR_NORMAL); /* erase the current indicator */ - attrset (menu->color (menu->oldcurrent)); - clrtoeol (); + wattrset (stdscr, menu->color (menu->oldcurrent)); + wclrtoeol (stdscr); menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent); menu_pad_string (buf, sizeof (buf)); print_enriched_string (menu->color (menu->oldcurrent), @@ -209,11 +209,11 @@ void menu_redraw_motion (MUTTMENU * menu) /* now draw the new one to reflect the change */ menu_make_entry (buf, sizeof (buf), menu, menu->current); menu_pad_string (buf, sizeof (buf)); - attrset (menu->color (menu->current)); + wattrset (stdscr, menu->color (menu->current)); ADDCOLOR (MT_COLOR_INDICATOR); BKGDSET (MT_COLOR_INDICATOR); CLEARLINE_WIN (menu->current - menu->top + menu->offset); - move (menu->current + menu->offset - menu->top, SW); + wmove (stdscr, menu->current + menu->offset - menu->top, SW); print_enriched_string (menu->color (menu->current), (unsigned char *) buf, 0); SETCOLOR (MT_COLOR_NORMAL); @@ -226,14 +226,14 @@ void menu_redraw_current (MUTTMENU * menu) { char buf[STRING]; - move (menu->current + menu->offset - menu->top, SW); + wmove (stdscr, menu->current + menu->offset - menu->top, SW); menu_make_entry (buf, sizeof (buf), menu, menu->current); menu_pad_string (buf, sizeof (buf)); - attrset (menu->color (menu->current)); + wattrset (stdscr, menu->color (menu->current)); ADDCOLOR (MT_COLOR_INDICATOR); BKGDSET (MT_COLOR_INDICATOR); - clrtoeol (); + wclrtoeol (stdscr); print_enriched_string (menu->color (menu->current), (unsigned char *) buf, 0); SETCOLOR (MT_COLOR_NORMAL); @@ -254,8 +254,8 @@ static void menu_redraw_prompt (MUTTMENU * menu) mutt_clear_error (); SETCOLOR (MT_COLOR_NORMAL); - mvaddstr (LINES - 1, 0, menu->prompt); - clrtoeol (); + mvwaddstr (stdscr, LINES - 1, 0, menu->prompt); + wclrtoeol (stdscr); } } @@ -701,9 +701,9 @@ int mutt_menuLoop (MUTTMENU * menu) menu->oldcurrent = menu->current; if (option (OPTBRAILLEFRIENDLY)) - move (menu->current - menu->top + menu->offset, SW); + wmove (stdscr, menu->current - menu->top + menu->offset, SW); else - move (menu->current - menu->top + menu->offset, COLS - 1); + wmove (stdscr, menu->current - menu->top + menu->offset, COLS - 1); mutt_refresh (); @@ -715,8 +715,8 @@ int mutt_menuLoop (MUTTMENU * menu) i = km_dokey (menu->menu); if (i == OP_TAG_PREFIX || i == OP_TAG_PREFIX_COND) { if (menu->tagged) { - mvaddstr (LINES - 1, 0, "Tag-"); - clrtoeol (); + mvwaddstr (stdscr, LINES - 1, 0, "Tag-"); + wclrtoeol (stdscr); i = km_dokey (menu->menu); menu->tagprefix = 1; CLEARLINE (LINES - 1); diff --git a/lib-ui/sidebar.c b/lib-ui/sidebar.c index d5434a9..4161bdc 100644 --- a/lib-ui/sidebar.c +++ b/lib-ui/sidebar.c @@ -217,7 +217,7 @@ static int make_sidebar_entry (char* sbox, int idx, ssize_t len) snprintf(entry, sizeof(entry), "%*s", (int)len, no); memcpy(entry, sbox, MIN(len - 1, m_strlen(sbox))); - addnstr(entry, len); + waddnstr(stdscr, entry, len); if (shortened) p_delete(&sbox); @@ -269,11 +269,11 @@ void sidebar_draw_frames (void) { /* draw vertical delimiter */ SETCOLOR (MT_COLOR_SIDEBAR); for (i = 0; i < LINES-1; i++) { - move (i, SidebarWidth - delim_len); + wmove (stdscr, i, SidebarWidth - delim_len); if (!m_strcmp(SidebarDelim, "|")) - addch (ACS_VLINE); + waddch (stdscr, ACS_VLINE); else - addstr (NONULL (SidebarDelim)); + waddstr (stdscr, NONULL (SidebarDelim)); } /* fill "gaps" at top+bottom */ @@ -284,16 +284,16 @@ void sidebar_draw_frames (void) { * gap with spaces to get bg color */ if (option(OPTSTATUSONTOP) || option(OPTHELP)) { - move(0,i); - addch(' '); + wmove(stdscr, 0,i); + waddch(stdscr, ' '); } /* * if we don't have $status_on_top or we have $help, fill bottom * gap with spaces to get bg color */ if (!option(OPTSTATUSONTOP) || option(OPTHELP)) { - move(LINES-2,i); - addch(' '); + wmove(stdscr, LINES-2,i); + waddch(stdscr, ' '); } } SETCOLOR (MT_COLOR_NORMAL); @@ -359,7 +359,7 @@ int sidebar_draw (void) { else SETCOLOR (MT_COLOR_NORMAL); - move (line, 0); + wmove (stdscr, line, 0); line += make_sidebar_entry (tmp->path, i, SidebarWidth-delim_len); } @@ -368,8 +368,8 @@ int sidebar_draw (void) { /* fill with blanks to bottom */ memset(&blank, ' ', sizeof(blank)); for (; line < last_line; line++) { - move (line, 0); - addnstr (blank, SidebarWidth-delim_len); + wmove (stdscr, line, 0); + waddnstr (stdscr, blank, SidebarWidth-delim_len); } return 0; } diff --git a/main.c b/main.c index 0387a17..f7e3193 100644 --- a/main.c +++ b/main.c @@ -460,7 +460,7 @@ int main (int argc, char **argv) if (!option (OPTNOCURSES)) { SETCOLOR (MT_COLOR_NORMAL); - clear (); + wclear (stdscr); mutt_error = mutt_curses_error; mutt_message = mutt_curses_message; } diff --git a/pager.c b/pager.c index 78c13a9..14ad1f7 100644 --- a/pager.c +++ b/pager.c @@ -149,12 +149,12 @@ resolve_color (struct line_t *lineInfo, int n, int cnt, int flags, int search = 0, i, m; if (!cnt) - last_color = -1; /* force attrset() */ + last_color = -1; /* force wattrset(stdscr) */ if (lineInfo[n].continuation) { if (!cnt && option (OPTMARKERS)) { SETCOLOR (MT_COLOR_MARKERS); - addch ('+'); + waddch (stdscr, '+'); last_color = ColorDefs[MT_COLOR_MARKERS]; } m = (lineInfo[n].syntax)[0].first; @@ -246,7 +246,7 @@ resolve_color (struct line_t *lineInfo, int n, int cnt, int flags, } if (color != last_color) { - attrset (color); + wattrset (stdscr, color); last_color = color; } } @@ -938,7 +938,7 @@ static int format_line (struct line_t **lineInfo, int n, unsigned char *buf, break; col += 4; if (pa) - printw ("\\%03o", buf[ch]); + wprintw (stdscr, "\\%03o", buf[ch]); k = 1; continue; } @@ -1002,7 +1002,7 @@ static int format_line (struct line_t **lineInfo, int n, unsigned char *buf, break; if (pa) for (; col < t; col++) - addch (' '); + waddch (stdscr, ' '); else col = t; } @@ -1011,20 +1011,20 @@ static int format_line (struct line_t **lineInfo, int n, unsigned char *buf, break; col += 2; if (pa) - printw ("^%c", ('@' + wc) & 0x7f); + wprintw (stdscr, "^%c", ('@' + wc) & 0x7f); } else if (wc < 0x100) { if (col + 4 > wrap_cols) break; col += 4; if (pa) - printw ("\\%03o", wc); + wprintw (stdscr, "\\%03o", wc); } else { if (col + 1 > wrap_cols) break; ++col; if (pa) - addch (CharsetReplacement); + waddch (stdscr, CharsetReplacement); } } *pspace = space; @@ -1235,8 +1235,8 @@ display_line (FILE * f, off_t *last_pos, struct line_t **lineInfo, int n, /* * Fill the blank space at the end of the line with the prevailing color. - * ncurses does an implicit clrtoeol() when you do addch('\n') so we have - * to make sure to reset the color *after* that + * ncurses does an implicit wclrtoeol(stdscr) when you do waddch(stdscr, + * '\n') so we have to make sure to reset the color *after* that */ if (flags & M_SHOWCOLOR) { m = ((*lineInfo)[n].continuation) ? ((*lineInfo)[n].syntax)[0].first : n; @@ -1245,14 +1245,14 @@ display_line (FILE * f, off_t *last_pos, struct line_t **lineInfo, int n, else def_color = ColorDefs[(*lineInfo)[m].type]; - attrset (def_color); - bkgdset (def_color | ' '); + wattrset (stdscr, def_color); + wbkgdset (stdscr, def_color | ' '); } - addch ('\n'); + waddch (stdscr, '\n'); /* * reset the color back to normal. This *must* come after the - * addch('\n'), otherwise the color for this line will not be + * waddch(stdscr, '\n'), otherwise the color for this line will not be * filled to the right margin. */ if (flags & M_SHOWCOLOR) { @@ -1356,9 +1356,9 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) if (redraw & REDRAW_FULL) { SETCOLOR (MT_COLOR_NORMAL); - /* clear() doesn't optimize screen redraws */ - move (0, 0); - clrtobot (); + /* wclear(stdscr) doesn't optimize screen redraws */ + wmove (stdscr, 0, 0); + wclrtobot (stdscr); if (IsHeader (extra) && Context->vcount + 1 < PagerIndexLines) indexlen = Context->vcount + 1; @@ -1387,7 +1387,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) if (option (OPTHELP)) { SETCOLOR (MT_COLOR_STATUS); - move (helpoffset, SW); + wmove (stdscr, helpoffset, SW); mutt_paddstr (COLS-SW, ""); SETCOLOR (MT_COLOR_NORMAL); } @@ -1454,7 +1454,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) if ((redraw & REDRAW_BODY) || topline != oldtopline) { do { - move (bodyoffset, SW); + wmove (stdscr, bodyoffset, SW); curline = oldtopline = topline; lines = 0; force_redraw = 0; @@ -1467,7 +1467,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) &SearchRE) > 0) lines++; curline++; - move (lines + bodyoffset, SW); + wmove (stdscr, lines + bodyoffset, SW); redraw |= REDRAW_SIDEBAR; } last_offset = lineInfo[curline].offset; @@ -1476,12 +1476,12 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) SETCOLOR (MT_COLOR_TILDE); BKGDSET (MT_COLOR_TILDE); while (lines < bodylen) { - clrtoeol (); + wclrtoeol (stdscr); if (option (OPTTILDE)) - addch ('~'); - addch ('\n'); + waddch (stdscr, '~'); + waddch (stdscr, '\n'); lines++; - move (lines + bodyoffset, SW); + wmove (stdscr, lines + bodyoffset, SW); } /* We are going to update the pager status bar, so it isn't * necessary to reset to normal color now. */ @@ -1508,15 +1508,15 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) _mutt_make_string (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), Context, extra->bdy->hdr, M_FORMAT_MAKEPRINT); } - move(statusoffset,SW); + wmove(stdscr, statusoffset,SW); mutt_paddstr (COLS - 10 - SW, IsHeader (extra) || IsMsgAttach (extra) ? buffer : banner); - addstr (" -- ("); + waddstr (stdscr, " -- ("); if (last_pos < sb.st_size - 1) - printw ("%d%%)", (int) (100 * last_offset / sb.st_size)); + wprintw (stdscr, "%d%%)", (int) (100 * last_offset / sb.st_size)); else - addstr (topline == 0 ? "all)" : "end)"); + waddstr (stdscr, topline == 0 ? "all)" : "end)"); BKGDSET (MT_COLOR_NORMAL); SETCOLOR (MT_COLOR_NORMAL); } @@ -1531,7 +1531,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) sidebar_draw (); /* print out the pager_index status bar */ menu_status_line (buffer, sizeof (buffer), pager_index, NONULL (Status)); - move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), SW); + wmove (stdscr, indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), SW); SETCOLOR (MT_COLOR_STATUS); BKGDSET (MT_COLOR_STATUS); mutt_paddstr (COLS-SW, buffer); @@ -1546,11 +1546,11 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) if (option(OPTBRAILLEFRIENDLY)) { if (brailleLine!=-1) { - move(brailleLine+1, 0); + wmove(stdscr, brailleLine+1, 0); brailleLine = -1; } } else - move (statusoffset, COLS-1); + wmove (stdscr, statusoffset, COLS-1); mutt_refresh (); if (IsHeader (extra) && OldHdr == extra->hdr && TopLine != topline diff --git a/remailer.c b/remailer.c index 137e5a4..1118345 100644 --- a/remailer.c +++ b/remailer.c @@ -255,11 +255,11 @@ static void mix_redraw_ce (remailer_t ** type2_list, else SETCOLOR (MT_COLOR_NORMAL); - mvaddstr (coords[i].r, coords[i].c, type2_list[chain->ch[i]]->shortname); + mvwaddstr (stdscr, coords[i].r, coords[i].c, type2_list[chain->ch[i]]->shortname); SETCOLOR (MT_COLOR_NORMAL); if (i + 1 < chain->cl) - addstr (", "); + waddstr (stdscr, ", "); } } @@ -272,8 +272,8 @@ static void mix_redraw_chain (remailer_t ** type2_list, BKGDSET (MT_COLOR_NORMAL); for (i = MIX_VOFFSET; i < MIX_MAXROW; i++) { - move (i, 0); - clrtoeol (); + wmove (stdscr, i, 0); + wclrtoeol (stdscr); } for (i = 0; i < chain->cl; i++) @@ -283,11 +283,11 @@ static void mix_redraw_chain (remailer_t ** type2_list, static void mix_redraw_head (mixchain_t * chain) { SETCOLOR (MT_COLOR_STATUS); - mvprintw (MIX_VOFFSET - 1, 0, "-- Remailer chain [Length: %d]", + mvwprintw (stdscr, MIX_VOFFSET - 1, 0, "-- Remailer chain [Length: %d]", chain ? chain->cl : 0); BKGDSET (MT_COLOR_STATUS); - clrtoeol (); + wclrtoeol (stdscr); BKGDSET (MT_COLOR_NORMAL); SETCOLOR (MT_COLOR_NORMAL);