Pass in actual character sdl saw into keypress functions
Previously you couldn't detect what shift+somekey would do on alternate keyboard layours.
This commit is contained in:
parent
435edb23ac
commit
aa108be3df
@ -438,7 +438,7 @@ int luacon_elementwrite(lua_State* l)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool shortcuts = true;
|
bool shortcuts = true;
|
||||||
int luacon_keyevent(int key, int modifier, int event)
|
int luacon_keyevent(int key, Uint16 character, int modifier, int event)
|
||||||
{
|
{
|
||||||
int kycontinue = 1;
|
int kycontinue = 1;
|
||||||
lua_State* l=luacon_ci->l;
|
lua_State* l=luacon_ci->l;
|
||||||
@ -456,7 +456,7 @@ int luacon_keyevent(int key, int modifier, int event)
|
|||||||
for (int i = 1; i <= len && kycontinue; i++)
|
for (int i = 1; i <= len && kycontinue; i++)
|
||||||
{
|
{
|
||||||
lua_rawgeti(l, -1, i);
|
lua_rawgeti(l, -1, i);
|
||||||
lua_pushlstring(l, (const char*)&key, 1);
|
lua_pushlstring(l, (const char*)&character, 1);
|
||||||
lua_pushinteger(l, key);
|
lua_pushinteger(l, key);
|
||||||
lua_pushinteger(l, modifier);
|
lua_pushinteger(l, modifier);
|
||||||
lua_pushinteger(l, event);
|
lua_pushinteger(l, event);
|
||||||
|
@ -23,7 +23,7 @@ extern int tptParts, tptPartsMeta, tptElementTransitions, tptPartsCData, tptPart
|
|||||||
void luacon_hook(lua_State *L, lua_Debug *ar);
|
void luacon_hook(lua_State *L, lua_Debug *ar);
|
||||||
int luacon_step(int mx, int my);
|
int luacon_step(int mx, int my);
|
||||||
int luacon_mouseevent(int mx, int my, int mb, int event, int mouse_wheel);
|
int luacon_mouseevent(int mx, int my, int mb, int event, int mouse_wheel);
|
||||||
int luacon_keyevent(int key, int modifier, int event);
|
int luacon_keyevent(int key, Uint16 character, int modifier, int event);
|
||||||
int luacon_eval(const char *command);
|
int luacon_eval(const char *command);
|
||||||
const char *luacon_geterror();
|
const char *luacon_geterror();
|
||||||
void luacon_close();
|
void luacon_close();
|
||||||
|
@ -3305,7 +3305,7 @@ bool LuaScriptInterface::OnMouseWheel(int x, int y, int d)
|
|||||||
|
|
||||||
bool LuaScriptInterface::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
|
bool LuaScriptInterface::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
|
||||||
{
|
{
|
||||||
return luacon_keyevent(key, GetModifiers(), LUACON_KDOWN);
|
return luacon_keyevent(key, character, GetModifiers(), LUACON_KDOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LuaScriptInterface::OnKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bool alt)
|
bool LuaScriptInterface::OnKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bool alt)
|
||||||
@ -3317,7 +3317,7 @@ bool LuaScriptInterface::OnKeyRelease(int key, Uint16 character, bool shift, boo
|
|||||||
modifiers |= 0x040;
|
modifiers |= 0x040;
|
||||||
if(alt)
|
if(alt)
|
||||||
modifiers |= 0x100;
|
modifiers |= 0x100;
|
||||||
return luacon_keyevent(key, modifiers, LUACON_KUP);
|
return luacon_keyevent(key, character, modifiers, LUACON_KUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LuaScriptInterface::OnMouseTick()
|
bool LuaScriptInterface::OnMouseTick()
|
||||||
|
Loading…
Reference in New Issue
Block a user