Skip to content
Permalink
Browse files

CIrrDeviceLinux: fix dumb key fallback behaviour

Turns out giving the application KEY_UNKNOWN + the correct char
to work with is better than returning nonsense EKEY_CODEs.
  • Loading branch information
sfan5 committed Mar 24, 2021
1 parent 4bdd8af commit 7f0e0a57b8e54b3e1bff7a0606a1a376a50c36a8
Showing with 4 additions and 9 deletions.
  1. +4 −9 source/Irrlicht/CIrrDeviceLinux.cpp
@@ -783,23 +783,18 @@ EKEY_CODE CIrrDeviceLinux::getKeyCode(XEvent &event)
}
if (keyCode == 0)
{
// Any value is better than none, that allows at least using the keys.
// Worst case is that some keys will be identical, still better than _all_
// unknown keys being identical.
keyCode = KEY_UNKNOWN;
if ( !mp.X11Key )
{
keyCode = (EKEY_CODE)event.xkey.keycode;
os::Printer::log("No such X11Key, using event keycode", core::stringc(event.xkey.keycode).c_str(), ELL_INFORMATION);
os::Printer::log("No such X11Key, event keycode", core::stringc(event.xkey.keycode).c_str(), ELL_INFORMATION);
}
else if (idx == -1)
{
keyCode = (EKEY_CODE)mp.X11Key;
os::Printer::log("EKEY_CODE not found, using orig. X11 keycode", core::stringc(mp.X11Key).c_str(), ELL_INFORMATION);
os::Printer::log("EKEY_CODE not found, X11 keycode", core::stringc(mp.X11Key).c_str(), ELL_INFORMATION);
}
else
{
keyCode = (EKEY_CODE)mp.X11Key;
os::Printer::log("EKEY_CODE is 0, using orig. X11 keycode", core::stringc(mp.X11Key).c_str(), ELL_INFORMATION);
os::Printer::log("EKEY_CODE is 0, X11 keycode", core::stringc(mp.X11Key).c_str(), ELL_INFORMATION);
}
}
return keyCode;

0 comments on commit 7f0e0a5

Please sign in to comment.