Fixed bug #147
Only enable Unicode key events if Unicode translation is enabled. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401881
This commit is contained in:
parent
1f8047fa4e
commit
f955c92364
1 changed files with 16 additions and 12 deletions
|
@ -260,19 +260,14 @@ 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) {
|
||||
|
||||
key.scancode = [ event keyCode ];
|
||||
key.sym = keymap [ key.scancode ];
|
||||
key.unicode = [ chars characterAtIndex:0 ];
|
||||
key.mod = KMOD_NONE;
|
||||
|
||||
SDL_PrivateKeyboard (state, &key);
|
||||
if (SDL_TranslateUNICODE) {
|
||||
chars = [ event characters ];
|
||||
numChars = [ chars length ];
|
||||
} else {
|
||||
numChars = 0;
|
||||
}
|
||||
else if (numChars == 0) {
|
||||
|
||||
if (numChars == 0) {
|
||||
|
||||
key.scancode = [ event keyCode ];
|
||||
key.sym = keymap [ key.scancode ];
|
||||
|
@ -281,6 +276,15 @@ static void QZ_DoKey (_THIS, int state, NSEvent *event) {
|
|||
|
||||
SDL_PrivateKeyboard (state, &key);
|
||||
}
|
||||
else if (numChars == 1) {
|
||||
|
||||
key.scancode = [ event keyCode ];
|
||||
key.sym = keymap [ key.scancode ];
|
||||
key.unicode = [ chars characterAtIndex:0 ];
|
||||
key.mod = KMOD_NONE;
|
||||
|
||||
SDL_PrivateKeyboard (state, &key);
|
||||
}
|
||||
else /* (numChars > 1) */ {
|
||||
|
||||
int i;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue