diff src/video/quartz/SDL_QuartzEvents.m @ 1876:406b8325ee34

Fixed bug #147 Only enable Unicode key events if Unicode translation is enabled.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 23 Jun 2006 04:27:55 +0000
parents ef4a796e7f24
children c121d94672cb 4fd12011d8d6
line wrap: on
line diff
--- 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;