Commit f955c923 authored by Sam Lantinga's avatar Sam Lantinga

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
parent 1f8047fa
...@@ -260,23 +260,27 @@ static void QZ_DoKey (_THIS, int state, NSEvent *event) { ...@@ -260,23 +260,27 @@ static void QZ_DoKey (_THIS, int state, NSEvent *event) {
contains multiple characters, we'll use 0 as contains multiple characters, we'll use 0 as
the scancode/keysym. the scancode/keysym.
*/ */
chars = [ event characters ]; if (SDL_TranslateUNICODE) {
numChars = [ chars length ]; chars = [ event characters ];
numChars = [ chars length ];
if (numChars == 1) { } else {
numChars = 0;
}
if (numChars == 0) {
key.scancode = [ event keyCode ]; key.scancode = [ event keyCode ];
key.sym = keymap [ key.scancode ]; key.sym = keymap [ key.scancode ];
key.unicode = [ chars characterAtIndex:0 ]; key.unicode = 0;
key.mod = KMOD_NONE; key.mod = KMOD_NONE;
SDL_PrivateKeyboard (state, &key); SDL_PrivateKeyboard (state, &key);
} }
else if (numChars == 0) { else if (numChars == 1) {
key.scancode = [ event keyCode ]; key.scancode = [ event keyCode ];
key.sym = keymap [ key.scancode ]; key.sym = keymap [ key.scancode ];
key.unicode = 0; key.unicode = [ chars characterAtIndex:0 ];
key.mod = KMOD_NONE; key.mod = KMOD_NONE;
SDL_PrivateKeyboard (state, &key); SDL_PrivateKeyboard (state, &key);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment