From c51c1fc6681e20465de75436b5435947676fdabb Mon Sep 17 00:00:00 2001 From: uau Date: Sat, 25 Aug 2007 04:28:08 +0000 Subject: Make terminal input work more like VO key input The Unix version of getch2() could either return an internally buffered key or do a second-level select() in addition to the input.c one and then read more data. Change getch2() to always add all read keys with mplayer_put_key() (like video output window keyboard input does) and remove the internal select() from the Unix version. Make input.c call mplayer_get_key() directly. The primary motivation for this change is to make combining multiple event sources under one select() easier. Now getch2() only needs to be called when the corresponding fd is readable, and it will be possible to handle events from X-based VOs with the same code. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24149 b3059339-0415-0410-9bf9-f77b7e298cf2 --- input/input.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'input') diff --git a/input/input.c b/input/input.c index 40cc34ed6b..bdef163782 100644 --- a/input/input.c +++ b/input/input.c @@ -17,6 +17,7 @@ #ifdef MP_DEBUG #include #endif +#include "mp_fifo.h" #include "osdep/getch2.h" #include "osdep/keycodes.h" #include "osdep/timer.h" @@ -1061,15 +1062,14 @@ if(n>0){ } #ifdef HAVE_POSIX_SELECT // No input from this fd - if (!key_fds[i].no_select && !FD_ISSET(key_fds[i].fd, &fds) - && key_fds[i].fd != 0) + if (!key_fds[i].no_select && !FD_ISSET(key_fds[i].fd, &fds)) continue; #endif if(key_fds[i].fd == 0) { // stdin is handled by getch2 - code = getch2(time); + getch2(); + code = mplayer_get_key(0); if(code < 0) code = MP_INPUT_NOTHING; - did_sleep = 1; } else code = ((mp_key_func_t)key_fds[i].read_func)(key_fds[i].fd); -- cgit v1.2.3