changeset 2169:13cf2d5eda86

Added key composition support, courtesy of Kuon
author Sam Lantinga <slouken@libsdl.org>
date Wed, 11 Jul 2007 08:09:20 +0000
parents 07f084fe97d0
children 243bc7ae5a21
files src/video/cocoa/SDL_cocoakeyboard.m src/video/cocoa/SDL_cocoavideo.h
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 */