Don't assume unmapped keycodes outside the extended ASCII range are unprintable

pull/593/head
Evil Eye 4 years ago
parent e230dcb8b2
commit 6e0f070cd1

@ -39,12 +39,14 @@ namespace MWInput
&& MWBase::Environment::get().getWindowManager()->isConsoleMode())
SDL_StopTextInput();
bool consumed = false;
bool consumed = SDL_IsTextInputActive() && // Little trick to check if key is printable
(!(SDLK_SCANCODE_MASK & arg.keysym.sym) &&
(std::isprint(arg.keysym.sym) ||
// Don't trust isprint for symbols outside the extended ASCII range
(kc == MyGUI::KeyCode::None && arg.keysym.sym > 0xff)));
if (kc != MyGUI::KeyCode::None && !mBindingsManager->isDetectingBindingState())
{
consumed = MWBase::Environment::get().getWindowManager()->injectKeyPress(kc, 0, arg.repeat);
if (SDL_IsTextInputActive() && // Little trick to check if key is printable
(!(SDLK_SCANCODE_MASK & arg.keysym.sym) && std::isprint(arg.keysym.sym)))
if (MWBase::Environment::get().getWindowManager()->injectKeyPress(kc, 0, arg.repeat))
consumed = true;
mBindingsManager->setPlayerControlsEnabled(!consumed);
}

Loading…
Cancel
Save