summaryrefslogtreecommitdiff
path: root/interface.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2000-10-08 11:39:11 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2000-10-08 11:39:11 +0200
commit605d8df72ada13ae54fd4452f43f09f94ade87d1 (patch)
tree34dff9ced1c7c930e9e7e85e4ec6afa1173e0eb2 /interface.c
parent97c3bb61482855769f0208062610543475f02006 (diff)
downloadvdr-605d8df72ada13ae54fd4452f43f09f94ade87d1.tar.gz
vdr-605d8df72ada13ae54fd4452f43f09f94ade87d1.tar.bz2
Explicit Repeat/Release handling for remote control
Diffstat (limited to 'interface.c')
-rw-r--r--interface.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/interface.c b/interface.c
index 485a5dd0..84ee101c 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.22 2000/10/07 16:42:37 kls Exp $
+ * $Id: interface.c 1.23 2000/10/08 11:17:11 kls Exp $
*/
#include "interface.h"
@@ -58,21 +58,29 @@ void cInterface::Close(void)
cDvbApi::PrimaryDvbApi->Close();
}
-unsigned int cInterface::GetCh(bool Wait)
+unsigned int cInterface::GetCh(bool Wait, bool *Repeat, bool *Release)
{
if (open)
cDvbApi::PrimaryDvbApi->Flush();
if (!RcIo.InputAvailable())
cFile::AnyFileReady(-1, Wait ? 1000 : 0);
unsigned int Command;
- return RcIo.GetCommand(&Command) ? Command : 0;
+ return RcIo.GetCommand(&Command, Repeat, Release) ? Command : 0;
}
eKeys cInterface::GetKey(bool Wait)
{
if (SVDRP)
SVDRP->Process();
- eKeys Key = keyFromWait != kNone ? keyFromWait : Keys.Get(GetCh(Wait));
+ eKeys Key = keyFromWait;
+ if (Key == kNone) {
+ bool Repeat = false, Release = false;
+ Key = Keys.Get(GetCh(Wait, &Repeat, &Release));
+ if (Repeat)
+ Key = eKeys(Key | k_Repeat);
+ if (Release)
+ Key = eKeys(Key | k_Release);
+ }
keyFromWait = kNone;
return Key;
}
@@ -90,10 +98,10 @@ eKeys cInterface::Wait(int Seconds, bool KeepChar)
time_t timeout = time(NULL) + Seconds;
for (;;) {
Key = GetKey();
- if (Key != kNone || time(NULL) > timeout)
+ if ((Key != kNone && (NORMALKEY(Key) != kOk || NORMALKEY(Key) == Key)) || time(NULL) > timeout)
break;
}
- if (KeepChar)
+ if (KeepChar && ISNORMALKEY(Key))
keyFromWait = Key;
return Key;
}