gui: Check stdin for readability.
authorAndre Noll <maan@systemlinux.org>
Mon, 25 Mar 2013 02:14:06 +0000 (02:14 +0000)
committerAndre Noll <maan@systemlinux.org>
Thu, 2 May 2013 17:56:08 +0000 (19:56 +0200)
If the select_loop of para_gui runs in getch or command mode we
currently wait a full timeout period before checking for pending
input.

This patch adds stdin to the set of file descriptors monitored by
select so that a key press causes select() to return immediately.

gui.c

diff --git a/gui.c b/gui.c
index 728fb9b..9ac24ab 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -993,6 +993,8 @@ repeat:
                if (command_fds[1] >= 0)
                        para_fd_set(command_fds[1], &rfds, &max_fileno);
        }
+       if (mode == GETCH_MODE || mode == COMMAND_MODE)
+               para_fd_set(STDIN_FILENO, &rfds, &max_fileno);
        ret = para_select(max_fileno + 1, &rfds, NULL, &tv);
        if (ret <= 0)
                goto check_return; /* skip fd checks */