comparison src/video/SDL_video.c @ 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 8e961ef35d4b
children 64ce267332c6
comparison
equal deleted inserted replaced
3682:e4009cea0e82 3683:4c5ab6841fdc
3578 } 3578 }
3579 3579
3580 void 3580 void
3581 SDL_StartTextInput(void) 3581 SDL_StartTextInput(void)
3582 { 3582 {
3583 if (_this->StartTextInput) { 3583 if (_this && _this->StartTextInput) {
3584 _this->StartTextInput(_this); 3584 _this->StartTextInput(_this);
3585 } 3585 }
3586 SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE); 3586 SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE);
3587 SDL_EventState(SDL_TEXTEDITING, SDL_ENABLE); 3587 SDL_EventState(SDL_TEXTEDITING, SDL_ENABLE);
3588 } 3588 }
3589 3589
3590 void 3590 void
3591 SDL_StopTextInput(void) 3591 SDL_StopTextInput(void)
3592 { 3592 {
3593 if (_this->StopTextInput) { 3593 if (_this && _this->StopTextInput) {
3594 _this->StopTextInput(_this); 3594 _this->StopTextInput(_this);
3595 } 3595 }
3596 SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE); 3596 SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE);
3597 SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE); 3597 SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE);
3598 } 3598 }
3599 3599
3600 void 3600 void
3601 SDL_SetTextInputRect(SDL_Rect *rect) 3601 SDL_SetTextInputRect(SDL_Rect *rect)
3602 { 3602 {
3603 if (_this->SetTextInputRect) { 3603 if (_this && _this->SetTextInputRect) {
3604 _this->SetTextInputRect(_this, rect); 3604 _this->SetTextInputRect(_this, rect);
3605 } 3605 }
3606 } 3606 }
3607 3607
3608 /* vi: set ts=4 sw=4 expandtab: */ 3608 /* vi: set ts=4 sw=4 expandtab: */