mirror of
https://github.com/yawut/SDL.git
synced 2026-06-12 11:42:00 -05:00
Added key composition support, courtesy of Kuon
This commit is contained in:
parent
74b0ae1377
commit
c74b896ae4
|
|
@ -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: */
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ typedef struct SDL_VideoData
|
|||
unsigned int modifierFlags;
|
||||
int mouse;
|
||||
int keyboard;
|
||||
NSText *fieldEdit;
|
||||
} SDL_VideoData;
|
||||
|
||||
#endif /* _SDL_cocoavideo_h */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user