diff options
author | Steve Cotton <steve@s.cotton.clara.co.uk> | 2009-02-11 23:28:18 +0000 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-02-13 08:04:10 -0700 |
commit | cb0be69dcf9ca771943fbe36c8b740490a6f459c (patch) | |
tree | 1fdae03b92aabd7652a6257797ed6fcc4e42a05d | |
parent | 35d95932256d615da0599bad8acdbf91777962b0 (diff) | |
download | mana-client-cb0be69dcf9ca771943fbe36c8b740490a6f459c.tar.gz mana-client-cb0be69dcf9ca771943fbe36c8b740490a6f459c.tar.bz2 mana-client-cb0be69dcf9ca771943fbe36c8b740490a6f459c.tar.xz mana-client-cb0be69dcf9ca771943fbe36c8b740490a6f459c.zip |
Ignore "window manager + arrow" key combinations
Adds two configurable "ignore" keys.
Stops the character moving about if the user's window manager
uses "ignore+arrow key" to switch virtual desktops.
-rw-r--r-- | src/game.cpp | 9 | ||||
-rw-r--r-- | src/keyboardconfig.cpp | 4 | ||||
-rw-r--r-- | src/keyboardconfig.h | 2 |
3 files changed, 14 insertions, 1 deletions
diff --git a/src/game.cpp b/src/game.cpp index 03febaff..e4b6e54d 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -792,6 +792,15 @@ void Game::handleInput() // Get the state of the keyboard keys keyboard.refreshActiveKeys(); + // Ignore input if either "ignore" key is pressed + // Stops the character moving about if the user's window manager + // uses "ignore+arrow key" to switch virtual desktops. + if (keyboard.isKeyActive(keyboard.KEY_IGNORE_INPUT_1) || + keyboard.isKeyActive(keyboard.KEY_IGNORE_INPUT_2)) + { + return; + } + const Uint16 x = player_node->mX; const Uint16 y = player_node->mY; unsigned char direction = 0; diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp index 1976e803..8187bef7 100644 --- a/src/keyboardconfig.cpp +++ b/src/keyboardconfig.cpp @@ -96,7 +96,9 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = { {"keyChatScrollUp", SDLK_PAGEUP, _("Scroll Chat Up")}, {"keyChatScrollDown", SDLK_PAGEDOWN, _("Scroll Chat Down")}, {"keyOK", SDLK_RETURN, _("Select OK")}, - {"keyQuit", SDLK_ESCAPE, _("Quit")} + {"keyQuit", SDLK_ESCAPE, _("Quit")}, + {"keyIgnoreInput1", SDLK_LSUPER, _("Ignore input 1")}, + {"keyIgnoreInput2", SDLK_RSUPER, _("Ignore input 2")} }; void KeyboardConfig::init() diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h index 484c0c63..61d7887d 100644 --- a/src/keyboardconfig.h +++ b/src/keyboardconfig.h @@ -208,6 +208,8 @@ class KeyboardConfig KEY_SCROLL_CHAT_DOWN, KEY_OK, KEY_QUIT, + KEY_IGNORE_INPUT_1, + KEY_IGNORE_INPUT_2, KEY_TOTAL }; |