summaryrefslogtreecommitdiffstats
path: root/osdep
diff options
context:
space:
mode:
authorfaust3 <faust3@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-09-22 11:31:51 +0000
committerfaust3 <faust3@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-09-22 11:31:51 +0000
commite27e245ffe2cd6da034e8bbf2703351b7738df57 (patch)
tree9d71bc1f94b74e886d567733213c4574627f9474 /osdep
parent4cafcfff45e215fa29537fedd4ca85006895882b (diff)
downloadmpv-e27e245ffe2cd6da034e8bbf2703351b7738df57.tar.bz2
mpv-e27e245ffe2cd6da034e8bbf2703351b7738df57.tar.xz
add a read function for slave mode on mingw
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10929 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'osdep')
-rw-r--r--osdep/getch2-win.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/osdep/getch2-win.c b/osdep/getch2-win.c
index 59fd751c99..023ec95a6d 100644
--- a/osdep/getch2-win.c
+++ b/osdep/getch2-win.c
@@ -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;