aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Arrskog <topfs2@xbmc.org>2014-11-15 17:28:33 +0100
committerTobias Arrskog <topfs2@xbmc.org>2014-11-15 17:28:33 +0100
commit9eb48ccc82a0890206b0c4b41a5f90ca591a5fa2 (patch)
tree50f339d3d11cd62b3935fad8f7f655bf8b4c0ec2
parent72f48958c4089ae4578cfd85d2e0c776800d90d7 (diff)
parente7e0ac0a0bba2d76f151e5ec1120bcb6f94b896c (diff)
Merge pull request #5712 from zzattack/buttontranslator-fix
[buttontranslator] fix keymap overrides not working
-rw-r--r--xbmc/input/ButtonTranslator.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/xbmc/input/ButtonTranslator.cpp b/xbmc/input/ButtonTranslator.cpp
index 0e99bdc501..c297408f36 100644
--- a/xbmc/input/ButtonTranslator.cpp
+++ b/xbmc/input/ButtonTranslator.cpp
@@ -901,9 +901,12 @@ void CButtonTranslator::MergeMap(boost::shared_ptr<CRegExp> joyName, JoystickMap
if (jit->first->GetPattern() == joyName->GetPattern())
break;
}
- WindowMap* w = (jit == joystick->end()) ? &(*joystick)[joyName] : &jit->second;
- // find or create ActionMap, and merge it
- (*w)[windowID].insert(map.begin(), map.end());
+ WindowMap *w = (jit == joystick->end()) ? &(*joystick)[joyName] : &jit->second;
+
+ // find or create ActionMap, and merge/overwrite new entries
+ ActionMap *a = &(*w)[windowID];
+ for (ActionMap::const_iterator it = map.begin(); it != map.end(); it++)
+ (*a)[it->first] = it->second;
}
CButtonTranslator::JoystickMap::const_iterator CButtonTranslator::FindWindowMap(const std::string& joyName, const JoystickMap &maps) const
@@ -947,20 +950,20 @@ bool CButtonTranslator::TranslateJoystickString(int window, const std::string& j
return false;
}
- WindowMap wmap = it->second;
+ const WindowMap *wmap = &it->second;
// try to get the action from the current window
- action = GetActionCode(window, id, wmap, strAction, fullrange);
+ action = GetActionCode(window, id, *wmap, strAction, fullrange);
// if it's invalid, try to get it from a fallback window or the global map
if (action == 0)
{
int fallbackWindow = GetFallbackWindow(window);
if (fallbackWindow > -1)
- action = GetActionCode(fallbackWindow, id, wmap, strAction, fullrange);
+ action = GetActionCode(fallbackWindow, id, *wmap, strAction, fullrange);
// still no valid action? use global map
if (action == 0)
- action = GetActionCode(-1, id, wmap, strAction, fullrange);
+ action = GetActionCode(-1, id, *wmap, strAction, fullrange);
}
return (action > 0);