Added key composition support, courtesy of Kuon

This commit is contained in:
Sam Lantinga 2007-07-11 08:09:20 +00:00
parent 74b0ae1377
commit c74b896ae4
2 changed files with 6 additions and 0 deletions

View File

@ -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: */

View File

@ -46,6 +46,7 @@ typedef struct SDL_VideoData
unsigned int modifierFlags;
int mouse;
int keyboard;
NSText *fieldEdit;
} SDL_VideoData;
#endif /* _SDL_cocoavideo_h */