Fix for German Keymap

Christian Jarczyk hawkeye at holarse.net
Fri Jul 19 04:54:57 EDT 2002


Hi, i found some key's not working in Freespace2/Linux when using a
german keymap. 
The problem was the mapping in src/io/key.cpp .
My fix is only a dirty hack that remaps some of the key's.
I know it isn't worth to apply the patch, but I thought it might
interest someone here. Sorry fr the form of the patch (it has to be
aplied directly in src/io with patch -p7, but i never used diff before.
I guess the best solution would be to rewrite the keyboard handling
without those fs2 keycodes, but I'm not experienced enough to do so.

Greets Christian.





-------------- next part --------------
--- /home/chrjar/cvs/freespace2/src/io/key.cpp	2002-06-18 01:11:39.000000000 +0200
+++ /home/chrjar/freespace/freespace2/src/io/key.cpp	2002-07-18 15:29:57.000000000 +0200
@@ -171,7 +171,8 @@
 #include "localize.h"
 
 #define KEY_BUFFER_SIZE 16
-
+#define GER_KEYMAP_HACK
+ 
 //-------- Variable accessed by outside functions ---------
 ubyte				keyd_buffer_type;		// 0=No buffer, 1=buffer ASCII, 2=buffer scans
 ubyte				keyd_repeat;
@@ -281,21 +282,31 @@
 	SDLtoFS2[SDLK_y] = KEY_Y;
 	SDLtoFS2[SDLK_z] = KEY_Z;
 
-	SDLtoFS2[SDLK_MINUS] = KEY_MINUS;
-	SDLtoFS2[SDLK_EQUALS] = KEY_EQUAL;
-	SDLtoFS2[SDLK_SLASH] = KEY_DIVIDE; // No idea - DDOI
-	SDLtoFS2[SDLK_BACKSLASH] = KEY_SLASH;
 	//SDLtoFS2[SDLK_BACKSLASH] = KEY_SLASH_UK; // ?
 	SDLtoFS2[SDLK_COMMA] = KEY_COMMA;
 	SDLtoFS2[SDLK_PERIOD] = KEY_PERIOD;
-	SDLtoFS2[SDLK_SEMICOLON] = KEY_SEMICOL;
 
+#ifdef GER_KEYMAP_HACK // ugly hack that remaps some keys of the german keymap
+ 	SDLtoFS2[SDLK_WORLD_92] = KEY_LBRACKET; // to those of the us keymap
+	SDLtoFS2[SDLK_PLUS] = KEY_RBRACKET;
+	SDLtoFS2[SDLK_WORLD_86] = KEY_SEMICOL;
+	SDLtoFS2[SDLK_WORLD_68] = KEY_RAPOSTRO;
+	SDLtoFS2[SDLK_HASH] = KEY_SLASH;
+	SDLtoFS2[SDLK_WORLD_63] = KEY_MINUS;
+	SDLtoFS2[SDLK_WORLD_20] = KEY_EQUAL;
+	SDLtoFS2[SDLK_MINUS] = KEY_DIVIDE; // No idea - DDOI
+#else 
 	SDLtoFS2[SDLK_LEFTBRACKET] = KEY_LBRACKET;
 	SDLtoFS2[SDLK_RIGHTBRACKET] = KEY_RBRACKET;
-
-	SDLtoFS2[SDLK_BACKQUOTE] = KEY_LAPOSTRO;
+        SDLtoFS2[SDLK_SEMICOLON] = KEY_SEMICOL;
 	SDLtoFS2[SDLK_QUOTE] = KEY_RAPOSTRO;
-
+	SDLtoFS2[SDLK_BACKSLASH] = KEY_SLASH;
+	SDLtoFS2[SDLK_MINUS] = KEY_MINUS;
+	SDLtoFS2[SDLK_EQUALS] = KEY_EQUAL;
+	SDLtoFS2[SDLK_SLASH] = KEY_DIVIDE; // No idea - DDOI
+#endif
+	
+	SDLtoFS2[SDLK_BACKQUOTE] = KEY_LAPOSTRO;
 	SDLtoFS2[SDLK_ESCAPE] = KEY_ESC;
 	SDLtoFS2[SDLK_RETURN] = KEY_ENTER;
 	SDLtoFS2[SDLK_BACKSPACE] = KEY_BACKSP;


More information about the freespace2 mailing list