[Mplayer-cvslog] CVS: main/osdep getch2-win.c,1.4,1.5

Sascha Sommer CVS faust3 at mplayerhq.hu
Mon Sep 22 13:31:54 CEST 2003


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

Modified Files:
	getch2-win.c 
Log Message:
add a read function for slave mode on mingw

Index: getch2-win.c
===================================================================
RCS file: /cvsroot/mplayer/main/osdep/getch2-win.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- getch2-win.c	1 Jun 2003 12:33:32 -0000	1.4
+++ getch2-win.c	22 Sep 2003 11:31:51 -0000	1.5
@@ -6,6 +6,25 @@
 
 #include <windows.h>
 #include "keycodes.h"
+#include "../input/input.h"
+
+int mp_input_win32_slave_cmd_func(int fd,char* dest,int size){
+  DWORD i,retval;
+  int x=0;
+  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(x)return x;
+  return MP_INPUT_NOTHING;
+}
 
 int screen_width=80;
 int screen_height=24;



More information about the MPlayer-cvslog mailing list