commit 93f58bbef5f4c941f32edbb6285d4650d6456c5d
Author: Simon Howard <fraggle@soulsphere.org>
AuthorDate: Wed Dec 30 16:59:27 2015 +0100
Commit: Simon Howard <fraggle@soulsphere.org>
CommitDate: Wed Dec 30 16:59:27 2015 +0100
video: Apply shiftxform with vanilla_keyboard_mapping.
We still don't have a story yet for how to do input properly when
vanilla_keyboard_mapping=false, but applying shiftxform to scancode
input when vanilla_keyboard_mapping=true seems like the right thing to
do.
---
src/i_video.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/i_video.c b/src/i_video.c
index 9192fc86..60807417 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -568,7 +568,17 @@ static int GetTypedChar(SDL_Event *event)
// Otherwise we should use the native key mapping.
if (vanilla_keyboard_mapping)
{
- return TranslateKey(&event->key.keysym);
+ int result = TranslateKey(&event->key.keysym);
+
+ // If shift is held down, apply the original uppercase
+ // translation table used under DOS.
+ if ((SDL_GetModState() & KMOD_SHIFT) != 0
+ && result >= 0 && result < arrlen(shiftxform))
+ {
+ result = shiftxform[result];
+ }
+
+ return result;
}
else
{
@@ -703,11 +713,6 @@ void I_GetEvent(void)
event.data1 = TranslateKey(&sdlevent.key.keysym);
event.data2 = GetTypedChar(&sdlevent);
- // SDL2-TODO: Need to generate a parallel text input event
- // here that can be used for typing text, eg. multiplayer
- // chat and savegame names. This is only for the Vanilla
- // case; we must use the shiftxform table.
-
if (event.data1 != 0)
{
D_PostEvent(&event);