From 5807602cc1ec326f3ca33f3130d35b22082378ec Mon Sep 17 00:00:00 2001 From: jacob1 Date: Mon, 11 Feb 2013 11:45:49 -0500 Subject: [PATCH] fix modifiers from lua, fix right ctrl --- src/cat/LuaScriptInterface.cpp | 10 ++-------- src/interface/Keys.h | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp index e4bf3c244..b4ce48abd 100644 --- a/src/cat/LuaScriptInterface.cpp +++ b/src/cat/LuaScriptInterface.cpp @@ -43,6 +43,7 @@ #ifndef WIN #include #endif +#include "SDL.h" extern "C" { @@ -1887,14 +1888,7 @@ bool LuaScriptInterface::OnMouseWheel(int x, int y, int d) bool LuaScriptInterface::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt) { - int modifiers = 0; - if(shift) - modifiers |= 0x001; - if(ctrl) - modifiers |= 0x040; - if(alt) - modifiers |= 0x100; - return luacon_keyevent(key, modifiers, LUACON_KDOWN); + return luacon_keyevent(key, SDL_GetModState(), LUACON_KDOWN); } bool LuaScriptInterface::OnKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bool alt) diff --git a/src/interface/Keys.h b/src/interface/Keys.h index e532d4ef3..cd265f93e 100644 --- a/src/interface/Keys.h +++ b/src/interface/Keys.h @@ -32,7 +32,7 @@ #define KEY_MOD_MODE KMOD_MODE #define KEY_MOD_RESERVED KMOD_RESERVED -#define KEY_MOD_CONTROL KEY_MOD_RCONTROL | KEY_MOD_LCONTROl +#define KEY_MOD_CONTROL KEY_MOD_RCONTROL | KEY_MOD_LCONTROL #define KEY_MOD_ALT KEY_MOD_RALT | KEY_MOD_LALT #define KEY_MOD_SHIFT KEY_MOD_RSHIFT | KEY_MOD_LSHIFT