comparison src/SDL_compat.c @ 1687:d36048e8e302 SDL-1.3

This trick only works for English
author Sam Lantinga <slouken@libsdl.org>
date Sun, 18 Jun 2006 13:54:27 +0000
parents 8d7fecceb9ef
children c901fd2a42da
comparison
equal deleted inserted replaced
1686:8d7fecceb9ef 1687:d36048e8e302
206 case SDL_KEYDOWN: 206 case SDL_KEYDOWN:
207 case SDL_KEYUP: 207 case SDL_KEYUP:
208 { 208 {
209 Uint32 unicode = 0; 209 Uint32 unicode = 0;
210 if (event->key.type == SDL_KEYDOWN && event->key.keysym.sym < 256) { 210 if (event->key.type == SDL_KEYDOWN && event->key.keysym.sym < 256) {
211 int shifted = !!(event->key.keysym.mod & KMOD_SHIFT); 211 unicode = event->key.keysym.sym;
212 int capslock = !!(event->key.keysym.mod & KMOD_CAPS); 212 if(unicode >= 'a' && unicode <= 'z') {
213 if ((shifted ^ capslock) != 0) { 213 int shifted = !!(event->key.keysym.mod & KMOD_SHIFT);
214 unicode = SDL_toupper(event->key.keysym.sym); 214 int capslock = !!(event->key.keysym.mod & KMOD_CAPS);
215 } else { 215 if ((shifted ^ capslock) != 0) {
216 unicode = event->key.keysym.sym; 216 unicode = SDL_toupper(unicode);
217 }
217 } 218 }
218 } 219 }
219 if (unicode) { 220 if (unicode) {
220 event->key.keysym.unicode = unicode; 221 event->key.keysym.unicode = unicode;
221 } 222 }