+
+#define SSORG '\''
+#define SSEND '`'
+static char symshift[] = {
+ '"', 0, 0, 0, 0, '<', '_', '>', '?',
+ ')', '!', '@', '#', '$', '%', '^', '&', '*', '(',
+ 0, ':', 0, '+', 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ '{', '|', '}', 0, 0, '~'
+};
+
+
+static int sdlkey_to_demokey(int sdlkey, unsigned int mod)
+{
+ if(sdlkey < 128) {
+ if(mod & (KMOD_SHIFT)) {
+ if(sdlkey >= 'a' && sdlkey <= 'z') {
+ sdlkey = toupper(sdlkey);
+ } else if(sdlkey >= SSORG && sdlkey <= SSEND) {
+ sdlkey = symshift[sdlkey - SSORG];
+ }
+ }
+ return sdlkey;
+ }
+ if(sdlkey < 256) return 0;
+ return sdlkey - 128;
+}