44 #if ( defined(UNIX) && !defined(WIN32) )
46 # include <visp/vpKeyboard.h>
57 vpKeyboard::vpKeyboard()
65 vpKeyboard::~vpKeyboard()
90 struct timeval tv = { 0, 0 };
94 FD_SET(STDIN_FILENO, &readfds);
96 return select(STDIN_FILENO + 1, &readfds, NULL, NULL, &tv) == 1;
127 vpKeyboard::setRawMode(
bool active)
131 tcgetattr(STDIN_FILENO, &initial_settings);
133 new_settings = initial_settings;
135 new_settings = initial_settings;
136 new_settings.c_lflag &= (
unsigned int)~ICANON;
137 new_settings.c_lflag &= (
unsigned int)~ECHO;
138 new_settings.c_lflag &= (
unsigned int)~ISIG;
141 new_settings.c_oflag &= (
unsigned int)~TAB0;
143 new_settings.c_cc[VMIN] = 1;
144 new_settings.c_cc[VTIME] = 0;
145 tcsetattr(STDIN_FILENO, TCSANOW, &new_settings);
149 tcsetattr(STDIN_FILENO, TCSANOW, &initial_settings);
153 #endif // defined UNIX