Skip to content

Commit

Permalink
Fixed bug #147
Browse files Browse the repository at this point in the history
Only enable Unicode key events if Unicode translation is enabled.
  • Loading branch information
slouken committed Jun 23, 2006
1 parent 76745c7 commit ef0570c
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/video/quartz/SDL_QuartzEvents.m
Expand Up @@ -260,23 +260,27 @@ static void QZ_DoKey (_THIS, int state, NSEvent *event) {
contains multiple characters, we'll use 0 as
the scancode/keysym.
*/
chars = [ event characters ];
numChars = [ chars length ];

if (numChars == 1) {
if (SDL_TranslateUNICODE) {
chars = [ event characters ];
numChars = [ chars length ];
} else {
numChars = 0;
}

if (numChars == 0) {

key.scancode = [ event keyCode ];
key.sym = keymap [ key.scancode ];
key.unicode = [ chars characterAtIndex:0 ];
key.unicode = 0;
key.mod = KMOD_NONE;

SDL_PrivateKeyboard (state, &key);
}
else if (numChars == 0) {
else if (numChars == 1) {

key.scancode = [ event keyCode ];
key.sym = keymap [ key.scancode ];
key.unicode = 0;
key.unicode = [ chars characterAtIndex:0 ];
key.mod = KMOD_NONE;

SDL_PrivateKeyboard (state, &key);
Expand Down

0 comments on commit ef0570c

Please sign in to comment.