From ac3db36de8fb8163d9f0d4e5941f09b26f3d74cf Mon Sep 17 00:00:00 2001 From: ArthurSonzogni Date: Sat, 2 May 2020 20:11:07 +0200 Subject: [PATCH] Stop using fcntl This fixes issue 16 https://github.com/ArthurSonzogni/FTXUI/issues/16 Some terminal like gnome-terminal seems not to support it correctly. It turns out it wasn't totally useful using it. --- src/ftxui/component/screen_interactive.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ftxui/component/screen_interactive.cpp b/src/ftxui/component/screen_interactive.cpp index 2029cc7..7af68d3 100644 --- a/src/ftxui/component/screen_interactive.cpp +++ b/src/ftxui/component/screen_interactive.cpp @@ -26,7 +26,6 @@ #else #include #include - #include #endif // Quick exit is missing in standard CLang headers @@ -106,7 +105,6 @@ int CheckStdinReady(int usec_timeout) { void UnixEventListener(std::atomic* quit, Sender sender) { const int buffer_size = 100; const int timeout_usec = 50000; - // short CHAR_AVAILABLE_TO_READ = POLLIN | POLLPRI; while (!*quit) { if (!CheckStdinReady(timeout_usec)) @@ -219,9 +217,9 @@ void ScreenInteractive::Loop(Component* component) { terminal.c_lflag &= ~ECHO; // Do not print after a key press. terminal.c_cc[VMIN] = 0; terminal.c_cc[VTIME] = 0; - auto oldf = fcntl(STDIN_FILENO, F_GETFL, 0); - fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK); - on_exit_functions.push([=] { fcntl(STDIN_FILENO, F_GETFL, oldf); }); + //auto oldf = fcntl(STDIN_FILENO, F_GETFL, 0); + //fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK); + //on_exit_functions.push([=] { fcntl(STDIN_FILENO, F_GETFL, oldf); }); tcsetattr(STDIN_FILENO, TCSANOW, &terminal);