diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index 89a9a0180..3e149b502 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -514,6 +514,8 @@ Cocoa_InitKeyboard(_THIS) 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 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event) 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 @@ Cocoa_QuitKeyboard(_THIS) SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; SDL_DelKeyboard(data->keyboard); + + [data->fieldEdit release]; } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/cocoa/SDL_cocoavideo.h b/src/video/cocoa/SDL_cocoavideo.h index 730d41b69..c0b471a32 100644 --- a/src/video/cocoa/SDL_cocoavideo.h +++ b/src/video/cocoa/SDL_cocoavideo.h @@ -46,6 +46,7 @@ typedef struct SDL_VideoData unsigned int modifierFlags; int mouse; int keyboard; + NSText *fieldEdit; } SDL_VideoData; #endif /* _SDL_cocoavideo_h */