Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to skip specific key/button map translations when running in standalone mode #1391

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion system/keymaps/joystick.Harmony.xml
Expand Up @@ -114,7 +114,7 @@
<!-- Info --> <button id="31">XBMC.ActivateWindow(Settings)</button>
<!-- Exit --> <button id="51">XBMC.ActivateWindow(ShutdownMenu)</button>
<!-- #enter --> <button id="36">XBMC.ActivateWindow(SystemInfo)</button>
<!-- 1 --> <button id="11">ToggleFullScreen</button>
<!-- 1 --> <button id="11" standalone="false">ToggleFullScreen</button>
</joystick>
</Home>
<MyFiles>
Expand Down
2 changes: 1 addition & 1 deletion system/keymaps/keyboard.xml
Expand Up @@ -91,7 +91,7 @@
<numpadseven>Number7</numpadseven>
<numpadeight>Number8</numpadeight>
<numpadnine>Number9</numpadnine>
<backslash>ToggleFullScreen</backslash>
<backslash standalone="false">ToggleFullScreen</backslash>
<home>FirstPage</home>
<end>LastPage</end>
<!-- PVR windows -->
Expand Down
51 changes: 35 additions & 16 deletions xbmc/input/ButtonTranslator.cpp
Expand Up @@ -20,6 +20,7 @@
*/

#include "system.h"
#include "Application.h"
#include "interfaces/Builtins.h"
#include "ButtonTranslator.h"
#include "utils/URIUtils.h"
Expand Down Expand Up @@ -945,6 +946,21 @@ void CButtonTranslator::MapAction(uint32_t buttonCode, const char *szAction, but
}
}

bool CButtonTranslator::SkipTranslation(TiXmlElement *pButton)
{
if (g_application.IsStandAlone())
{
// in case we're running in standalone mode,
// check whether the button should be translated.
bool bStandAlone = true;
pButton->QueryBoolAttribute("standalone", &bStandAlone);
if (!bStandAlone)
return true;
}

return false;
}

bool CButtonTranslator::HasDeviceType(TiXmlNode *pWindow, CStdString type)
{
return pWindow->FirstChild(type) != NULL;
Expand Down Expand Up @@ -977,22 +993,25 @@ void CButtonTranslator::MapWindowActions(TiXmlNode *pWindow, int windowID)

while (pButton)
{
uint32_t buttonCode=0;
if (type == "gamepad")
buttonCode = TranslateGamepadString(pButton->Value());
else if (type == "remote")
buttonCode = TranslateRemoteString(pButton->Value());
else if (type == "universalremote")
buttonCode = TranslateUniversalRemoteString(pButton->Value());
else if (type == "keyboard")
buttonCode = TranslateKeyboardButton(pButton);
else if (type == "mouse")
buttonCode = TranslateMouseCommand(pButton->Value());
else if (type == "appcommand")
buttonCode = TranslateAppCommand(pButton->Value());

if (buttonCode && pButton->FirstChild())
MapAction(buttonCode, pButton->FirstChild()->Value(), map);
if (!SkipTranslation(pButton))
{
uint32_t buttonCode=0;
if (type == "gamepad")
buttonCode = TranslateGamepadString(pButton->Value());
else if (type == "remote")
buttonCode = TranslateRemoteString(pButton->Value());
else if (type == "universalremote")
buttonCode = TranslateUniversalRemoteString(pButton->Value());
else if (type == "keyboard")
buttonCode = TranslateKeyboardButton(pButton);
else if (type == "mouse")
buttonCode = TranslateMouseCommand(pButton->Value());
else if (type == "appcommand")
buttonCode = TranslateAppCommand(pButton->Value());

if (buttonCode && pButton->FirstChild())
MapAction(buttonCode, pButton->FirstChild()->Value(), map);
}
pButton = pButton->NextSiblingElement();
}

Expand Down
2 changes: 2 additions & 0 deletions xbmc/input/ButtonTranslator.h
Expand Up @@ -121,6 +121,8 @@ class CButtonTranslator
void MapWindowActions(TiXmlNode *pWindow, int wWindowID);
void MapAction(uint32_t buttonCode, const char *szAction, buttonMap &map);

bool SkipTranslation(TiXmlElement *pButton);

bool LoadKeymap(const CStdString &keymapPath);
#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE)
bool LoadLircMap(const CStdString &lircmapPath);
Expand Down