Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Added key composition support, courtesy of Kuon
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jul 11, 2007
1 parent 5eaca97 commit bdd3675
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/video/cocoa/SDL_cocoakeyboard.m
Expand Up @@ -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);
}
Expand All @@ -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);
Expand All @@ -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: */
1 change: 1 addition & 0 deletions src/video/cocoa/SDL_cocoavideo.h
Expand Up @@ -46,6 +46,7 @@ typedef struct SDL_VideoData
unsigned int modifierFlags;
int mouse;
int keyboard;
NSText *fieldEdit;
} SDL_VideoData;

#endif /* _SDL_cocoavideo_h */
Expand Down

0 comments on commit bdd3675

Please sign in to comment.