disable getch2 on windows when we can't read stdin (msys)

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9937 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
faust3 2003-04-19 09:19:30 +00:00
parent deccdf4e31
commit c1db2fc351
1 changed files with 10 additions and 3 deletions

View File

@ -14,11 +14,13 @@ void get_screen_size(){
}
static HANDLE stdin;
static int getch2_status=0;
int getch2(int time){
INPUT_RECORD eventbuffer[128];
DWORD retval;
int i=0;
if(!getch2_status)return -1;
/*check if there are input events*/
if(!GetNumberOfConsoleInputEvents(stdin,&retval))
{
@ -95,11 +97,16 @@ int getch2(int time){
return -1;
}
static int getch2_status=0;
void getch2_enable(){
stdin = GetStdHandle(STD_INPUT_HANDLE);
getch2_status=1;
int retval;
stdin = GetStdHandle(STD_INPUT_HANDLE);
if(!GetNumberOfConsoleInputEvents(stdin,&retval))
{
printf("getch2: %i can't get number of input events [disabling console input]\n",GetLastError());
getch2_status = 0;
}
else getch2_status=1;
}
void getch2_disable(){