From 43c9ea28be6143702d4b0962e6117d1c87ee2ab9 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Tue, 29 May 2007 06:24:31 +0000
Subject: [PATCH] And yet more input fixes.

---
 src/conio/sdl_con.c | 59 +++++++++++++++++++++++----------------------
 1 file changed, 30 insertions(+), 29 deletions(-)

diff --git a/src/conio/sdl_con.c b/src/conio/sdl_con.c
index 3eb671230b..5a1da94de0 100644
--- a/src/conio/sdl_con.c
+++ b/src/conio/sdl_con.c
@@ -1599,45 +1599,46 @@ unsigned int cp437_convert(unsigned int unicode)
 /* Called from event thread only */
 unsigned int sdl_get_char_code(unsigned int keysym, unsigned int mod, unsigned int unicode)
 {
+	int expect;
+	int i;
+
 #ifdef __DARWIN__
 	if(unicode==0x7f) {
 		unicode=0x08;
 		keysym=SDLK_BACKSPACE;
 	}
 #endif
-	if(!unicode || (mod & (KMOD_META|KMOD_ALT))) {
-		int expect;
-		int i;
-
-		for(i=0;sdl_keyval[i].keysym;i++) {
-			if(sdl_keyval[i].keysym==keysym) {
-				if(mod & KMOD_CTRL)
-					expect=sdl_keyval[i].ctrl;
-				else if(mod & KMOD_SHIFT)
-					expect=sdl_keyval[i].shift;
-				else
-					expect=sdl_keyval[i].key;
-
-				/* "Extended" syms are always right */
-				if(!unicode)
-					return(expect);
-				if(sdl_keyval[i].key > 255)
-					return(expect);
-				/*
-				 * If we don't know that this key can
-				 * return the unicode translation, then
-				 * we're not right and this is prolly
-				 * an AltGr sequence.
-				 */
-				if(mod & (KMOD_META|KMOD_ALT)) {
-					if(unicode==expect)
-						return(sdl_keyval[i].alt);
-				}
+	for(i=0;sdl_keyval[i].keysym;i++) {
+		if(sdl_keyval[i].keysym==keysym) {
+			if(mod & KMOD_CTRL)
+				expect=sdl_keyval[i].ctrl;
+			else if(mod & KMOD_SHIFT)
+				expect=sdl_keyval[i].shift;
+			else
+				expect=sdl_keyval[i].key;
+
+			/* "Extended" syms are always right */
+			if(!unicode)
+				return(expect);
+			if(sdl_keyval[i].key > 255)
+				return(expect);
+			/*
+			 * If we don't know that this key can
+			 * return the unicode translation, then
+			 * we're not right and this is prolly
+			 * an AltGr sequence.
+			 */
+			if(mod & (KMOD_META|KMOD_ALT)) {
+				if(unicode==expect)
+					return(sdl_keyval[i].alt);
 			}
+			else
+				return(expect);
 		}
+	}
 
+	if(!unicode || (mod & (KMOD_META|KMOD_ALT)))
 		return(0x0001ffff);
-	}
 	if(unicode <= 0x7f)
 		return(unicode);
 	return(cp437_convert(unicode));
-- 
GitLab