Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 7f0e0a5

Browse files
committed
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.
1 parent 4bdd8af commit 7f0e0a5

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

source/Irrlicht/CIrrDeviceLinux.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -783,23 +783,18 @@ EKEY_CODE CIrrDeviceLinux::getKeyCode(XEvent &event)
783783
}
784784
if (keyCode == 0)
785785
{
786-
// Any value is better than none, that allows at least using the keys.
787-
// Worst case is that some keys will be identical, still better than _all_
788-
// unknown keys being identical.
786+
keyCode = KEY_UNKNOWN;
789787
if ( !mp.X11Key )
790788
{
791-
keyCode = (EKEY_CODE)event.xkey.keycode;
792-
os::Printer::log("No such X11Key, using event keycode", core::stringc(event.xkey.keycode).c_str(), ELL_INFORMATION);
789+
os::Printer::log("No such X11Key, event keycode", core::stringc(event.xkey.keycode).c_str(), ELL_INFORMATION);
793790
}
794791
else if (idx == -1)
795792
{
796-
keyCode = (EKEY_CODE)mp.X11Key;
797-
os::Printer::log("EKEY_CODE not found, using orig. X11 keycode", core::stringc(mp.X11Key).c_str(), ELL_INFORMATION);
793+
os::Printer::log("EKEY_CODE not found, X11 keycode", core::stringc(mp.X11Key).c_str(), ELL_INFORMATION);
798794
}
799795
else
800796
{
801-
keyCode = (EKEY_CODE)mp.X11Key;
802-
os::Printer::log("EKEY_CODE is 0, using orig. X11 keycode", core::stringc(mp.X11Key).c_str(), ELL_INFORMATION);
797+
os::Printer::log("EKEY_CODE is 0, X11 keycode", core::stringc(mp.X11Key).c_str(), ELL_INFORMATION);
803798
}
804799
}
805800
return keyCode;

0 commit comments

Comments
 (0)