Added key composition support, courtesy of Kuon
authorSam Lantinga <slouken@libsdl.org>
Wed, 11 Jul 2007 08:09:20 +0000
changeset 2169 13cf2d5eda86
parent 2168 07f084fe97d0
child 2170 243bc7ae5a21
Added key composition support, courtesy of Kuon
src/video/cocoa/SDL_cocoakeyboard.m
src/video/cocoa/SDL_cocoavideo.h
--- a/src/video/cocoa/SDL_cocoakeyboard.m	Wed Jul 11 07:39:01 2007 +0000
+++ b/src/video/cocoa/SDL_cocoakeyboard.m	Wed Jul 11 08:09:20 2007 +0000
@@ -514,6 +514,8 @@
 
     InitKeymap(data->keymap);
 
+    data->fieldEdit = [[NSTextView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 0.0, 0.0)];
+    
     SDL_zero(keyboard);
     data->keyboard = SDL_AddKeyboard(&keyboard, -1);
 }
@@ -537,6 +539,7 @@
                                 data->keymap[scancode]);
         }
         if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
+            [data->fieldEdit interpretKeyEvents:[NSArray arrayWithObject:event]];
             text = [[event characters] UTF8String];
             if(text && *text) {
                 SDL_SendKeyboardText(data->keyboard, text);
@@ -559,6 +562,8 @@
     SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
 
     SDL_DelKeyboard(data->keyboard);
+
+    [data->fieldEdit release];
 }
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/cocoa/SDL_cocoavideo.h	Wed Jul 11 07:39:01 2007 +0000
+++ b/src/video/cocoa/SDL_cocoavideo.h	Wed Jul 11 08:09:20 2007 +0000
@@ -46,6 +46,7 @@
     unsigned int modifierFlags;
     int mouse;
     int keyboard;
+    NSText *fieldEdit;
 } SDL_VideoData;
 
 #endif /* _SDL_cocoavideo_h */