Mercurial > sdl-ios-xcode
comparison src/video/cocoa/SDL_cocoakeyboard.m @ 2169:13cf2d5eda86
Added key composition support, courtesy of Kuon
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 11 Jul 2007 08:09:20 +0000 |
parents | 047245361002 |
children | 243bc7ae5a21 |
comparison
equal
deleted
inserted
replaced
2168:07f084fe97d0 | 2169:13cf2d5eda86 |
---|---|
512 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; | 512 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; |
513 SDL_Keyboard keyboard; | 513 SDL_Keyboard keyboard; |
514 | 514 |
515 InitKeymap(data->keymap); | 515 InitKeymap(data->keymap); |
516 | 516 |
517 data->fieldEdit = [[NSTextView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 0.0, 0.0)]; | |
518 | |
517 SDL_zero(keyboard); | 519 SDL_zero(keyboard); |
518 data->keyboard = SDL_AddKeyboard(&keyboard, -1); | 520 data->keyboard = SDL_AddKeyboard(&keyboard, -1); |
519 } | 521 } |
520 | 522 |
521 void | 523 void |
535 if (![event isARepeat]) { | 537 if (![event isARepeat]) { |
536 SDL_SendKeyboardKey(data->keyboard, SDL_PRESSED, (Uint8)scancode, | 538 SDL_SendKeyboardKey(data->keyboard, SDL_PRESSED, (Uint8)scancode, |
537 data->keymap[scancode]); | 539 data->keymap[scancode]); |
538 } | 540 } |
539 if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { | 541 if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { |
542 [data->fieldEdit interpretKeyEvents:[NSArray arrayWithObject:event]]; | |
540 text = [[event characters] UTF8String]; | 543 text = [[event characters] UTF8String]; |
541 if(text && *text) { | 544 if(text && *text) { |
542 SDL_SendKeyboardText(data->keyboard, text); | 545 SDL_SendKeyboardText(data->keyboard, text); |
543 } | 546 } |
544 } | 547 } |
557 Cocoa_QuitKeyboard(_THIS) | 560 Cocoa_QuitKeyboard(_THIS) |
558 { | 561 { |
559 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; | 562 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; |
560 | 563 |
561 SDL_DelKeyboard(data->keyboard); | 564 SDL_DelKeyboard(data->keyboard); |
565 | |
566 [data->fieldEdit release]; | |
562 } | 567 } |
563 | 568 |
564 /* vi: set ts=4 sw=4 expandtab: */ | 569 /* vi: set ts=4 sw=4 expandtab: */ |