From 93d2941ebe777550559b4c27bfc3b04806d684f7 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 14 Oct 2006 10:41:20 +0200 Subject: Keys from expanded key macros are now put into the front of the key queue --- CONTRIBUTORS | 2 ++ HISTORY | 4 ++++ config.h | 6 +++--- keys.c | 11 ++++++----- keys.h | 7 ++++++- remote.c | 12 ++++-------- 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index c675dfc7..83468671 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1829,6 +1829,8 @@ Petri Hintukainen 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 for his "Easy Input" patch diff --git a/HISTORY b/HISTORY index 292424ed..32606cda 100644 --- a/HISTORY +++ b/HISTORY @@ -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. diff --git a/config.h b/config.h index 9fba40d4..360be5d8 100644 --- a/config.h +++ b/config.h @@ -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 diff --git a/keys.c b/keys.c index 6ebdbfea..577dae22 100644 --- a/keys.c +++ b/keys.c @@ -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; } diff --git a/keys.h b/keys.h index 4fa13372..be87c798 100644 --- a/keys.h +++ b/keys.h @@ -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; } }; diff --git a/remote.c b/remote.c index a4277401..06b3bb1c 100644 --- a/remote.c +++ b/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.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; -- cgit v1.2.3