comparison 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
comparison
equal deleted inserted replaced
1685:66267c6a0b12 1686:8d7fecceb9ef
148 modes[nmodes] = NULL; 148 modes[nmodes] = NULL;
149 } 149 }
150 return modes; 150 return modes;
151 } 151 }
152 152
153 static int (*orig_eventfilter) (const SDL_Event * event); 153 static int (*orig_eventfilter) (SDL_Event * event);
154 154
155 static int 155 static int
156 SDL_CompatEventFilter(const SDL_Event * event) 156 SDL_CompatEventFilter(SDL_Event * event)
157 { 157 {
158 SDL_Event fake; 158 SDL_Event fake;
159 159
160 switch (event->type) { 160 switch (event->type) {
161 case SDL_WINDOWEVENT: 161 case SDL_WINDOWEVENT:
201 fake.active.gain = 1; 201 fake.active.gain = 1;
202 fake.active.state = SDL_APPINPUTFOCUS; 202 fake.active.state = SDL_APPINPUTFOCUS;
203 SDL_PushEvent(&fake); 203 SDL_PushEvent(&fake);
204 break; 204 break;
205 } 205 }
206 case SDL_KEYDOWN:
207 case SDL_KEYUP:
208 {
209 Uint32 unicode = 0;
210 if (event->key.type == SDL_KEYDOWN && event->key.keysym.sym < 256) {
211 int shifted = !!(event->key.keysym.mod & KMOD_SHIFT);
212 int capslock = !!(event->key.keysym.mod & KMOD_CAPS);
213 if ((shifted ^ capslock) != 0) {
214 unicode = SDL_toupper(event->key.keysym.sym);
215 } else {
216 unicode = event->key.keysym.sym;
217 }
218 }
219 if (unicode) {
220 event->key.keysym.unicode = unicode;
221 }
222 break;
223 }
206 } 224 }
207 if (orig_eventfilter) { 225 if (orig_eventfilter) {
208 return orig_eventfilter(event); 226 return orig_eventfilter(event);
209 } else { 227 } else {
210 return 1; 228 return 1;
226 } 244 }
227 245
228 SDL_Surface * 246 SDL_Surface *
229 SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) 247 SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
230 { 248 {
231 int (*filter) (const SDL_Event * event); 249 int (*filter) (SDL_Event * event);
232 const SDL_DisplayMode *desktop_mode; 250 const SDL_DisplayMode *desktop_mode;
233 SDL_DisplayMode mode; 251 SDL_DisplayMode mode;
234 int i; 252 int i;
235 Uint32 window_flags; 253 Uint32 window_flags;
236 Uint32 desktop_format; 254 Uint32 desktop_format;