Mercurial > sdl-ios-xcode
diff src/SDL_compat.c @ 1686:8d7fecceb9ef SDL-1.3
Added the unicode keysym memory again for backwards compatibility.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 18 Jun 2006 13:47:19 +0000 |
parents | 66267c6a0b12 |
children | d36048e8e302 |
line wrap: on
line diff
--- a/src/SDL_compat.c Sun Jun 18 07:31:45 2006 +0000 +++ b/src/SDL_compat.c Sun Jun 18 13:47:19 2006 +0000 @@ -150,10 +150,10 @@ return modes; } -static int (*orig_eventfilter) (const SDL_Event * event); +static int (*orig_eventfilter) (SDL_Event * event); static int -SDL_CompatEventFilter(const SDL_Event * event) +SDL_CompatEventFilter(SDL_Event * event) { SDL_Event fake; @@ -203,6 +203,24 @@ SDL_PushEvent(&fake); break; } + case SDL_KEYDOWN: + case SDL_KEYUP: + { + Uint32 unicode = 0; + if (event->key.type == SDL_KEYDOWN && event->key.keysym.sym < 256) { + int shifted = !!(event->key.keysym.mod & KMOD_SHIFT); + int capslock = !!(event->key.keysym.mod & KMOD_CAPS); + if ((shifted ^ capslock) != 0) { + unicode = SDL_toupper(event->key.keysym.sym); + } else { + unicode = event->key.keysym.sym; + } + } + if (unicode) { + event->key.keysym.unicode = unicode; + } + break; + } } if (orig_eventfilter) { return orig_eventfilter(event); @@ -228,7 +246,7 @@ SDL_Surface * SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) { - int (*filter) (const SDL_Event * event); + int (*filter) (SDL_Event * event); const SDL_DisplayMode *desktop_mode; SDL_DisplayMode mode; int i;