Fixed bug #147
authorSam Lantinga <slouken@libsdl.org>
Fri, 23 Jun 2006 04:27:55 +0000
changeset 1876 406b8325ee34
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
--- a/src/video/quartz/SDL_QuartzEvents.m	Fri Jun 23 02:19:52 2006 +0000
+++ b/src/video/quartz/SDL_QuartzEvents.m	Fri Jun 23 04:27:55 2006 +0000
@@ -260,10 +260,23 @@
         contains multiple characters, we'll use 0 as
         the scancode/keysym.
     */
-    chars = [ event characters ];
-    numChars = [ chars length ];
+    if (SDL_TranslateUNICODE) {
+        chars = [ event characters ];
+        numChars = [ chars length ];
+    } else {
+        numChars = 0;
+    }
 
-    if (numChars == 1) {
+    if (numChars == 0) {
+      
+        key.scancode = [ event keyCode ];
+        key.sym      = keymap [ key.scancode ];
+        key.unicode  = 0;
+        key.mod      = KMOD_NONE;
+
+        SDL_PrivateKeyboard (state, &key);
+    }
+    else if (numChars == 1) {
 
         key.scancode = [ event keyCode ];
         key.sym      = keymap [ key.scancode ];
@@ -272,15 +285,6 @@
 
         SDL_PrivateKeyboard (state, &key);
     }
-    else if (numChars == 0) {
-      
-        key.scancode = [ event keyCode ];
-        key.sym      = keymap [ key.scancode ];
-        key.unicode  = 0;
-        key.mod      = KMOD_NONE;
-
-        SDL_PrivateKeyboard (state, &key);
-    }
     else /* (numChars > 1) */ {
       
         int i;