diff options
Diffstat (limited to 'interface.c')
-rw-r--r-- | interface.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/interface.c b/interface.c index 5633f86..3d01238 100644 --- a/interface.c +++ b/interface.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: interface.c 1.15 2000/09/10 16:04:14 kls Exp $ + * $Id: interface.c 1.19 2000/09/19 17:41:23 kls Exp $ */ #include "interface.h" @@ -29,11 +29,19 @@ cInterface::cInterface(void) open = 0; cols[0] = 0; keyFromWait = kNone; + SVDRP = NULL; } -void cInterface::Init(void) +void cInterface::Init(int SVDRPport) { RcIo.SetCode(Keys.code, Keys.address); + if (SVDRPport) + SVDRP = new cSVDRP(SVDRPport); +} + +void cInterface::Cleanup(void) +{ + delete SVDRP; } void cInterface::Open(int NumCols, int NumLines) @@ -52,10 +60,6 @@ void cInterface::Close(void) unsigned int cInterface::GetCh(bool Wait) { -#ifdef DEBUG_OSD - timeout(0); - getch(); // just to make 'ncurses' display the window: -#endif if (RcIo.InputAvailable(Wait)) { unsigned int Command; return RcIo.GetCommand(&Command, NULL) ? Command : 0; @@ -65,21 +69,24 @@ unsigned int cInterface::GetCh(bool Wait) eKeys cInterface::GetKey(bool Wait) { + if (SVDRP) + SVDRP->Process(); eKeys Key = keyFromWait != kNone ? keyFromWait : Keys.Get(GetCh(Wait)); keyFromWait = kNone; return Key; } +void cInterface::PutKey(eKeys Key) +{ + keyFromWait = Key; +} + eKeys cInterface::Wait(int Seconds, bool KeepChar) { - int t0 = time_ms() + Seconds * 1000; eKeys Key = kNone; - - while (time_ms() < t0) { - Key = GetKey(); - if (Key != kNone) - break; - } + RcIo.Flush(500); + if (cFile::AnyFileReady(-1, Seconds * 1000)) + Key = GetKey(); if (KeepChar) keyFromWait = Key; return Key; @@ -227,7 +234,7 @@ void cInterface::QueryKeys(void) Keys.address = Address; WriteText(1, 5, "RC code detected!"); WriteText(1, 6, "Do not press any key..."); - RcIo.Flush(3); + RcIo.Flush(3000); ClearEol(0, 5); ClearEol(0, 6); break; |