Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Minor code cleanup in uikit/SDL_uikitview.m (no functional changes)

  • Loading branch information
keestux committed Sep 28, 2011
1 parent 0fb4ee9 commit 886f96e1aa033e3afc04877fc855db01ec47a9ed
Showing with 31 additions and 62 deletions.
  1. +31 −62 src/video/uikit/SDL_uikitview.m
@@ -311,100 +311,69 @@ - (BOOL)textFieldShouldReturn:(UITextField*)_textField
/* iPhone keyboard addition functions */
#if SDL_IPHONE_KEYBOARD

int SDL_iPhoneKeyboardShow(SDL_Window * window)
SDL_uikitview * getWindowView(SDL_Window * window)
{
SDL_WindowData *data;
SDL_uikitview *view;

if (NULL == window) {
if (window == NULL) {
SDL_SetError("Window does not exist");
return -1;
return nil;
}

data = (SDL_WindowData *)window->driverdata;
view = data->view;
SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
SDL_uikitview *view = data != NULL ? data->view : nil;

if (nil == view) {
if (view == nil) {
SDL_SetError("Window has no view");
return -1;
}
else {
[view showKeyboard];
return 0;
}

return view;
}

int SDL_iPhoneKeyboardHide(SDL_Window * window)
int SDL_iPhoneKeyboardShow(SDL_Window * window)
{
SDL_WindowData *data;
SDL_uikitview *view;

if (NULL == window) {
SDL_SetError("Window does not exist");
SDL_uikitview *view = getWindowView(window);
if (view == nil) {
return -1;
}

data = (SDL_WindowData *)window->driverdata;
view = data->view;

if (NULL == view) {
SDL_SetError("Window has no view");
return -1;
}
else {
[view hideKeyboard];
return 0;
}
[view showKeyboard];
return 0;
}

SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window)
int SDL_iPhoneKeyboardHide(SDL_Window * window)
{
SDL_WindowData *data;
SDL_uikitview *view;

if (NULL == window) {
SDL_SetError("Window does not exist");
SDL_uikitview *view = getWindowView(window);
if (view == nil) {
return -1;
}

data = (SDL_WindowData *)window->driverdata;
view = data->view;
[view hideKeyboard];
return 0;
}

if (NULL == view) {
SDL_SetError("Window has no view");
SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window)
{
SDL_uikitview *view = getWindowView(window);
if (view == nil) {
return 0;
}
else {
return view.keyboardVisible;
}

return view.keyboardVisible;
}

int SDL_iPhoneKeyboardToggle(SDL_Window * window)
{
SDL_WindowData *data;
SDL_uikitview *view;

if (NULL == window) {
SDL_SetError("Window does not exist");
SDL_uikitview *view = getWindowView(window);
if (view == nil) {
return -1;
}

data = (SDL_WindowData *)window->driverdata;
view = data->view;

if (NULL == view) {
SDL_SetError("Window has no view");
return -1;
if (SDL_iPhoneKeyboardIsShown(window)) {
SDL_iPhoneKeyboardHide(window);
}
else {
if (SDL_iPhoneKeyboardIsShown(window)) {
SDL_iPhoneKeyboardHide(window);
}
else {
SDL_iPhoneKeyboardShow(window);
}
return 0;
SDL_iPhoneKeyboardShow(window);
}
return 0;
}

#else

0 comments on commit 886f96e

Please sign in to comment.