diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2007-06-19 23:32:12 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2007-06-19 23:32:12 +0000 |
| commit | c2b4aa62c5e2d5e562010350cc3ca49002d9614f (patch) | |
| tree | e90212422f171714cb44230dd497b214bbb0a1bb /lib/actions | |
| parent | 7e053d70aeab7a3510b67230c1655e5b6f6a8825 (diff) | |
| download | enigma2-c2b4aa62c5e2d5e562010350cc3ca49002d9614f.tar.gz enigma2-c2b4aa62c5e2d5e562010350cc3ca49002d9614f.zip | |
add 'domain' in actionmap for loading (and unloading) multiple keymaps at once
Diffstat (limited to 'lib/actions')
| -rw-r--r-- | lib/actions/action.cpp | 21 | ||||
| -rw-r--r-- | lib/actions/action.h | 8 |
2 files changed, 26 insertions, 3 deletions
diff --git a/lib/actions/action.cpp b/lib/actions/action.cpp index f0debf2c..cb9e5e05 100644 --- a/lib/actions/action.cpp +++ b/lib/actions/action.cpp @@ -87,7 +87,7 @@ void eActionMap::unbindAction(const std::string &context, ePyObject function) } -void eActionMap::bindKey(const std::string &device, int key, int flags, const std::string &context, const std::string &action) +void eActionMap::bindKey(const std::string &domain, const std::string &device, int key, int flags, const std::string &context, const std::string &action) { // first, search the actionlist table unsigned int i; @@ -101,6 +101,7 @@ void eActionMap::bindKey(const std::string &device, int key, int flags, const st bind.m_key = key; bind.m_flags = flags; bind.m_action = actions[i].m_id; + bind.m_domain = domain; m_native_keys.insert(std::pair<std::string,eNativeKeyBinding>(context, bind)); return; } @@ -113,9 +114,27 @@ void eActionMap::bindKey(const std::string &device, int key, int flags, const st bind.m_key = key; bind.m_flags = flags; bind.m_action = action; + bind.m_domain = domain; m_python_keys.insert(std::pair<std::string,ePythonKeyBinding>(context, bind)); } +void eActionMap::unbindKeyDomain(const std::string &domain) +{ + for (std::multimap<std::string, eNativeKeyBinding>::iterator i(m_native_keys.begin()); i != m_native_keys.end(); ++i) + if (i->second.m_domain == domain) + { + m_native_keys.erase(i); + i = m_native_keys.begin(); + } + + for (std::multimap<std::string, ePythonKeyBinding>::iterator i(m_python_keys.begin()); i != m_python_keys.end(); ++i) + if (i->second.m_domain == domain) + { + m_python_keys.erase(i); + i = m_python_keys.begin(); + } +} + struct call_entry { ePyObject m_fnc, m_arg; diff --git a/lib/actions/action.h b/lib/actions/action.h index 834dc209..f0a6ee49 100644 --- a/lib/actions/action.h +++ b/lib/actions/action.h @@ -31,8 +31,9 @@ public: void bindAction(const std::string &context, int priority, SWIG_PYOBJECT(ePyObject) function); void unbindAction(const std::string &context, SWIG_PYOBJECT(ePyObject) function); - - void bindKey(const std::string &device, int key, int flags, const std::string &context, const std::string &action); + + void bindKey(const std::string &domain, const std::string &device, int key, int flags, const std::string &context, const std::string &action); + void unbindKeyDomain(const std::string &domain); void keyPressed(const std::string &device, int key, int flags); @@ -44,6 +45,7 @@ private: { // eActionContext *m_context; std::string m_context; // FIXME + std::string m_domain; ePyObject m_fnc; @@ -57,6 +59,7 @@ private: struct eNativeKeyBinding { std::string m_device; + std::string m_domain; int m_key; int m_flags; @@ -70,6 +73,7 @@ private: struct ePythonKeyBinding { std::string m_device; + std::string m_domain; int m_key; int m_flags; |
