From 7f0e0a57b8e54b3e1bff7a0606a1a376a50c36a8 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 24 Mar 2021 20:11:27 +0100 Subject: [PATCH] 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. --- source/Irrlicht/CIrrDeviceLinux.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/source/Irrlicht/CIrrDeviceLinux.cpp b/source/Irrlicht/CIrrDeviceLinux.cpp index 87a60abd..d9e23f09 100644 --- a/source/Irrlicht/CIrrDeviceLinux.cpp +++ b/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;