Mercurial > sdl-ios-xcode
diff src/video/cocoa/SDL_cocoakeyboard.m @ 3683:4c5ab6841fdc
From: Jjgod Jiang
Date: Mon, 18 Jan 2010 17:46:35 +0800
Subject: [PATCH] Polish text input handling for Mac OS X
- Prevent crash caused by uninitialized video data
- Prevent beeping caused by unhandled Cocoa selectors (like moveUp:
moveDown:, etc.)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 19 Jan 2010 07:28:51 +0000 |
parents | 1ab77e93a6c9 |
children | 5c64052fb476 |
line wrap: on
line diff
--- a/src/video/cocoa/SDL_cocoakeyboard.m Tue Jan 19 05:31:16 2010 +0000 +++ b/src/video/cocoa/SDL_cocoakeyboard.m Tue Jan 19 07:28:51 2010 +0000 @@ -99,7 +99,9 @@ - (void) doCommandBySelector:(SEL) myselector { - [super doCommandBySelector: myselector]; + // No need to do anything since we are not using Cocoa + // selectors to handle special keys, instead we use SDL + // key events to do the same job. } - (BOOL) hasMarkedText @@ -649,11 +651,13 @@ { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - [data->fieldEdit removeFromSuperview]; - [data->fieldEdit release]; - data->fieldEdit = nil; - [pool release]; + if (data && data->fieldEdit) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + [data->fieldEdit removeFromSuperview]; + [data->fieldEdit release]; + data->fieldEdit = nil; + [pool release]; + } } void