Commits

rmtew committed 60e98b0

Added some more hard-coding of shift + key combinations to deal with the fact
that SDL2 does not do keyboard mappings, and leaves determining of what these
mean to the developer. So SHIFT+'/'='?' ... etc.

Comments (0)

Files changed (1)

 	/* SDL2 does not map keycodes and modifiers to characters, this is on the developer.
 		Presumably in order to avoid problems with different keyboard layouts, they
 		are expected to write their own key mapping editing code for the user.  */
-	ret->c = kev->keysym.sym;
-	switch (kev->keysym.sym) {
-	case SDLK_SLASH : if (kev->keysym.mod & KMOD_SHIFT) ret->c='?'; break;
-	case SDLK_BACKQUOTE : if (kev->keysym.mod & KMOD_SHIFT) ret->c='~'; break;
-	default : if (SDLK_SCANCODE_MASK == (kev->keysym.sym & SDLK_SCANCODE_MASK)) ret->c = 0; break;
+	if (SDLK_SCANCODE_MASK == (kev->keysym.sym & SDLK_SCANCODE_MASK))
+		ret->c = 0;
+	else {
+		ret->c = kev->keysym.sym;
+		if (kev->keysym.mod & KMOD_SHIFT)
+			switch (kev->keysym.sym) {
+			case SDLK_BACKQUOTE : ret->c='~'; break;
+			case SDLK_1 : ret->c='!'; break;
+			case SDLK_2 : ret->c='@'; break;
+			case SDLK_3 : ret->c='#'; break;
+			case SDLK_4 : ret->c='$'; break;
+			case SDLK_5 : ret->c='%'; break;
+			case SDLK_6 : ret->c='^'; break;
+			case SDLK_7 : ret->c='&'; break;
+			case SDLK_8 : ret->c='*'; break;
+			case SDLK_9 : ret->c='('; break;
+			case SDLK_0 : ret->c=')'; break;
+			case SDLK_MINUS : ret->c='_'; break;
+			case SDLK_EQUALS : ret->c='+'; break;
+			case SDLK_LEFTBRACKET : ret->c='{'; break;
+			case SDLK_RIGHTBRACKET : ret->c='}'; break;
+			case SDLK_BACKSLASH : ret->c='|'; break;
+			case SDLK_SEMICOLON : ret->c=':'; break;
+			case SDLK_QUOTE : ret->c='"'; break;
+			case SDLK_COMMA : ret->c='<'; break;
+			case SDLK_PERIOD : ret->c='>'; break;
+			case SDLK_SLASH : ret->c='?'; break;
+			}
 	}
 #else
 	ret->c=(char)kev->keysym.unicode;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.