mutt_menu_set_current_redraw_full();
}
+/* delay is just like for timeout() or poll():
+ * the number of milliseconds mutt_getch() should block for input.
+ * delay == 0 means mutt_getch() is non-blocking.
+ * delay < 0 means mutt_getch is blocking.
+ */
+void mutt_getch_timeout(int delay)
+{
+ timeout(delay);
+#ifdef USE_INOTIFY
+ mutt_monitor_set_poll_timeout(delay);
+#endif
+}
+
/**
* mutt_getch - Read a character from the input buffer
* @retval obj Event to process
mutt_refresh();
/* SigWinch is not processed unless timeout is set */
- timeout(30 * 1000);
+ mutt_getch_timeout(30 * 1000);
ch = mutt_getch();
- timeout(-1);
+ mutt_getch_timeout(-1);
if (ch.ch == -2)
continue;
if (CI_is_return(ch.ch))
mutt_flushinp();
curs_set(1);
if (Timeout)
- timeout(-1); /* restore blocking operation */
+ mutt_getch_timeout(-1); /* restore blocking operation */
if (mutt_yesorno(_("Exit NeoMutt?"), MUTT_YES) == MUTT_YES)
{
mutt_exit(1);
mutt_refresh();
/* SigWinch is not processed unless timeout is set */
- timeout(30 * 1000);
+ mutt_getch_timeout(30 * 1000);
ch = mutt_getch();
- timeout(-1);
+ mutt_getch_timeout(-1);
if (ch.ch == -2)
continue;
/* (ch.ch == 0) is technically possible. Treat the same as < 0 (abort) */
void mutt_format_s(char *buf, size_t buflen, const char *prec, const char *s);
void mutt_format_s_tree(char *buf, size_t buflen, const char *prec, const char *s);
struct Event mutt_getch(void);
+void mutt_getch_timeout(int);
int mutt_get_field_full(const char *field, char *buf, size_t buflen, int complete, bool multiple, char ***files, int *numfiles);
int mutt_get_field_unbuffered(char *msg, char *buf, size_t buflen, int flags);
int mutt_multi_choice(const char *prompt, const char *letters);
{
while (ImapKeepalive && ImapKeepalive < i)
{
- timeout(ImapKeepalive * 1000);
+ mutt_getch_timeout(ImapKeepalive * 1000);
tmp = mutt_getch();
- timeout(-1);
+ mutt_getch_timeout(-1);
/* If a timeout was not received, or the window was resized, exit the
* loop now. Otherwise, continue to loop until reaching a total of
* $timeout seconds.
}
#endif
- timeout(i * 1000);
+ mutt_getch_timeout(i * 1000);
tmp = mutt_getch();
- timeout(-1);
+ mutt_getch_timeout(-1);
#ifdef USE_IMAP
gotkey:
static size_t PollFdsCount = 0;
static size_t PollFdsLen = 0;
static struct pollfd *PollFds;
+static int PollTimeout = -1;
struct MonitorInfo
{
return new_descr;
}
+void mutt_monitor_set_poll_timeout(int timeout)
+{
+ PollTimeout = timeout;
+}
+
#define EVENT_BUFLEN MAX(4096, sizeof(struct inotify_event) + NAME_MAX + 1)
/* mutt_monitor_poll: Waits for I/O ready file descriptors or signals.
if (INotifyFd != -1)
{
- fds = poll(PollFds, PollFdsLen, -1);
+ fds = poll(PollFds, PollFdsLen, PollTimeout);
if (fds == -1)
{
int mutt_monitor_add(struct Mailbox *b);
int mutt_monitor_remove(struct Mailbox *b);
+void mutt_monitor_set_poll_timeout(int timeout);
int mutt_monitor_poll(void);
#endif /* _MUTT_MONITOR_H */