Skip to content

Commit

Permalink
Events: Don't set keyboard.character for unprintable characters
Browse files Browse the repository at this point in the history
  • Loading branch information
bradallred committed Jun 12, 2017
1 parent 57fb4f8 commit 7d1d440
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gemrb/core/GUI/EventMgr.cpp
Expand Up @@ -184,7 +184,7 @@ Event EventMgr::CreateKeyEvent(KeyboardKey key, bool down, int mod)
e.isScreen = false;

KeyboardKey character = 0;
if (key >= 0x20) {
if (key >= ' ' && key < GEM_LEFT) { // if printable
// FIXME: need to translate the keycode for e.keyboard.character
// probably need to lookup what encoding we are currently using
character = key;
Expand Down
4 changes: 3 additions & 1 deletion gemrb/plugins/SDLVideo/SDLVideo.cpp
Expand Up @@ -218,7 +218,9 @@ int SDLVideoDriver::ProcessEvent(const SDL_Event & event)
default: break;
}
e = EvntManager->CreateKeyEvent(key, true, modstate);
e.keyboard.character = event.key.keysym.unicode; // FIXME: invalid in SDL2
if (e.keyboard.character) {
e.keyboard.character = event.key.keysym.unicode; // FIXME: invalid in SDL2
}
EvntManager->DispatchEvent(e);
break;
case SDL_MOUSEMOTION:
Expand Down

0 comments on commit 7d1d440

Please sign in to comment.