1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed key release handling

This commit is contained in:
Klaus Schmidinger 2000-10-08 16:34:17 +02:00
parent 212468e2e0
commit a36ff983f5
2 changed files with 7 additions and 6 deletions

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: config.h 1.26 2000/10/08 16:07:49 kls Exp $ * $Id: config.h 1.27 2000/10/08 16:33:48 kls Exp $
*/ */
#ifndef __CONFIG_H #ifndef __CONFIG_H
@ -41,8 +41,9 @@ enum eKeys { // "Up" and "Down" must be the first two keys!
k_Flags = k_Repeat | k_Release, k_Flags = k_Repeat | k_Release,
}; };
#define ISNORMALKEY(k) ((k) != kNone && ((k) & k_Flags) == 0) #define RAWKEY(k) ((k) & ~k_Flags)
#define NORMALKEY(k) ((k) & ~k_Flags) #define ISRAWKEY(k) ((k) != kNone && ((k) & k_Flags) == 0)
#define NORMALKEY(k) ((k) & ~k_Repeat)
struct tKey { struct tKey {
eKeys type; eKeys type;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: interface.c 1.24 2000/10/08 12:15:36 kls Exp $ * $Id: interface.c 1.25 2000/10/08 16:34:17 kls Exp $
*/ */
#include "interface.h" #include "interface.h"
@ -94,10 +94,10 @@ eKeys cInterface::Wait(int Seconds, bool KeepChar)
time_t timeout = time(NULL) + Seconds; time_t timeout = time(NULL) + Seconds;
for (;;) { for (;;) {
Key = GetKey(); Key = GetKey();
if ((Key != kNone && (NORMALKEY(Key) != kOk || NORMALKEY(Key) == Key)) || time(NULL) > timeout) if ((Key != kNone && (RAWKEY(Key) != kOk || RAWKEY(Key) == Key)) || time(NULL) > timeout)
break; break;
} }
if (KeepChar && ISNORMALKEY(Key)) if (KeepChar && ISRAWKEY(Key))
keyFromWait = Key; keyFromWait = Key;
return Key; return Key;
} }