diff src/video/quartz/SDL_QuartzEvents.m @ 4049:60f677630282 SDL-1.2

Added key composition support, courtesy of Kuon
author Sam Lantinga <slouken@libsdl.org>
date Wed, 11 Jul 2007 07:53:12 +0000
parents f5794774970d
children 58a5055da431
line wrap: on
line diff
--- a/src/video/quartz/SDL_QuartzEvents.m	Wed Jul 11 07:47:47 2007 +0000
+++ b/src/video/quartz/SDL_QuartzEvents.m	Wed Jul 11 07:53:12 2007 +0000
@@ -254,7 +254,7 @@
 static void QZ_DoKey (_THIS, int state, NSEvent *event) {
 
     NSString *chars;
-    unsigned int numChars;
+    unsigned int i, numChars;
     SDL_keysym key;
     
     /* 
@@ -265,7 +265,8 @@
         contains multiple characters, we'll use 0 as
         the scancode/keysym.
     */
-    if (SDL_TranslateUNICODE) {
+    if (SDL_TranslateUNICODE && state == SDL_PRESSED) {
+        [field_edit interpretKeyEvents:[NSArray arrayWithObject:event]];
         chars = [ event characters ];
         numChars = [ chars length ];
     } else {
@@ -281,7 +282,7 @@
 
         SDL_PrivateKeyboard (state, &key);
     }
-    else if (numChars == 1) {
+    else if (numChars >= 1) {
 
         key.scancode = [ event keyCode ];
         key.sym      = keymap [ key.scancode ];
@@ -289,11 +290,8 @@
         key.mod      = KMOD_NONE;
 
         SDL_PrivateKeyboard (state, &key);
-    }
-    else /* (numChars > 1) */ {
       
-        int i;
-        for (i = 0; i < numChars; i++) {
+        for (i = 1; i < numChars; i++) {
 
             key.scancode = 0;
             key.sym      = 0;