aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2006-11-16 19:58:44 +0000
committerFelix Domke <tmbinc@elitedvb.net>2006-11-16 19:58:44 +0000
commit1145369cb70d505ebca614e5e8247b2d59defd48 (patch)
tree69c5b478c7d7a88bc67eb88d996203eaa83f97cc
parent7b823bac7983b1d13e49bf8243d6dc6244f29965 (diff)
downloadenigma2-1145369cb70d505ebca614e5e8247b2d59defd48.tar.gz
enigma2-1145369cb70d505ebca614e5e8247b2d59defd48.zip
take device string into account
-rw-r--r--lib/actions/action.cpp17
-rw-r--r--lib/actions/action.h6
-rw-r--r--main/enigma.cpp7
3 files changed, 18 insertions, 12 deletions
diff --git a/lib/actions/action.cpp b/lib/actions/action.cpp
index ec169a51..8b298ead 100644
--- a/lib/actions/action.cpp
+++ b/lib/actions/action.cpp
@@ -105,7 +105,7 @@ void eActionMap::bindKey(const std::string &device, int key, int flags, const st
{
// we found a native action.
eNativeKeyBinding bind;
- bind.m_device = 0;
+ bind.m_device = device;
bind.m_key = key;
bind.m_flags = flags;
bind.m_action = actions[i].m_id;
@@ -117,7 +117,7 @@ void eActionMap::bindKey(const std::string &device, int key, int flags, const st
// we didn't find the action, so it must be a pythonAction
ePythonKeyBinding bind;
- bind.m_device = 0;
+ bind.m_device = device;
bind.m_key = key;
bind.m_flags = flags;
bind.m_action = action;
@@ -133,7 +133,7 @@ struct call_entry
call_entry(eWidget *widget, void *arg, void *arg2): m_fnc(0), m_arg(0), m_widget(widget), m_widget_arg(arg), m_widget_arg2(arg2) { }
};
-void eActionMap::keyPressed(int device, int key, int flags)
+void eActionMap::keyPressed(const std::string &device, int key, int flags)
{
std::list<call_entry> call_list;
@@ -155,9 +155,10 @@ void eActionMap::keyPressed(int device, int key, int flags)
for (; k != e; ++k)
{
if (
- // (k->second.m_device == m_device) &&
(k->second.m_key == key) &&
- (k->second.m_flags & (1<<flags)))
+ (k->second.m_flags & (1<<flags)) &&
+ ((k->second.m_device == device) || (k->second.m_device == "generic"))
+ )
call_list.push_back(call_entry(i->second.m_widget, (void*)i->second.m_id, (void*)k->second.m_action));
}
} else
@@ -177,9 +178,10 @@ void eActionMap::keyPressed(int device, int key, int flags)
for (; k != e;)
{
if (
- // (k->second.m_device == m_device) &&
(k->second.m_key == key) &&
- (k->second.m_flags & (1<<flags)))
+ (k->second.m_flags & (1<<flags)) &&
+ ((k->second.m_device == device) || (k->second.m_device == "generic"))
+ )
{
PyObject *pArgs = PyTuple_New(2);
PyTuple_SET_ITEM(pArgs, 0, PyString_FromString(k->first.c_str()));
@@ -192,6 +194,7 @@ void eActionMap::keyPressed(int device, int key, int flags)
}
} else
{
+ eDebug("wildcard.");
PyObject *pArgs = PyTuple_New(2);
PyTuple_SET_ITEM(pArgs, 0, PyInt_FromLong(key));
PyTuple_SET_ITEM(pArgs, 1, PyInt_FromLong(flags));
diff --git a/lib/actions/action.h b/lib/actions/action.h
index e43e48a7..560fdbbf 100644
--- a/lib/actions/action.h
+++ b/lib/actions/action.h
@@ -34,7 +34,7 @@ public:
void bindKey(const std::string &device, int key, int flags, const std::string &context, const std::string &action);
- void keyPressed(int device, int key, int flags);
+ void keyPressed(const std::string &device, int key, int flags);
static RESULT getInstance(ePtr<eActionMap> &ptr);
#ifndef SWIG
@@ -56,7 +56,7 @@ private:
friend struct compare_string_keybind_native;
struct eNativeKeyBinding
{
- int m_device;
+ std::string m_device;
int m_key;
int m_flags;
@@ -69,7 +69,7 @@ private:
friend struct compare_string_keybind_python;
struct ePythonKeyBinding
{
- int m_device;
+ std::string m_device;
int m_key;
int m_flags;
diff --git a/main/enigma.cpp b/main/enigma.cpp
index 5a22110e..4799a5cf 100644
--- a/main/enigma.cpp
+++ b/main/enigma.cpp
@@ -63,10 +63,10 @@ void keyEvent(const eRCKey &key)
if (key.flags & eRCKey::flagAscii)
{
prev_ascii_code = key.code;
- ptr->keyPressed(0, 510 /* faked KEY_ASCII */, 0);
+ ptr->keyPressed(key.producer->getIdentifier(), 510 /* faked KEY_ASCII */, 0);
}
else
- ptr->keyPressed(0, key.code, key.flags);
+ ptr->keyPressed(key.producer->getIdentifier(), key.code, key.flags);
}
/************************************************/
@@ -160,6 +160,9 @@ int main(int argc, char **argv)
eWidgetDesktop dsk(eSize(720, 576));
eWidgetDesktop dsk_lcd(eSize(132, 64));
+ dsk.setStyleID(0);
+ dsk_lcd.setStyleID(1);
+
/* if (double_buffer)
{
eDebug(" - double buffering found, enable buffered graphics mode.");