aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Rennie <john.rennie@ratsauce.co.uk>2011-06-01 11:37:49 +0100
committerJohn Rennie <john.rennie@ratsauce.co.uk>2011-06-01 11:37:49 +0100
commit1c06fe899e9c6f932c13671fa7ed3d88e554a1f0 (patch)
tree87de8a4fe0fd65f4e77d07c0439818175ec59b1d
parent0e23477b8bc2cbaa4d3efd76d718b2e03cd247aa (diff)
Add a no-op action that can be used for disabling mappings without having
to edit the system mapping files
-rw-r--r--xbmc/guilib/Key.h5
-rw-r--r--xbmc/input/ButtonTranslator.cpp27
2 files changed, 20 insertions, 12 deletions
diff --git a/xbmc/guilib/Key.h b/xbmc/guilib/Key.h
index 973304c185..43dc94be52 100644
--- a/xbmc/guilib/Key.h
+++ b/xbmc/guilib/Key.h
@@ -295,6 +295,11 @@
#define ACTION_PLAYER_PLAYPAUSE 227 // Play/pause. If playing it pauses, if paused it plays.
+// The NOOP action can be specified to disable an input event. This is
+// useful in user keyboard.xml etc to disable actions specified in the
+// system mappings.
+#define ACTION_NOOP 999
+
// Window ID defines to make the code a bit more readable
#define WINDOW_INVALID 9999
#define WINDOW_HOME 10000
diff --git a/xbmc/input/ButtonTranslator.cpp b/xbmc/input/ButtonTranslator.cpp
index 75bff506a7..5c1f315559 100644
--- a/xbmc/input/ButtonTranslator.cpp
+++ b/xbmc/input/ButtonTranslator.cpp
@@ -45,7 +45,8 @@ typedef struct
} ActionMapping;
static const ActionMapping actions[] =
- {{"left" , ACTION_MOVE_LEFT },
+{
+ {"left" , ACTION_MOVE_LEFT },
{"right" , ACTION_MOVE_RIGHT},
{"up" , ACTION_MOVE_UP },
{"down" , ACTION_MOVE_DOWN },
@@ -195,14 +196,19 @@ static const ActionMapping actions[] =
{"blue" , ACTION_TELETEXT_BLUE},
{"increasepar" , ACTION_INCREASE_PAR},
{"decreasepar" , ACTION_DECREASE_PAR},
- { "leftclick" , ACTION_MOUSE_LEFT_CLICK},
- { "rightclick" , ACTION_MOUSE_RIGHT_CLICK},
- { "middleclick" , ACTION_MOUSE_MIDDLE_CLICK},
- { "doubleclick" , ACTION_MOUSE_DOUBLE_CLICK},
- { "wheelup" , ACTION_MOUSE_WHEEL_UP},
- { "wheeldown" , ACTION_MOUSE_WHEEL_DOWN},
- { "mousedrag" , ACTION_MOUSE_DRAG},
- { "mousemove" , ACTION_MOUSE_MOVE}
+
+ // Mouse actions
+ {"leftclick" , ACTION_MOUSE_LEFT_CLICK},
+ {"rightclick" , ACTION_MOUSE_RIGHT_CLICK},
+ {"middleclick" , ACTION_MOUSE_MIDDLE_CLICK},
+ {"doubleclick" , ACTION_MOUSE_DOUBLE_CLICK},
+ {"wheelup" , ACTION_MOUSE_WHEEL_UP},
+ {"wheeldown" , ACTION_MOUSE_WHEEL_DOWN},
+ {"mousedrag" , ACTION_MOUSE_DRAG},
+ {"mousemove" , ACTION_MOUSE_MOVE},
+
+ // Do nothing action
+ { "noop" , ACTION_NOOP}
};
static const ActionMapping windows[] =
@@ -901,9 +907,6 @@ bool CButtonTranslator::TranslateActionString(const char *szAction, int &action)
if (CBuiltins::HasCommand(strAction))
action = ACTION_BUILT_IN_FUNCTION;
- if (strAction.Equals("noop"))
- return true;
-
for (unsigned int index=0;index < sizeof(actions)/sizeof(actions[0]);++index)
{
if (strAction.Equals(actions[index].name))