diff options
author | michi_cc <michi_cc@openttd.org> | 2013-08-05 20:36:36 +0000 |
---|---|---|
committer | michi_cc <michi_cc@openttd.org> | 2013-08-05 20:36:36 +0000 |
commit | 019984a14f01e4463ae479765d2340ff26055367 (patch) | |
tree | 291b47c56523ebef7368f3588e921a1cdb78f331 /src/video/sdl_v.cpp | |
parent | 270d8aa639341f8be7fde9aa6e6f5bb6fa894d4f (diff) | |
download | openttd-019984a14f01e4463ae479765d2340ff26055367.tar.xz |
(svn r25671) -Codechange: Pass character and key code separately to the keyboard handler.
Diffstat (limited to 'src/video/sdl_v.cpp')
-rw-r--r-- | src/video/sdl_v.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index d66ad59a8..a95e86332 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -495,7 +495,7 @@ static const VkMapping _vk_mapping[] = { AS(SDLK_PERIOD, WKC_PERIOD) }; -static uint32 ConvertSdlKeyIntoMy(SDL_keysym *sym) +static uint ConvertSdlKeyIntoMy(SDL_keysym *sym, WChar *character) { const VkMapping *map; uint key = 0; @@ -531,7 +531,8 @@ static uint32 ConvertSdlKeyIntoMy(SDL_keysym *sym) if (sym->mod & KMOD_CTRL) key |= WKC_CTRL; if (sym->mod & KMOD_ALT) key |= WKC_ALT; - return (key << 16) + sym->unicode; + *character = sym->unicode; + return key; } int VideoDriver_SDL::PollEvent() @@ -617,7 +618,9 @@ int VideoDriver_SDL::PollEvent() (ev.key.keysym.sym == SDLK_RETURN || ev.key.keysym.sym == SDLK_f)) { ToggleFullScreen(!_fullscreen); } else { - HandleKeypress(ConvertSdlKeyIntoMy(&ev.key.keysym)); + WChar character; + uint keycode = ConvertSdlKeyIntoMy(&ev.key.keysym, &character); + HandleKeypress(keycode, character); } break; |