Skip to content

Commit

Permalink
CIrrDeviceLinux: fix dumb key fallback behaviour
Browse files Browse the repository at this point in the history
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 7f0e0a5
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions source/Irrlicht/CIrrDeviceLinux.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 7f0e0a5

Please sign in to comment.