From: Richard Russon Date: Tue, 12 Mar 2019 16:01:15 +0000 (+0000) Subject: rename struct Event and Mailbox.notify X-Git-Tag: 2019-10-25~204^2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=61c12c912b816d97fbad1f2408d2f6b7f873bbd6;p=neomutt rename struct Event and Mailbox.notify Rename things out of the way of future work. These names will be used by a general notifications system. --- diff --git a/curs_lib.c b/curs_lib.c index 15bdf002e..88c531f09 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -82,14 +82,14 @@ bool C_MetaKey; ///< Config: Interpret 'ALT-x' as 'ESC-x' */ static size_t MacroBufferCount = 0; static size_t MacroBufferLen = 0; -static struct Event *MacroEvents; +static struct KeyEvent *MacroEvents; /* These are used in all other "normal" situations, and are not * ignored when setting OptIgnoreMacroEvents */ static size_t UngetCount = 0; static size_t UngetLen = 0; -static struct Event *UngetKeyEvents; +static struct KeyEvent *UngetKeyEvents; int MuttGetchTimeout = -1; @@ -166,7 +166,7 @@ static int mutt_monitor_getch(void) /** * mutt_getch - Read a character from the input buffer - * @retval obj Event to process + * @retval obj KeyEvent to process * * The priority for reading events is: * 1. UngetKeyEvents buffer @@ -177,11 +177,11 @@ static int mutt_monitor_getch(void) * - Error `{ -1, OP_NULL }` * - Timeout `{ -2, OP_NULL }` */ -struct Event mutt_getch(void) +struct KeyEvent mutt_getch(void) { int ch; - struct Event err = { -1, OP_NULL }, ret; - struct Event timeout = { -2, OP_NULL }; + struct KeyEvent err = { -1, OP_NULL }, ret; + struct KeyEvent timeout = { -2, OP_NULL }; if (UngetCount) return UngetKeyEvents[--UngetCount]; @@ -331,7 +331,7 @@ void mutt_edit_file(const char *editor, const char *file) */ enum QuadOption mutt_yesorno(const char *msg, enum QuadOption def) { - struct Event ch; + struct KeyEvent ch; char *yes = _("yes"); char *no = _("no"); char *answer_string = NULL; @@ -637,7 +637,7 @@ int mutt_buffer_enter_fname_full(const char *prompt, struct Buffer *fname, bool mailbox, bool multiple, char ***files, int *numfiles, SelectFileFlags flags) { - struct Event ch; + struct KeyEvent ch; SET_COLOR(MT_COLOR_PROMPT); mutt_window_mvaddstr(MuttMessageWindow, 0, 0, (char *) prompt); @@ -699,13 +699,13 @@ int mutt_buffer_enter_fname_full(const char *prompt, struct Buffer *fname, */ void mutt_unget_event(int ch, int op) { - struct Event tmp; + struct KeyEvent tmp; tmp.ch = ch; tmp.op = op; if (UngetCount >= UngetLen) - mutt_mem_realloc(&UngetKeyEvents, (UngetLen += 16) * sizeof(struct Event)); + mutt_mem_realloc(&UngetKeyEvents, (UngetLen += 16) * sizeof(struct KeyEvent)); UngetKeyEvents[UngetCount++] = tmp; } @@ -736,13 +736,13 @@ void mutt_unget_string(const char *s) */ void mutt_push_macro_event(int ch, int op) { - struct Event tmp; + struct KeyEvent tmp; tmp.ch = ch; tmp.op = op; if (MacroBufferCount >= MacroBufferLen) - mutt_mem_realloc(&MacroEvents, (MacroBufferLen += 128) * sizeof(struct Event)); + mutt_mem_realloc(&MacroEvents, (MacroBufferLen += 128) * sizeof(struct KeyEvent)); MacroEvents[MacroBufferCount++] = tmp; } @@ -823,7 +823,7 @@ void mutt_curs_set(int cursor) */ int mutt_multi_choice(const char *prompt, const char *letters) { - struct Event ch; + struct KeyEvent ch; int choice; bool redraw = true; int prompt_lines = 1; diff --git a/curs_lib.h b/curs_lib.h index 7207190c8..89a8ef777 100644 --- a/curs_lib.h +++ b/curs_lib.h @@ -61,7 +61,7 @@ void mutt_format_s(char *buf, size_t buflen, const char *prec, const cha void mutt_format_s_tree(char *buf, size_t buflen, const char *prec, const char *s); void mutt_format_s_x(char *buf, size_t buflen, const char *prec, const char *s, bool arboreal); void mutt_getch_timeout(int delay); -struct Event mutt_getch(void); +struct KeyEvent mutt_getch(void); int mutt_get_field_full(const char *field, char *buf, size_t buflen, CompletionFlags complete, bool multiple, char ***files, int *numfiles); int mutt_get_field_unbuffered(const char *msg, char *buf, size_t buflen, CompletionFlags flags); int mutt_multi_choice(const char *prompt, const char *letters); diff --git a/enter.c b/enter.c index d7ad1ad74..10249956f 100644 --- a/enter.c +++ b/enter.c @@ -699,7 +699,7 @@ int mutt_enter_string_full(char *buf, size_t buflen, int col, case OP_EDITOR_QUOTE_CHAR: { - struct Event event; + struct KeyEvent event; do { event = mutt_getch(); diff --git a/flags.c b/flags.c index 89d0e2cf2..d121ade71 100644 --- a/flags.c +++ b/flags.c @@ -436,7 +436,7 @@ int mutt_change_flag(struct Mailbox *m, struct EmailList *el, bool bf) return -1; int flag; - struct Event event; + struct KeyEvent event; mutt_window_mvprintw(MuttMessageWindow, 0, 0, "%s? (D/N/O/r/*/!): ", bf ? _("Set flag") : _("Clear flag")); diff --git a/keymap.c b/keymap.c index c8e80d9db..356658c96 100644 --- a/keymap.c +++ b/keymap.c @@ -568,7 +568,7 @@ static int retry_generic(int menu, keycode_t *keys, int keyslen, int lastkey) */ int km_dokey(int menu) { - struct Event tmp; + struct KeyEvent tmp; struct Keymap *map = Keymaps[menu]; int pos = 0; int n = 0; diff --git a/mailbox.c b/mailbox.c index fff3864b0..062e391c2 100644 --- a/mailbox.c +++ b/mailbox.c @@ -558,10 +558,10 @@ void mutt_mailbox_next(struct Mailbox *m_cur, char *s, size_t slen) */ void mutt_mailbox_changed(struct Mailbox *m, enum MailboxNotification action) { - if (!m || !m->notify) + if (!m || !m->notify2) return; - m->notify(m, action); + m->notify2(m, action); } /** diff --git a/mailbox.h b/mailbox.h index 5480020f2..d88b8e4ff 100644 --- a/mailbox.h +++ b/mailbox.h @@ -140,7 +140,7 @@ struct Mailbox void *mdata; /**< driver specific data */ void (*free_mdata)(void **); /**< driver-specific data free function */ - void (*notify)(struct Mailbox *m, enum MailboxNotification action); ///< Notification callback + void (*notify2)(struct Mailbox *m, enum MailboxNotification action); ///< Notification callback void *ndata; ///< Notification callback private data }; diff --git a/menu.c b/menu.c index d45a14318..d1d403029 100644 --- a/menu.c +++ b/menu.c @@ -1255,13 +1255,13 @@ static int menu_dialog_translate_op(int i) /** * menu_dialog_dokey - Check if there are any menu key events to process * @param menu Current Menu - * @param ip Event ID + * @param ip KeyEvent ID * @retval 0 An event occurred for the menu, or a timeout * @retval -1 There was an event, but not for menu */ static int menu_dialog_dokey(struct Menu *menu, int *ip) { - struct Event ch; + struct KeyEvent ch; char *p = NULL; do diff --git a/mutt_curses.h b/mutt_curses.h index 4cad37451..7ebbddcb0 100644 --- a/mutt_curses.h +++ b/mutt_curses.h @@ -103,9 +103,9 @@ void mutt_curs_set(int cursor); #endif /** - * struct Event - An event such as a keypress + * struct KeyEvent - An event such as a keypress */ -struct Event +struct KeyEvent { int ch; /**< raw key pressed */ int op; /**< function op */ diff --git a/mx.c b/mx.c index 460d069b6..68f2a9552 100644 --- a/mx.c +++ b/mx.c @@ -366,7 +366,7 @@ struct Context *mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags) } OptForceRefresh = false; - m->notify = ctx_mailbox_changed; + m->notify2 = ctx_mailbox_changed; m->ndata = ctx; return ctx; @@ -394,7 +394,7 @@ void mx_fastclose_mailbox(struct Mailbox *m) m->mx_ops->mbox_close(m); mutt_mailbox_changed(m, MBN_CLOSED); - m->notify = NULL; + m->notify2 = NULL; mutt_hash_free(&m->subj_hash); mutt_hash_free(&m->id_hash);