Keys from expanded key macros are now put into the front of the key queue

This commit is contained in:
Klaus Schmidinger 2006-10-14 10:41:20 +02:00
parent 7bed3fd6ba
commit 93d2941ebe
6 changed files with 25 additions and 17 deletions

View File

@ -1829,6 +1829,8 @@ Petri Hintukainen <Petri.Hintukainen@hut.fi>
pointer
for fixing displaying the error log message in case an unknown plugin was requested
in a key macro
for pointing out that keys from expanded key macros should be put into the front of
the key queue to avoid problems if the queue is not empty at that time
Marcel Schaeben <mts280@gmx.de>
for his "Easy Input" patch

View File

@ -4960,3 +4960,7 @@ Video Disk Recorder Revision History
pointer (thanks to Petri Hintukainen).
- Fixed displaying the error log message in case an unknown plugin was requested
in a key macro (thanks to Petri Hintukainen).
- Keys from expanded key macros are now put into the front of the key queue to
avoid problems if the queue is not empty at that time (based on a patch from
Petri Hintukainen).
- cKeyMacro now has an explicit counter for the number of keys it contains.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.h 1.273 2006/10/09 16:12:33 kls Exp $
* $Id: config.h 1.274 2006/10/14 10:28:38 kls Exp $
*/
#ifndef __CONFIG_H
@ -26,8 +26,8 @@
// The plugin API's version number:
#define APIVERSION "1.4.3"
#define APIVERSNUM 10403 // Version * 10000 + Major * 100 + Minor
#define APIVERSION "1.4.4"
#define APIVERSNUM 10404 // Version * 10000 + Major * 100 + Minor
// When loading plugins, VDR searches them by their APIVERSION, which
// may be smaller than VDRVERSION in case there have been no changes to

11
keys.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: keys.c 1.13 2006/04/15 13:50:43 kls Exp $
* $Id: keys.c 1.14 2006/10/14 10:18:05 kls Exp $
*/
#include "keys.h"
@ -186,8 +186,9 @@ void cKeys::PutSetup(const char *Remote, const char *Setup)
cKeyMacro::cKeyMacro(void)
{
numKeys = 0;
for (int i = 0; i < MAXKEYSINMACRO; i++)
macro[i] = kNone;
macro[i] = kNone; // for compatibility with old code that doesn't know about NumKeys()
plugin = NULL;
}
@ -241,9 +242,9 @@ bool cKeyMacro::Parse(char *s)
return false;
}
}
if (n < 2) {
esyslog("ERROR: empty key macro");
}
if (n < 2)
esyslog("ERROR: empty key macro"); // non fatal
numKeys = n;
return true;
}

7
keys.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: keys.h 1.9 2006/04/15 13:56:03 kls Exp $
* $Id: keys.h 1.10 2006/10/14 10:41:20 kls Exp $
*/
#ifndef __KEYS_H
@ -117,11 +117,16 @@ extern cKeys Keys;
class cKeyMacro : public cListObject {
private:
eKeys macro[MAXKEYSINMACRO];
int numKeys;
char *plugin;
public:
cKeyMacro(void);
~cKeyMacro();
bool Parse(char *s);
int NumKeys(void) const { return numKeys; }
///< Returns the number of keys in this macro. The first key (with
///< index 0) is the macro code. The actual macro expansion codes
///< start at index 1 and go to NumKeys() - 1.
const eKeys *Macro(void) const { return macro; }
const char *Plugin(void) const { return plugin; }
};

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: remote.c 1.51 2006/05/12 12:40:15 kls Exp $
* $Id: remote.c 1.52 2006/10/14 10:24:13 kls Exp $
*/
#include "remote.h"
@ -106,13 +106,9 @@ bool cRemote::PutMacro(eKeys Key)
const cKeyMacro *km = KeyMacros.Get(Key);
if (km) {
plugin = km->Plugin();
for (int i = 1; i < MAXKEYSINMACRO; i++) {
if (km->Macro()[i] != kNone) {
if (!Put(km->Macro()[i]))
return false;
}
else
break;
for (int i = km->NumKeys(); --i > 0; ) {
if (!Put(km->Macro()[i], true))
return false;
}
}
return true;