summaryrefslogtreecommitdiffstats
path: root/osdep/getch2-win.c
diff options
context:
space:
mode:
authorfaust3 <faust3@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-04-19 09:19:30 +0000
committerfaust3 <faust3@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-04-19 09:19:30 +0000
commitc1db2fc3513d6617380fde4f98a97a72481e6d69 (patch)
tree35fed6254e90371458074ffaf70271b66b285e4b /osdep/getch2-win.c
parentdeccdf4e31867f95c86f3aef675afb1ae2c5bbdc (diff)
downloadmpv-c1db2fc3513d6617380fde4f98a97a72481e6d69.tar.bz2
mpv-c1db2fc3513d6617380fde4f98a97a72481e6d69.tar.xz
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
Diffstat (limited to 'osdep/getch2-win.c')
-rw-r--r--osdep/getch2-win.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/osdep/getch2-win.c b/osdep/getch2-win.c
index e7ac725771..96f6878d2b 100644
--- a/osdep/getch2-win.c
+++ b/osdep/getch2-win.c
@@ -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(){