[Mplayer-cvslog] CVS: main/osdep getch2-win.c,1.5,1.6
Sascha Sommer CVS
syncmail at mplayerhq.hu
Fri Aug 13 15:32:45 CEST 2004
CVS change done by Sascha Sommer CVS
Update of /cvsroot/mplayer/main/osdep
In directory mail:/var2/tmp/cvs-serv24489/osdep
Modified Files:
getch2-win.c
Log Message:
fix slave mode for mingw, patch by Anton Ragnarsson <anton.ragnarsson.1093 at student.uu.se> some cleanup by be
Index: getch2-win.c
===================================================================
RCS file: /cvsroot/mplayer/main/osdep/getch2-win.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- getch2-win.c 22 Sep 2003 11:31:51 -0000 1.5
+++ getch2-win.c 13 Aug 2004 13:32:43 -0000 1.6
@@ -9,20 +9,14 @@
#include "../input/input.h"
int mp_input_win32_slave_cmd_func(int fd,char* dest,int size){
- DWORD i,retval;
- int x=0;
+ DWORD retval;
HANDLE stdin = GetStdHandle(STD_INPUT_HANDLE);
- INPUT_RECORD eventbuffer[250];
- if(!GetNumberOfConsoleInputEvents(stdin,&retval) || !retval)return MP_INPUT_NOTHING;
- ReadConsoleInput(stdin,eventbuffer,250,&retval);
- for(i = 0; i < retval; i++){
- if(eventbuffer[i].EventType==KEY_EVENT&&eventbuffer[i].Event.KeyEvent.bKeyDown== TRUE){
- if(eventbuffer[i].Event.KeyEvent.wVirtualKeyCode==VK_RETURN)dest[x]='\n';
- else dest[x]=eventbuffer[i].Event.KeyEvent.uChar.AsciiChar;
- ++x;
- }
+ if(!PeekNamedPipe(stdin, NULL, size, &retval, NULL, NULL) || !retval){
+ return MP_INPUT_NOTHING;
}
- if(x)return x;
+ if(retval>size)retval=size;
+ ReadFile(stdin, dest, retval, &retval, NULL);
+ if(retval)return retval;
return MP_INPUT_NOTHING;
}
More information about the MPlayer-cvslog
mailing list