From 586e89b1916d944b22bf10523aca8c8eb9fb9c85 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sun, 21 May 2006 14:15:24 +0000 Subject: [PATCH] Fixed bug with keyboard on GNU/Hurd: use only one select(), waiting for better solution --- src/gui/curses/gui-curses-main.c | 18 +++++++++++++++++- weechat/src/gui/curses/gui-curses-main.c | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c index 2588443b1..f0a454ab2 100644 --- a/src/gui/curses/gui-curses-main.c +++ b/src/gui/curses/gui-curses-main.c @@ -145,7 +145,10 @@ gui_main_loop () } /* read keyboard */ - + + /* on GNU/Hurd 2 select() are causing troubles with keyboard */ + /* waiting for a fix, we use only one select() */ +#ifndef __GNU__ FD_ZERO (&read_fd); timeout.tv_sec = 0; timeout.tv_usec = 8000; @@ -159,13 +162,20 @@ gui_main_loop () gui_keyboard_read (); } } +#endif /* read sockets (servers, child process when connecting, FIFO pipe) */ FD_ZERO (&read_fd); +#ifdef __GNU__ + timeout.tv_sec = 0; + timeout.tv_usec = 10000; + FD_SET (STDIN_FILENO, &read_fd); +#else timeout.tv_sec = 0; timeout.tv_usec = 2000; +#endif if (weechat_fifo != -1) FD_SET (weechat_fifo, &read_fd); @@ -220,6 +230,12 @@ gui_main_loop () if (select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout) > 0) { +#ifdef __GNU__ + if (FD_ISSET (STDIN_FILENO, &read_fd)) + { + gui_keyboard_read (); + } +#endif if ((weechat_fifo != -1) && (FD_ISSET (weechat_fifo, &read_fd))) { fifo_read (); diff --git a/weechat/src/gui/curses/gui-curses-main.c b/weechat/src/gui/curses/gui-curses-main.c index 2588443b1..f0a454ab2 100644 --- a/weechat/src/gui/curses/gui-curses-main.c +++ b/weechat/src/gui/curses/gui-curses-main.c @@ -145,7 +145,10 @@ gui_main_loop () } /* read keyboard */ - + + /* on GNU/Hurd 2 select() are causing troubles with keyboard */ + /* waiting for a fix, we use only one select() */ +#ifndef __GNU__ FD_ZERO (&read_fd); timeout.tv_sec = 0; timeout.tv_usec = 8000; @@ -159,13 +162,20 @@ gui_main_loop () gui_keyboard_read (); } } +#endif /* read sockets (servers, child process when connecting, FIFO pipe) */ FD_ZERO (&read_fd); +#ifdef __GNU__ + timeout.tv_sec = 0; + timeout.tv_usec = 10000; + FD_SET (STDIN_FILENO, &read_fd); +#else timeout.tv_sec = 0; timeout.tv_usec = 2000; +#endif if (weechat_fifo != -1) FD_SET (weechat_fifo, &read_fd); @@ -220,6 +230,12 @@ gui_main_loop () if (select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout) > 0) { +#ifdef __GNU__ + if (FD_ISSET (STDIN_FILENO, &read_fd)) + { + gui_keyboard_read (); + } +#endif if ((weechat_fifo != -1) && (FD_ISSET (weechat_fifo, &read_fd))) { fifo_read ();