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

Fixed handling plugins from cRemote::PutMacro() and cRemote::CallPlugin()

This commit is contained in:
Klaus Schmidinger 2006-10-14 11:09:01 +02:00
parent 3a9deab56c
commit f2c619568f
4 changed files with 21 additions and 10 deletions

View File

@ -1832,6 +1832,8 @@ Petri Hintukainen <Petri.Hintukainen@hut.fi>
for pointing out that keys from expanded key macros should be put into the front of 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 the key queue to avoid problems if the queue is not empty at that time
for making cRemote::PutMacro() set a lock while it expands the macro for making cRemote::PutMacro() set a lock while it expands the macro
for pointing out that plugins from cRemote::PutMacro() and cRemote::CallPlugin()
need to be handled separately
Marcel Schaeben <mts280@gmx.de> Marcel Schaeben <mts280@gmx.de>
for his "Easy Input" patch for his "Easy Input" patch

View File

@ -4966,3 +4966,5 @@ Video Disk Recorder Revision History
- cKeyMacro now has an explicit counter for the number of keys it contains. - cKeyMacro now has an explicit counter for the number of keys it contains.
- cRemote::PutMacro() now sets a lock while it expands the macro (thanks to - cRemote::PutMacro() now sets a lock while it expands the macro (thanks to
Petri Hintukainen). Petri Hintukainen).
- Fixed handling plugins from cRemote::PutMacro() and cRemote::CallPlugin()
(based on a patch from Petri Hintukainen).

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: remote.c 1.53 2006/10/14 10:44:02 kls Exp $ * $Id: remote.c 1.54 2006/10/14 11:05:57 kls Exp $
*/ */
#include "remote.h" #include "remote.h"
@ -29,7 +29,8 @@ cRemote *cRemote::learning = NULL;
char *cRemote::unknownCode = NULL; char *cRemote::unknownCode = NULL;
cMutex cRemote::mutex; cMutex cRemote::mutex;
cCondVar cRemote::keyPressed; cCondVar cRemote::keyPressed;
const char *cRemote::plugin = NULL; const char *cRemote::keyMacroPlugin = NULL;
const char *cRemote::callPlugin = NULL;
cRemote::cRemote(const char *Name) cRemote::cRemote(const char *Name)
{ {
@ -105,7 +106,7 @@ bool cRemote::PutMacro(eKeys Key)
{ {
const cKeyMacro *km = KeyMacros.Get(Key); const cKeyMacro *km = KeyMacros.Get(Key);
if (km) { if (km) {
plugin = km->Plugin(); keyMacroPlugin = km->Plugin();
cMutexLock MutexLock(&mutex); cMutexLock MutexLock(&mutex);
for (int i = km->NumKeys(); --i > 0; ) { for (int i = km->NumKeys(); --i > 0; ) {
if (!Put(km->Macro()[i], true)) if (!Put(km->Macro()[i], true))
@ -145,8 +146,8 @@ bool cRemote::Put(const char *Code, bool Repeat, bool Release)
bool cRemote::CallPlugin(const char *Plugin) bool cRemote::CallPlugin(const char *Plugin)
{ {
cMutexLock MutexLock(&mutex); cMutexLock MutexLock(&mutex);
if (!plugin) { if (!callPlugin) {
plugin = Plugin; callPlugin = Plugin;
Put(k_Plugin); Put(k_Plugin);
return true; return true;
} }
@ -156,8 +157,13 @@ bool cRemote::CallPlugin(const char *Plugin)
const char *cRemote::GetPlugin(void) const char *cRemote::GetPlugin(void)
{ {
cMutexLock MutexLock(&mutex); cMutexLock MutexLock(&mutex);
const char *p = plugin; const char *p = keyMacroPlugin;
plugin = NULL; if (p)
keyMacroPlugin = NULL;
else {
p = callPlugin;
callPlugin = NULL;
}
return p; return p;
} }

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: remote.h 1.35 2006/04/17 08:59:48 kls Exp $ * $Id: remote.h 1.36 2006/10/14 10:56:50 kls Exp $
*/ */
#ifndef __REMOTE_H #ifndef __REMOTE_H
@ -28,7 +28,8 @@ private:
static char *unknownCode; static char *unknownCode;
static cMutex mutex; static cMutex mutex;
static cCondVar keyPressed; static cCondVar keyPressed;
static const char *plugin; static const char *keyMacroPlugin;
static const char *callPlugin;
char *name; char *name;
protected: protected:
cRemote(const char *Name); cRemote(const char *Name);
@ -56,7 +57,7 @@ public:
///< false will be returned and the caller should try again later. ///< false will be returned and the caller should try again later.
static const char *GetPlugin(void); static const char *GetPlugin(void);
///< Returns the name of the plugin that was set with a previous ///< Returns the name of the plugin that was set with a previous
///< call to CallPlugin(). The internally stored pointer to the ///< call to PutMacro() or CallPlugin(). The internally stored pointer to the
///< plugin name will be reset to NULL by this call. ///< plugin name will be reset to NULL by this call.
static bool HasKeys(void); static bool HasKeys(void);
static eKeys Get(int WaitMs = 1000, char **UnknownCode = NULL); static eKeys Get(int WaitMs = 1000, char **UnknownCode = NULL);