Skip to content

Commit aa108be

Browse files
committed
Pass in actual character sdl saw into keypress functions
Previously you couldn't detect what shift+somekey would do on alternate keyboard layours.
1 parent 435edb2 commit aa108be

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/lua/LegacyLuaAPI.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ int luacon_elementwrite(lua_State* l)
438438
}
439439

440440
bool shortcuts = true;
441-
int luacon_keyevent(int key, int modifier, int event)
441+
int luacon_keyevent(int key, Uint16 character, int modifier, int event)
442442
{
443443
int kycontinue = 1;
444444
lua_State* l=luacon_ci->l;
@@ -456,7 +456,7 @@ int luacon_keyevent(int key, int modifier, int event)
456456
for (int i = 1; i <= len && kycontinue; i++)
457457
{
458458
lua_rawgeti(l, -1, i);
459-
lua_pushlstring(l, (const char*)&key, 1);
459+
lua_pushlstring(l, (const char*)&character, 1);
460460
lua_pushinteger(l, key);
461461
lua_pushinteger(l, modifier);
462462
lua_pushinteger(l, event);

src/lua/LuaScriptHelper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extern int tptParts, tptPartsMeta, tptElementTransitions, tptPartsCData, tptPart
2323
void luacon_hook(lua_State *L, lua_Debug *ar);
2424
int luacon_step(int mx, int my);
2525
int luacon_mouseevent(int mx, int my, int mb, int event, int mouse_wheel);
26-
int luacon_keyevent(int key, int modifier, int event);
26+
int luacon_keyevent(int key, Uint16 character, int modifier, int event);
2727
int luacon_eval(const char *command);
2828
const char *luacon_geterror();
2929
void luacon_close();

src/lua/LuaScriptInterface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3305,7 +3305,7 @@ bool LuaScriptInterface::OnMouseWheel(int x, int y, int d)
33053305

33063306
bool LuaScriptInterface::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
33073307
{
3308-
return luacon_keyevent(key, GetModifiers(), LUACON_KDOWN);
3308+
return luacon_keyevent(key, character, GetModifiers(), LUACON_KDOWN);
33093309
}
33103310

33113311
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
33173317
modifiers |= 0x040;
33183318
if(alt)
33193319
modifiers |= 0x100;
3320-
return luacon_keyevent(key, modifiers, LUACON_KUP);
3320+
return luacon_keyevent(key, character, modifiers, LUACON_KUP);
33213321
}
33223322

33233323
bool LuaScriptInterface::OnMouseTick()

0 commit comments

Comments
 (0)