Skip to content

Commit

Permalink
Add a no-op action that can be used for disabling mappings without ha…
Browse files Browse the repository at this point in the history
…ving

to edit the system mapping files
  • Loading branch information
John Rennie committed Jun 1, 2011
1 parent 0e23477 commit 1c06fe8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
5 changes: 5 additions & 0 deletions xbmc/guilib/Key.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 15 additions & 12 deletions xbmc/input/ButtonTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -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[] =
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 1c06fe8

Please sign in to comment.