mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Implemented a timeout for remote controls that don't deliver "repeat" keypresses very fast
This commit is contained in:
10
remote.c
10
remote.c
@@ -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;
|
||||
|
Reference in New Issue
Block a user