[Mplayer-cvslog] CVS: main/osdep getch2-win.c,1.1,1.2

Sascha Sommer CVS faust3 at mplayerhq.hu
Sat Apr 19 11:19:53 CEST 2003


Update of /cvsroot/mplayer/main/osdep
In directory mail:/var/tmp.root/cvs-serv12743/osdep

Modified Files:
	getch2-win.c 
Log Message:
disable getch2 on windows when we can't read stdin (msys)

Index: getch2-win.c
===================================================================
RCS file: /cvsroot/mplayer/main/osdep/getch2-win.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- getch2-win.c	30 Mar 2003 21:20:04 -0000	1.1
+++ getch2-win.c	19 Apr 2003 09:19:30 -0000	1.2
@@ -14,11 +14,13 @@
 }
 
 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 @@
 	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(){



More information about the MPlayer-cvslog mailing list