summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2013-10-26 12:22:30 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2013-10-26 12:22:30 (GMT)
commitad2fadc779c9f43531a39d3a00a0aa40fd11b617 (patch)
tree4f4525574b777ddaa6f788f3fa4f58eb410f0b3e
parentfedecab8255ecf25ce20b3632cab5bcd586c1f94 (diff)
downloadabc80sim-ad2fadc779c9f43531a39d3a00a0aa40fd11b617.zip
abc80sim-ad2fadc779c9f43531a39d3a00a0aa40fd11b617.tar.gz
abc80sim-ad2fadc779c9f43531a39d3a00a0aa40fd11b617.tar.bz2
abc80sim-ad2fadc779c9f43531a39d3a00a0aa40fd11b617.tar.xz
Allow arrow keys to work as on ABC80 (= backspace/tab)
Left and right arrow keys on ABC80 generate backspace and tab, so match that behavior. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--sdlscrn.c93
1 files changed, 53 insertions, 40 deletions
diff --git a/sdlscrn.c b/sdlscrn.c
index d8cb4bd..2694f2b 100644
--- a/sdlscrn.c
+++ b/sdlscrn.c
@@ -324,51 +324,64 @@ void check_event(void)
switch ( event.type ) {
case SDL_KEYDOWN:
{
- int mysym;
-
- //fprintf(stderr, "Keydown unicode = %x\n", event.key.keysym.unicode);
+ int mysym = -1;
- if ( (event.key.keysym.mod & (KMOD_RALT|KMOD_LALT)) &&
- event.key.keysym.sym == SDLK_END )
- exit(0); /* End */
-
- switch ( event.key.keysym.unicode ) {
- case 0x00 ... 0x7F:
- mysym = event.key.keysym.unicode;
- break;
- case L'É':
- mysym = '@';
- break;
- case L'Å':
- mysym = ']';
- break;
- case L'Ä':
- mysym = '[';
- break;
- case L'Ö':
- mysym = '\\';
- break;
- case L'Ü':
- mysym = '^';
- break;
- case L'é':
- mysym = '`';
+ switch (event.key.keysym.sym) {
+ case SDLK_END:
+ if (event.key.keysym.mod & (KMOD_RALT|KMOD_LALT))
+ exit(0); /* Alt+End = quit */
break;
- case L'å':
- mysym = '}';
- break;
- case L'ä':
- mysym = '{';
- break;
- case L'ö':
- mysym = '|';
+
+ case SDLK_LEFT:
+ mysym = 8;
break;
- case L'ü':
- mysym = '~';
+
+ case SDLK_RIGHT:
+ mysym = 9;
break;
+
default:
- mysym = -1;
- break;
+ if (event.key.keysym.unicode <= 0x7f) {
+ mysym = event.key.keysym.unicode;
+ } else {
+ switch ( event.key.keysym.unicode ) {
+ case L'¤':
+ mysym = '$';
+ break;
+ case L'É':
+ mysym = '@';
+ break;
+ case L'Å':
+ mysym = ']';
+ break;
+ case L'Ä':
+ mysym = '[';
+ break;
+ case L'Ö':
+ mysym = '\\';
+ break;
+ case L'Ü':
+ mysym = '^';
+ break;
+ case L'é':
+ mysym = '`';
+ break;
+ case L'å':
+ mysym = '}';
+ break;
+ case L'ä':
+ mysym = '{';
+ break;
+ case L'ö':
+ mysym = '|';
+ break;
+ case L'ü':
+ mysym = '~';
+ break;
+ default:
+ break;
+ }
+ }
}
if ( mysym >= 0 ) {