View Issue Details

IDProjectCategoryView StatusLast Update
0003124FSSCPPlatform-Engine interactionpublic2022-06-11 00:45
Reporterngld Assigned ToYarn  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
OSLinux 
Product Version3.7.2 RC4 
Summary0003124: -keyboard_layout qwertz should remap the Y and Z keys
DescriptionIf I launch FSO with "-keyboard_layout qwertz", all keys are bound correctly except for the Y and Z keys. Changing the language doesn't affect this.
If the language is set to English, all key labels are according to the QWERTY layout, only the Y and Z keys are labeled according to QWERTZ. If the language is set to German, all key labels are correct (QWERTZ) but the Y and Z key labels are swapped.

I suggest remapping the Y and Z keys for consistency (then the keys' labels would be consistent, too).
Steps To ReproduceIf I run FSO with "-keyboard_layout qwertz" and in English, the "#" key is displayed as "\" (which is wrong) but it's bound correctly. The "Z" key is displayed correctly but bound to the wrong function in the default keyboard bindings.
if I run FSO with "-keyboard_layout qwertz" and switch to German, the "#" key is displayed as "#" (which is correct) and it's bound correctly. The "Z" key is displayed as "Y" (which is wrong) and bound to the wrong function.
Additional InformationThe remapping should probably be done in code/io/key.cpp, FillSDLArray().
It would be nice if the key labels would depend on the keyboard layout and not the selected language. The relevant checks are in code/controlconfig/controlsconfigcommon.cpp, control_config_common_init().
TagsNo tags attached.

Activities

Yarn

2014-10-18 18:17

developer  

mantis3124.patch (3,285 bytes)   
Index: code/controlconfig/controlsconfigcommon.cpp
===================================================================
--- code/controlconfig/controlsconfigcommon.cpp	(revision 11150)
+++ code/controlconfig/controlsconfigcommon.cpp	(working copy)
@@ -249,12 +249,12 @@
 char *Scan_code_text_french[] = {
 	"",				"\x90""chap",			"1",				"2",				"3",				"4",				"5",				"6",
 	"7",				"8",				"9",				"0",				"-",				"=",				"Fl\x82""che Ret.",			"Tab",
-	"Q",				"W",				"E",				"R",				"T",				"Y",				"U",				"I",
-	"O",				"P",				"[",				"]",				"Entr\x82""e",			"Ctrl Gauche",			"A",				"S",
+	"A",				"Z",				"E",				"R",				"T",				"Y",				"U",				"I",
+	"O",				"P",				"[",				"]",				"Entr\x82""e",			"Ctrl Gauche",			"Q",				"S",
 
-	"D",				"F",				"G",				"H",				"J",				"K",				"L",				";",
-	"'",				"`",				"Maj.",			"\\",				"Z",				"X",				"C",				"V",
-	"B",				"N",				"M",				",",				".",				"/",				"Maj.",			"Pav\x82 *",
+	"D",				"F",				"G",				"H",				"J",				"K",				"L",				"M",
+	"'",				"`",				"Maj.",			"\\",				"W",				"X",				"C",				"V",
+	"B",				"N",				",",				";",				".",				"/",				"Maj.",			"Pav\x82 *",
 	"Alt",				"Espace",			"Verr. Maj.",			"F1",				"F2",				"F3",				"F4",				"F5",
 
 	"F6",				"F7",				"F8",				"F9",				"F10",				"Pause",			"Arret defil",		"Pav\x82 7",
Index: code/io/key.cpp
===================================================================
--- code/io/key.cpp	(revision 11150)
+++ code/io/key.cpp	(working copy)
@@ -149,7 +149,6 @@
 		SDLtoFS2[SDLK_9] = KEY_9;
 	}
 
-	SDLtoFS2[SDLK_a] = KEY_A;
 	SDLtoFS2[SDLK_b] = KEY_B;
 	SDLtoFS2[SDLK_c] = KEY_C;
 	SDLtoFS2[SDLK_d] = KEY_D;
@@ -161,20 +160,37 @@
 	SDLtoFS2[SDLK_j] = KEY_J;
 	SDLtoFS2[SDLK_k] = KEY_K;
 	SDLtoFS2[SDLK_l] = KEY_L;
-	SDLtoFS2[SDLK_m] = KEY_M;
 	SDLtoFS2[SDLK_n] = KEY_N;
 	SDLtoFS2[SDLK_o] = KEY_O;
 	SDLtoFS2[SDLK_p] = KEY_P;
-	SDLtoFS2[SDLK_q] = KEY_Q;
 	SDLtoFS2[SDLK_r] = KEY_R;
 	SDLtoFS2[SDLK_s] = KEY_S;
 	SDLtoFS2[SDLK_t] = KEY_T;
 	SDLtoFS2[SDLK_u] = KEY_U;
 	SDLtoFS2[SDLK_v] = KEY_V;
-	SDLtoFS2[SDLK_w] = KEY_W;
 	SDLtoFS2[SDLK_x] = KEY_X;
-	SDLtoFS2[SDLK_y] = KEY_Y;
-	SDLtoFS2[SDLK_z] = KEY_Z;
+	if(layout == KEYBOARD_LAYOUT_QWERTZ) {
+		SDLtoFS2[SDLK_a] = KEY_A;
+		SDLtoFS2[SDLK_m] = KEY_M;
+		SDLtoFS2[SDLK_q] = KEY_Q;
+		SDLtoFS2[SDLK_w] = KEY_W;
+		SDLtoFS2[SDLK_z] = KEY_Y;
+		SDLtoFS2[SDLK_y] = KEY_Z;
+	} else if(layout == KEYBOARD_LAYOUT_AZERTY) {
+		SDLtoFS2[SDLK_q] = KEY_A;
+		SDLtoFS2[SDLK_COMMA] = KEY_M;
+		SDLtoFS2[SDLK_a] = KEY_Q;
+		SDLtoFS2[SDLK_z] = KEY_W;
+		SDLtoFS2[SDLK_y] = KEY_Y;
+		SDLtoFS2[SDLK_w] = KEY_Z;
+	} else {
+		SDLtoFS2[SDLK_a] = KEY_A;
+		SDLtoFS2[SDLK_m] = KEY_M;
+		SDLtoFS2[SDLK_q] = KEY_Q;
+		SDLtoFS2[SDLK_w] = KEY_W;
+		SDLtoFS2[SDLK_y] = KEY_Y;
+		SDLtoFS2[SDLK_z] = KEY_Z;
+	}
 
 	if(layout == KEYBOARD_LAYOUT_DEFAULT) {
 		SDLtoFS2[SDLK_MINUS] = KEY_MINUS;
@@ -214,9 +230,9 @@
 		SDLtoFS2[SDLK_EQUALS] = KEY_EQUAL;
 		SDLtoFS2[SDLK_EXCLAIM] = KEY_DIVIDE;
 		SDLtoFS2[SDLK_ASTERISK] = KEY_SLASH;
-		SDLtoFS2[SDLK_COMMA] = KEY_COMMA;
+		SDLtoFS2[SDLK_SEMICOLON] = KEY_COMMA;
 		SDLtoFS2[SDLK_COLON] = KEY_PERIOD;
-		SDLtoFS2[SDLK_SEMICOLON] = KEY_SEMICOL;
+		SDLtoFS2[SDLK_m] = KEY_SEMICOL;
 
 		SDLtoFS2[SDLK_CARET] = KEY_LBRACKET;
 		SDLtoFS2[SDLK_DOLLAR] = KEY_RBRACKET;
mantis3124.patch (3,285 bytes)   

Yarn

2014-10-18 18:18

developer   ~0016340

The attached patch should fix the Y and Z mappings for the QWERTZ layout. It should also fix AZERTY mappings as well as some of the French key labels.

One thing to keep in mind is that the key labels are currently based on scancodes, which are independent of the keyboard layout in use. To make the labels correct for every combination of keyboard layout and language (which, I agree, would be a good thing), the labels would have to be based on the characters that are assigned to the scancodes, which would require some restructuring in controlsconfigcommon.cpp and the use of SDL for all platforms (currently, Windows builds don't use SDL). Thus, such a fix for the labels is probably better implemented in Antipodes 9 rather than current trunk.

z64555

2022-06-10 16:35

developer   ~0017110

Similar issue tracked by https://github.com/scp-fs2open/fs2open.github.com/issues/2225;

Should be addressed by Controls6: https://github.com/scp-fs2open/fs2open.github.com/pull/4133

Issue History

Date Modified Username Field Change
2014-10-18 16:40 ngld New Issue
2014-10-18 18:17 Yarn File Added: mantis3124.patch
2014-10-18 18:18 Yarn Note Added: 0016340
2014-10-18 18:18 Yarn Assigned To => Yarn
2014-10-18 18:18 Yarn Status new => feedback
2022-06-10 16:35 z64555 Status feedback => closed
2022-06-10 16:35 z64555 Resolution open => fixed
2022-06-10 16:35 z64555 Note Added: 0017110
2022-06-11 00:45 Goober5000 Status closed => resolved