summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS7
-rw-r--r--textscreen/txt_sdl.c48
2 files changed, 35 insertions, 20 deletions
diff --git a/NEWS b/NEWS
index 9a5b37da..59c5ffaa 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,13 @@
* Fix teleport behavior when emulating the alternate Final Doom
executable (-gameversion final2) (thanks xttl).
+ libtextscreen:
+ * Input boxes stop editing and save when they lose their focus,
+ correcting a previous counterintuitive behavior (thanks
+ Twelve).
+ * The numeric keypad now works properly when entering text values
+ (thanks Twelve).
+
1.6.0 (2011-05-17):
* The instructions in the INSTALL file are now customized for
diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c
index 767c9b3e..a2781ac1 100644
--- a/textscreen/txt_sdl.c
+++ b/textscreen/txt_sdl.c
@@ -405,25 +405,6 @@ static int TranslateKey(SDL_keysym *sym)
case SDLK_CAPSLOCK: return KEY_CAPSLOCK;
case SDLK_SCROLLOCK: return KEY_SCRLCK;
- case SDLK_KP0: return KEYP_0;
- case SDLK_KP1: return KEYP_1;
- case SDLK_KP2: return KEYP_2;
- case SDLK_KP3: return KEYP_3;
- case SDLK_KP4: return KEYP_4;
- case SDLK_KP5: return KEYP_5;
- case SDLK_KP6: return KEYP_6;
- case SDLK_KP7: return KEYP_7;
- case SDLK_KP8: return KEYP_8;
- case SDLK_KP9: return KEYP_9;
-
- case SDLK_KP_PERIOD: return KEYP_PERIOD;
- case SDLK_KP_MULTIPLY: return KEYP_MULTIPLY;
- case SDLK_KP_PLUS: return KEYP_PLUS;
- case SDLK_KP_MINUS: return KEYP_MINUS;
- case SDLK_KP_DIVIDE: return KEYP_DIVIDE;
- case SDLK_KP_EQUALS: return KEYP_EQUALS;
- case SDLK_KP_ENTER: return KEYP_ENTER;
-
case SDLK_HOME: return KEY_HOME;
case SDLK_INSERT: return KEY_INS;
case SDLK_END: return KEY_END;
@@ -454,7 +435,34 @@ static int TranslateKey(SDL_keysym *sym)
}
else
{
- return tolower(sym->sym);
+ // Keypad mapping is only done when we want a raw value:
+ // most of the time, the keypad should behave as it normally
+ // does.
+
+ switch (sym->sym)
+ {
+ case SDLK_KP0: return KEYP_0;
+ case SDLK_KP1: return KEYP_1;
+ case SDLK_KP2: return KEYP_2;
+ case SDLK_KP3: return KEYP_3;
+ case SDLK_KP4: return KEYP_4;
+ case SDLK_KP5: return KEYP_5;
+ case SDLK_KP6: return KEYP_6;
+ case SDLK_KP7: return KEYP_7;
+ case SDLK_KP8: return KEYP_8;
+ case SDLK_KP9: return KEYP_9;
+
+ case SDLK_KP_PERIOD: return KEYP_PERIOD;
+ case SDLK_KP_MULTIPLY: return KEYP_MULTIPLY;
+ case SDLK_KP_PLUS: return KEYP_PLUS;
+ case SDLK_KP_MINUS: return KEYP_MINUS;
+ case SDLK_KP_DIVIDE: return KEYP_DIVIDE;
+ case SDLK_KP_EQUALS: return KEYP_EQUALS;
+ case SDLK_KP_ENTER: return KEYP_ENTER;
+
+ default:
+ return tolower(sym->sym);
+ }
}
}