Fixed bug #147
authorSam Lantinga <slouken@libsdl.org>
Fri, 23 Jun 2006 04:27:55 +0000
changeset 1876406b8325ee34
parent 1875 4627eca2c02b
child 1877 9b02a5b97f79
Fixed bug #147

Only enable Unicode key events if Unicode translation is enabled.
src/video/quartz/SDL_QuartzEvents.m
     1.1 --- a/src/video/quartz/SDL_QuartzEvents.m	Fri Jun 23 02:19:52 2006 +0000
     1.2 +++ b/src/video/quartz/SDL_QuartzEvents.m	Fri Jun 23 04:27:55 2006 +0000
     1.3 @@ -260,10 +260,23 @@
     1.4          contains multiple characters, we'll use 0 as
     1.5          the scancode/keysym.
     1.6      */
     1.7 -    chars = [ event characters ];
     1.8 -    numChars = [ chars length ];
     1.9 +    if (SDL_TranslateUNICODE) {
    1.10 +        chars = [ event characters ];
    1.11 +        numChars = [ chars length ];
    1.12 +    } else {
    1.13 +        numChars = 0;
    1.14 +    }
    1.15  
    1.16 -    if (numChars == 1) {
    1.17 +    if (numChars == 0) {
    1.18 +      
    1.19 +        key.scancode = [ event keyCode ];
    1.20 +        key.sym      = keymap [ key.scancode ];
    1.21 +        key.unicode  = 0;
    1.22 +        key.mod      = KMOD_NONE;
    1.23 +
    1.24 +        SDL_PrivateKeyboard (state, &key);
    1.25 +    }
    1.26 +    else if (numChars == 1) {
    1.27  
    1.28          key.scancode = [ event keyCode ];
    1.29          key.sym      = keymap [ key.scancode ];
    1.30 @@ -272,15 +285,6 @@
    1.31  
    1.32          SDL_PrivateKeyboard (state, &key);
    1.33      }
    1.34 -    else if (numChars == 0) {
    1.35 -      
    1.36 -        key.scancode = [ event keyCode ];
    1.37 -        key.sym      = keymap [ key.scancode ];
    1.38 -        key.unicode  = 0;
    1.39 -        key.mod      = KMOD_NONE;
    1.40 -
    1.41 -        SDL_PrivateKeyboard (state, &key);
    1.42 -    }
    1.43      else /* (numChars > 1) */ {
    1.44        
    1.45          int i;