Commit f7ff123c authored by Sam Lantinga's avatar Sam Lantinga

Added key composition support, courtesy of Kuon

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402485
parent ffec21f2
...@@ -514,6 +514,8 @@ Cocoa_InitKeyboard(_THIS) ...@@ -514,6 +514,8 @@ Cocoa_InitKeyboard(_THIS)
InitKeymap(data->keymap); InitKeymap(data->keymap);
data->fieldEdit = [[NSTextView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 0.0, 0.0)];
SDL_zero(keyboard); SDL_zero(keyboard);
data->keyboard = SDL_AddKeyboard(&keyboard, -1); data->keyboard = SDL_AddKeyboard(&keyboard, -1);
} }
...@@ -537,6 +539,7 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event) ...@@ -537,6 +539,7 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event)
data->keymap[scancode]); data->keymap[scancode]);
} }
if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
[data->fieldEdit interpretKeyEvents:[NSArray arrayWithObject:event]];
text = [[event characters] UTF8String]; text = [[event characters] UTF8String];
if(text && *text) { if(text && *text) {
SDL_SendKeyboardText(data->keyboard, text); SDL_SendKeyboardText(data->keyboard, text);
...@@ -559,6 +562,8 @@ Cocoa_QuitKeyboard(_THIS) ...@@ -559,6 +562,8 @@ Cocoa_QuitKeyboard(_THIS)
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
SDL_DelKeyboard(data->keyboard); SDL_DelKeyboard(data->keyboard);
[data->fieldEdit release];
} }
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -46,6 +46,7 @@ typedef struct SDL_VideoData ...@@ -46,6 +46,7 @@ typedef struct SDL_VideoData
unsigned int modifierFlags; unsigned int modifierFlags;
int mouse; int mouse;
int keyboard; int keyboard;
NSText *fieldEdit;
} SDL_VideoData; } SDL_VideoData;
#endif /* _SDL_cocoavideo_h */ #endif /* _SDL_cocoavideo_h */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment