diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2006-01-29 12:39:04 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2006-01-29 12:39:04 +0100 |
commit | 1a4526a3dff752b3088f89835761c882ce904e0e (patch) | |
tree | cb15ae270c3ab54c638299c98b970409d747757c /remote.c | |
parent | 251e04d25a9e8ae5ea92b87fc570aee473625c03 (diff) | |
download | vdr-1a4526a3dff752b3088f89835761c882ce904e0e.tar.gz vdr-1a4526a3dff752b3088f89835761c882ce904e0e.tar.bz2 |
Implemented a timeout for remote controls that don't deliver "repeat" keypresses very fast
Diffstat (limited to 'remote.c')
-rw-r--r-- | remote.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: remote.c 1.48 2006/01/15 15:00:00 kls Exp $ + * $Id: remote.c 1.49 2006/01/29 12:27:08 kls Exp $ */ #include "remote.h" @@ -18,11 +18,13 @@ // --- cRemote --------------------------------------------------------------- -#define INITTIMEOUT 10000 // ms +#define INITTIMEOUT 10000 // ms +#define REPEATTIMEOUT 1000 // ms eKeys cRemote::keys[MaxKeys]; int cRemote::in = 0; int cRemote::out = 0; +cTimeMs cRemote::repeatTimeout; cRemote *cRemote::learning = NULL; char *cRemote::unknownCode = NULL; cMutex cRemote::mutex; @@ -163,9 +165,11 @@ eKeys cRemote::Get(int WaitMs, char **UnknownCode) eKeys k = keys[out]; if (++out >= MaxKeys) out = 0; + if ((k & k_Repeat) != 0) + repeatTimeout.Set(REPEATTIMEOUT); return k; } - else if (!WaitMs || !keyPressed.TimedWait(mutex, WaitMs)) { + else if (!WaitMs || !keyPressed.TimedWait(mutex, WaitMs) && repeatTimeout.TimedOut()) { if (learning && UnknownCode) { *UnknownCode = unknownCode; unknownCode = NULL; |