comparison src/video/quartz/SDL_QuartzEvents.m @ 1876:406b8325ee34

Fixed bug #147 Only enable Unicode key events if Unicode translation is enabled.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 23 Jun 2006 04:27:55 +0000
parents ef4a796e7f24
children c121d94672cb 4fd12011d8d6
comparison
equal deleted inserted replaced
1875:4627eca2c02b 1876:406b8325ee34
258 will contain a single character. If it contains 258 will contain a single character. If it contains
259 0 characters, we'll use 0 as the unicode. If it 259 0 characters, we'll use 0 as the unicode. If it
260 contains multiple characters, we'll use 0 as 260 contains multiple characters, we'll use 0 as
261 the scancode/keysym. 261 the scancode/keysym.
262 */ 262 */
263 chars = [ event characters ]; 263 if (SDL_TranslateUNICODE) {
264 numChars = [ chars length ]; 264 chars = [ event characters ];
265 265 numChars = [ chars length ];
266 if (numChars == 1) { 266 } else {
267 267 numChars = 0;
268 key.scancode = [ event keyCode ]; 268 }
269 key.sym = keymap [ key.scancode ]; 269
270 key.unicode = [ chars characterAtIndex:0 ]; 270 if (numChars == 0) {
271 key.mod = KMOD_NONE;
272
273 SDL_PrivateKeyboard (state, &key);
274 }
275 else if (numChars == 0) {
276 271
277 key.scancode = [ event keyCode ]; 272 key.scancode = [ event keyCode ];
278 key.sym = keymap [ key.scancode ]; 273 key.sym = keymap [ key.scancode ];
279 key.unicode = 0; 274 key.unicode = 0;
275 key.mod = KMOD_NONE;
276
277 SDL_PrivateKeyboard (state, &key);
278 }
279 else if (numChars == 1) {
280
281 key.scancode = [ event keyCode ];
282 key.sym = keymap [ key.scancode ];
283 key.unicode = [ chars characterAtIndex:0 ];
280 key.mod = KMOD_NONE; 284 key.mod = KMOD_NONE;
281 285
282 SDL_PrivateKeyboard (state, &key); 286 SDL_PrivateKeyboard (state, &key);
283 } 287 }
284 else /* (numChars > 1) */ { 288 else /* (numChars > 1) */ {