Fixed spacing
authorSam Lantinga <slouken@libsdl.org>
Tue, 01 Feb 2011 08:59:22 -0800
changeset 51317b7da52e8775
parent 5130 ec13e48ee0d9
child 5132 5f09cb749d75
Fixed spacing
src/video/uikit/SDL_uikitappdelegate.m
src/video/uikit/SDL_uikitevents.m
src/video/uikit/SDL_uikitopengles.m
src/video/uikit/SDL_uikitvideo.m
src/video/uikit/SDL_uikitview.m
     1.1 --- a/src/video/uikit/SDL_uikitappdelegate.m	Tue Feb 01 08:54:34 2011 -0800
     1.2 +++ b/src/video/uikit/SDL_uikitappdelegate.m	Tue Feb 01 08:59:22 2011 -0800
     1.3 @@ -37,69 +37,68 @@
     1.4  
     1.5  int main(int argc, char **argv) {
     1.6  
     1.7 -	int i;
     1.8 -	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     1.9 -	
    1.10 -	/* store arguments */
    1.11 -	forward_argc = argc;
    1.12 -	forward_argv = (char **)malloc((argc+1) * sizeof(char *));
    1.13 -	for (i=0; i<argc; i++) {
    1.14 -		forward_argv[i] = malloc( (strlen(argv[i])+1) * sizeof(char));
    1.15 -		strcpy(forward_argv[i], argv[i]);
    1.16 -	}
    1.17 -	forward_argv[i] = NULL;
    1.18 +    int i;
    1.19 +    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    1.20 +    
    1.21 +    /* store arguments */
    1.22 +    forward_argc = argc;
    1.23 +    forward_argv = (char **)malloc((argc+1) * sizeof(char *));
    1.24 +    for (i=0; i<argc; i++) {
    1.25 +        forward_argv[i] = malloc( (strlen(argv[i])+1) * sizeof(char));
    1.26 +        strcpy(forward_argv[i], argv[i]);
    1.27 +    }
    1.28 +    forward_argv[i] = NULL;
    1.29  
    1.30 -	/* Give over control to run loop, SDLUIKitDelegate will handle most things from here */
    1.31 -	UIApplicationMain(argc, argv, NULL, @"SDLUIKitDelegate");
    1.32 -	
    1.33 -	[pool release];
    1.34 -	
    1.35 +    /* Give over control to run loop, SDLUIKitDelegate will handle most things from here */
    1.36 +    UIApplicationMain(argc, argv, NULL, @"SDLUIKitDelegate");
    1.37 +    
    1.38 +    [pool release];
    1.39 +    
    1.40  }
    1.41  
    1.42  @implementation SDLUIKitDelegate
    1.43  
    1.44  /* convenience method */
    1.45  +(SDLUIKitDelegate *)sharedAppDelegate {
    1.46 -	/* the delegate is set in UIApplicationMain(), which is garaunteed to be called before this method */
    1.47 -	return (SDLUIKitDelegate *)[[UIApplication sharedApplication] delegate];
    1.48 +    /* the delegate is set in UIApplicationMain(), which is garaunteed to be called before this method */
    1.49 +    return (SDLUIKitDelegate *)[[UIApplication sharedApplication] delegate];
    1.50  }
    1.51  
    1.52  - (id)init {
    1.53 -	self = [super init];
    1.54 -	return self;
    1.55 +    self = [super init];
    1.56 +    return self;
    1.57  }
    1.58  
    1.59  - (void)postFinishLaunch {
    1.60  
    1.61 -	/* run the user's application, passing argc and argv */
    1.62 -	int exit_status = SDL_main(forward_argc, forward_argv);
    1.63 -	
    1.64 -	/* free the memory we used to hold copies of argc and argv */
    1.65 -	int i;
    1.66 -	for (i=0; i<forward_argc; i++) {
    1.67 -		free(forward_argv[i]);
    1.68 -	}
    1.69 -	free(forward_argv);	
    1.70 -		
    1.71 -	/* exit, passing the return status from the user's application */
    1.72 -	exit(exit_status);
    1.73 +    /* run the user's application, passing argc and argv */
    1.74 +    int exit_status = SDL_main(forward_argc, forward_argv);
    1.75 +    
    1.76 +    /* free the memory we used to hold copies of argc and argv */
    1.77 +    int i;
    1.78 +    for (i=0; i<forward_argc; i++) {
    1.79 +        free(forward_argv[i]);
    1.80 +    }
    1.81 +    free(forward_argv);    
    1.82 +        
    1.83 +    /* exit, passing the return status from the user's application */
    1.84 +    exit(exit_status);
    1.85  }
    1.86  
    1.87  - (void)applicationDidFinishLaunching:(UIApplication *)application {
    1.88 -			
    1.89 -	/* Set working directory to resource path */
    1.90 -	[[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]];
    1.91 -	
    1.92 -	[self performSelector:@selector(postFinishLaunch) withObject:nil
    1.93 +            
    1.94 +    /* Set working directory to resource path */
    1.95 +    [[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]];
    1.96 +    
    1.97 +    [self performSelector:@selector(postFinishLaunch) withObject:nil
    1.98  afterDelay:0.0];
    1.99  }
   1.100  
   1.101  - (void)applicationWillTerminate:(UIApplication *)application {
   1.102 -	
   1.103 -	SDL_SendQuit();
   1.104 -	 /* hack to prevent automatic termination.  See SDL_uikitevents.m for details */
   1.105 -	longjmp(*(jump_env()), 1);
   1.106 -	
   1.107 +    
   1.108 +    SDL_SendQuit();
   1.109 +     /* hack to prevent automatic termination.  See SDL_uikitevents.m for details */
   1.110 +    longjmp(*(jump_env()), 1);
   1.111  }
   1.112  
   1.113  - (void) applicationWillResignActive:(UIApplication*)application
     2.1 --- a/src/video/uikit/SDL_uikitevents.m	Tue Feb 01 08:54:34 2011 -0800
     2.2 +++ b/src/video/uikit/SDL_uikitevents.m	Tue Feb 01 08:59:22 2011 -0800
     2.3 @@ -32,25 +32,24 @@
     2.4  void
     2.5  UIKit_PumpEvents(_THIS)
     2.6  {
     2.7 -	/* 
     2.8 -		When the user presses the 'home' button on the iPod
     2.9 -		the application exits -- immediatly.
    2.10 -	 
    2.11 -		Unlike in Mac OS X, it appears there is no way to cancel the termination.
    2.12 -	 
    2.13 -		This doesn't give the SDL user's application time to respond to an SDL_Quit event.
    2.14 -		So what we do is that in the UIApplicationDelegate class (SDLUIApplicationDelegate),
    2.15 -		when the delegate receives the ApplicationWillTerminate message, we execute
    2.16 -		a longjmp statement to get back here, preventing an immediate exit.
    2.17 -	 */	
    2.18 -	if (setjmp(*jump_env()) == 0) {
    2.19 -		/* if we're setting the jump, rather than jumping back */
    2.20 -		SInt32 result;
    2.21 -		do {
    2.22 -			result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, TRUE);
    2.23 -		} while(result == kCFRunLoopRunHandledSource);
    2.24 -	}
    2.25 -
    2.26 +    /* 
    2.27 +        When the user presses the 'home' button on the iPod
    2.28 +        the application exits -- immediatly.
    2.29 +     
    2.30 +        Unlike in Mac OS X, it appears there is no way to cancel the termination.
    2.31 +     
    2.32 +        This doesn't give the SDL user's application time to respond to an SDL_Quit event.
    2.33 +        So what we do is that in the UIApplicationDelegate class (SDLUIApplicationDelegate),
    2.34 +        when the delegate receives the ApplicationWillTerminate message, we execute
    2.35 +        a longjmp statement to get back here, preventing an immediate exit.
    2.36 +     */    
    2.37 +    if (setjmp(*jump_env()) == 0) {
    2.38 +        /* if we're setting the jump, rather than jumping back */
    2.39 +        SInt32 result;
    2.40 +        do {
    2.41 +            result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, TRUE);
    2.42 +        } while(result == kCFRunLoopRunHandledSource);
    2.43 +    }
    2.44  }
    2.45  
    2.46  /* vi: set ts=4 sw=4 expandtab: */
     3.1 --- a/src/video/uikit/SDL_uikitopengles.m	Tue Feb 01 08:54:34 2011 -0800
     3.2 +++ b/src/video/uikit/SDL_uikitopengles.m	Tue Feb 01 08:59:22 2011 -0800
     3.3 @@ -35,42 +35,42 @@
     3.4  
     3.5  void *
     3.6  UIKit_GL_GetProcAddress(_THIS, const char *proc)
     3.7 -{	
     3.8 -	/* Look through all SO's for the proc symbol.  Here's why:
     3.9 -	   -Looking for the path to the OpenGL Library seems not to work in the iPhone Simulator.
    3.10 -	   -We don't know that the path won't change in the future.
    3.11 -	*/
    3.12 +{    
    3.13 +    /* Look through all SO's for the proc symbol.  Here's why:
    3.14 +       -Looking for the path to the OpenGL Library seems not to work in the iPhone Simulator.
    3.15 +       -We don't know that the path won't change in the future.
    3.16 +    */
    3.17      return SDL_LoadFunction(RTLD_DEFAULT, proc);
    3.18  }
    3.19  
    3.20  /*
    3.21 -	note that SDL_GL_Delete context makes it current without passing the window
    3.22 +    note that SDL_GL_Delete context makes it current without passing the window
    3.23  */
    3.24  int UIKit_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
    3.25  {
    3.26 -	
    3.27 -	if (context) {
    3.28 -		SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
    3.29 -		[data->view setCurrentContext];
    3.30 -	}
    3.31 -	else {
    3.32 -		[EAGLContext setCurrentContext: nil];
    3.33 -	}
    3.34 -		
    3.35 +    
    3.36 +    if (context) {
    3.37 +        SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
    3.38 +        [data->view setCurrentContext];
    3.39 +    }
    3.40 +    else {
    3.41 +        [EAGLContext setCurrentContext: nil];
    3.42 +    }
    3.43 +        
    3.44      return 0;
    3.45  }
    3.46  
    3.47  int
    3.48  UIKit_GL_LoadLibrary(_THIS, const char *path)
    3.49  {
    3.50 -	/* 
    3.51 -		shouldn't be passing a path into this function 
    3.52 -		why?  Because we've already loaded the library
    3.53 -		and because the SDK forbids loading an external SO
    3.54 -	*/
    3.55 +    /* 
    3.56 +        shouldn't be passing a path into this function 
    3.57 +        why?  Because we've already loaded the library
    3.58 +        and because the SDK forbids loading an external SO
    3.59 +    */
    3.60      if (path != NULL) {
    3.61 -		SDL_SetError("iPhone GL Load Library just here for compatibility");
    3.62 -		return -1;
    3.63 +        SDL_SetError("iPhone GL Load Library just here for compatibility");
    3.64 +        return -1;
    3.65      }
    3.66      return 0;
    3.67  }
    3.68 @@ -84,65 +84,63 @@
    3.69      SDL_UIKit_UpdateBatteryMonitoring();
    3.70      #endif
    3.71  
    3.72 -	SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
    3.73 -	
    3.74 -	if (nil == data->view) {
    3.75 -		return;
    3.76 -	}
    3.77 -	[data->view swapBuffers];
    3.78 -	/* since now we've got something to draw
    3.79 -	   make the window visible */
    3.80 -	[data->uiwindow makeKeyAndVisible];
    3.81 +    SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
    3.82 +    
    3.83 +    if (nil == data->view) {
    3.84 +        return;
    3.85 +    }
    3.86 +    [data->view swapBuffers];
    3.87 +    /* since now we've got something to draw
    3.88 +       make the window visible */
    3.89 +    [data->uiwindow makeKeyAndVisible];
    3.90  
    3.91 -	/* we need to let the event cycle run, or the OS won't update the OpenGL view! */
    3.92 -	SDL_PumpEvents();
    3.93 -	
    3.94 +    /* we need to let the event cycle run, or the OS won't update the OpenGL view! */
    3.95 +    SDL_PumpEvents();
    3.96 +    
    3.97  }
    3.98  
    3.99  SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window)
   3.100  {
   3.101 -	SDL_uikitopenglview *view;
   3.102 -	SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   3.103 +    SDL_uikitopenglview *view;
   3.104 +    SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   3.105      UIScreen *uiscreen = (UIScreen *) window->display->driverdata;
   3.106 -	UIWindow *uiwindow = data->uiwindow;
   3.107 +    UIWindow *uiwindow = data->uiwindow;
   3.108  
   3.109      /* construct our view, passing in SDL's OpenGL configuration data */
   3.110      view = [[SDL_uikitopenglview alloc] initWithFrame: [uiwindow bounds] \
   3.111 -									retainBacking: _this->gl_config.retained_backing \
   3.112 -									rBits: _this->gl_config.red_size \
   3.113 -									gBits: _this->gl_config.green_size \
   3.114 -									bBits: _this->gl_config.blue_size \
   3.115 -									aBits: _this->gl_config.alpha_size \
   3.116 -									depthBits: _this->gl_config.depth_size];
   3.117 -	
   3.118 -	data->view = view;
   3.119 -	
   3.120 -	/* add the view to our window */
   3.121 -	[uiwindow addSubview: view ];
   3.122 -	
   3.123 -	/* Don't worry, the window retained the view */
   3.124 -	[view release];
   3.125 -	
   3.126 -	if ( UIKit_GL_MakeCurrent(_this, window, view) < 0 ) {
   3.127 +                                    retainBacking: _this->gl_config.retained_backing \
   3.128 +                                    rBits: _this->gl_config.red_size \
   3.129 +                                    gBits: _this->gl_config.green_size \
   3.130 +                                    bBits: _this->gl_config.blue_size \
   3.131 +                                    aBits: _this->gl_config.alpha_size \
   3.132 +                                    depthBits: _this->gl_config.depth_size];
   3.133 +    
   3.134 +    data->view = view;
   3.135 +    
   3.136 +    /* add the view to our window */
   3.137 +    [uiwindow addSubview: view ];
   3.138 +    
   3.139 +    /* Don't worry, the window retained the view */
   3.140 +    [view release];
   3.141 +    
   3.142 +    if ( UIKit_GL_MakeCurrent(_this, window, view) < 0 ) {
   3.143          UIKit_GL_DeleteContext(_this, view);
   3.144          return NULL;
   3.145      }
   3.146  
   3.147 -	/* Make this window the current mouse focus for touch input */
   3.148 -	SDL_SetMouseFocus(window);
   3.149 -	SDL_SetKeyboardFocus(window);
   3.150 +    /* Make this window the current mouse focus for touch input */
   3.151 +    SDL_SetMouseFocus(window);
   3.152 +    SDL_SetKeyboardFocus(window);
   3.153  
   3.154 -	return view;
   3.155 +    return view;
   3.156  }
   3.157  
   3.158  void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context)
   3.159  {
   3.160 -	/* the delegate has retained the view, this will release him */
   3.161 -	SDL_uikitopenglview *view = (SDL_uikitopenglview *)context;
   3.162 -	/* this will also delete it */
   3.163 -	[view removeFromSuperview];
   3.164 -	
   3.165 -	return;
   3.166 +    /* the delegate has retained the view, this will release him */
   3.167 +    SDL_uikitopenglview *view = (SDL_uikitopenglview *)context;
   3.168 +    /* this will also delete it */
   3.169 +    [view removeFromSuperview];
   3.170  }
   3.171  
   3.172  
     4.1 --- a/src/video/uikit/SDL_uikitvideo.m	Tue Feb 01 08:54:34 2011 -0800
     4.2 +++ b/src/video/uikit/SDL_uikitvideo.m	Tue Feb 01 08:59:22 2011 -0800
     4.3 @@ -56,7 +56,7 @@
     4.4  static int
     4.5  UIKit_Available(void)
     4.6  {
     4.7 -	return (1);
     4.8 +    return (1);
     4.9  }
    4.10  
    4.11  static void UIKit_DeleteDevice(SDL_VideoDevice * device)
    4.12 @@ -85,22 +85,22 @@
    4.13      device->GetDisplayModes = UIKit_GetDisplayModes;
    4.14      device->SetDisplayMode = UIKit_SetDisplayMode;
    4.15      device->PumpEvents = UIKit_PumpEvents;
    4.16 -	device->CreateWindow = UIKit_CreateWindow;
    4.17 -	device->DestroyWindow = UIKit_DestroyWindow;
    4.18 +    device->CreateWindow = UIKit_CreateWindow;
    4.19 +    device->DestroyWindow = UIKit_DestroyWindow;
    4.20      device->GetWindowWMInfo = UIKit_GetWindowWMInfo;
    4.21 -	
    4.22 -	
    4.23 -	/* OpenGL (ES) functions */
    4.24 -	device->GL_MakeCurrent		= UIKit_GL_MakeCurrent;
    4.25 -	device->GL_SwapWindow		= UIKit_GL_SwapWindow;
    4.26 -	device->GL_CreateContext	= UIKit_GL_CreateContext;
    4.27 -	device->GL_DeleteContext    = UIKit_GL_DeleteContext;
    4.28 -	device->GL_GetProcAddress   = UIKit_GL_GetProcAddress;
    4.29 -	device->GL_LoadLibrary	    = UIKit_GL_LoadLibrary;
    4.30 -	device->free = UIKit_DeleteDevice;
    4.31 +    
    4.32 +    
    4.33 +    /* OpenGL (ES) functions */
    4.34 +    device->GL_MakeCurrent        = UIKit_GL_MakeCurrent;
    4.35 +    device->GL_SwapWindow        = UIKit_GL_SwapWindow;
    4.36 +    device->GL_CreateContext    = UIKit_GL_CreateContext;
    4.37 +    device->GL_DeleteContext    = UIKit_GL_DeleteContext;
    4.38 +    device->GL_GetProcAddress   = UIKit_GL_GetProcAddress;
    4.39 +    device->GL_LoadLibrary        = UIKit_GL_LoadLibrary;
    4.40 +    device->free = UIKit_DeleteDevice;
    4.41  
    4.42 -	device->gl_config.accelerated = 1;
    4.43 -	
    4.44 +    device->gl_config.accelerated = 1;
    4.45 +
    4.46      return device;
    4.47  }
    4.48  
     5.1 --- a/src/video/uikit/SDL_uikitview.m	Tue Feb 01 08:54:34 2011 -0800
     5.2 +++ b/src/video/uikit/SDL_uikitview.m	Tue Feb 01 08:59:22 2011 -0800
     5.3 @@ -35,271 +35,271 @@
     5.4  @implementation SDL_uikitview
     5.5  
     5.6  - (void)dealloc {
     5.7 -	[super dealloc];
     5.8 +    [super dealloc];
     5.9  }
    5.10  
    5.11  - (id)initWithFrame:(CGRect)frame {
    5.12  
    5.13 -	self = [super initWithFrame: frame];
    5.14 -	
    5.15 +    self = [super initWithFrame: frame];
    5.16 +    
    5.17  #if SDL_IPHONE_KEYBOARD
    5.18 -	[self initializeKeyboard];
    5.19 -#endif	
    5.20 +    [self initializeKeyboard];
    5.21 +#endif    
    5.22  
    5.23  #ifdef FIXED_MULTITOUCH
    5.24 -	SDL_Touch touch;
    5.25 -	touch.id = 0; //TODO: Should be -1?
    5.26 +    SDL_Touch touch;
    5.27 +    touch.id = 0; //TODO: Should be -1?
    5.28  
    5.29 -	//touch.driverdata = SDL_malloc(sizeof(EventTouchData));
    5.30 -	//EventTouchData* data = (EventTouchData*)(touch.driverdata);
    5.31 -	
    5.32 -	touch.x_min = 0;
    5.33 -	touch.x_max = frame.size.width;
    5.34 -	touch.native_xres = touch.x_max - touch.x_min;
    5.35 -	touch.y_min = 0;
    5.36 -	touch.y_max = frame.size.height;
    5.37 -	touch.native_yres = touch.y_max - touch.y_min;
    5.38 -	touch.pressure_min = 0;
    5.39 -	touch.pressure_max = 1;
    5.40 -	touch.native_pressureres = touch.pressure_max - touch.pressure_min;
    5.41 +    //touch.driverdata = SDL_malloc(sizeof(EventTouchData));
    5.42 +    //EventTouchData* data = (EventTouchData*)(touch.driverdata);
    5.43 +    
    5.44 +    touch.x_min = 0;
    5.45 +    touch.x_max = frame.size.width;
    5.46 +    touch.native_xres = touch.x_max - touch.x_min;
    5.47 +    touch.y_min = 0;
    5.48 +    touch.y_max = frame.size.height;
    5.49 +    touch.native_yres = touch.y_max - touch.y_min;
    5.50 +    touch.pressure_min = 0;
    5.51 +    touch.pressure_max = 1;
    5.52 +    touch.native_pressureres = touch.pressure_max - touch.pressure_min;
    5.53  
    5.54  
    5.55 -	touchId = SDL_AddTouch(&touch, "IPHONE SCREEN");
    5.56 +    touchId = SDL_AddTouch(&touch, "IPHONE SCREEN");
    5.57  #endif
    5.58  
    5.59 -	return self;
    5.60 +    return self;
    5.61  
    5.62  }
    5.63  
    5.64  - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    5.65  
    5.66 -	NSEnumerator *enumerator = [touches objectEnumerator];
    5.67 -	UITouch *touch = (UITouch*)[enumerator nextObject];
    5.68 -	
    5.69 -	//NSLog("Click");
    5.70 -	
    5.71 -	if (touch) {
    5.72 -		CGPoint locationInView = [touch locationInView: self];
    5.73 -			
    5.74 -		/* send moved event */
    5.75 -		SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y);
    5.76 +    NSEnumerator *enumerator = [touches objectEnumerator];
    5.77 +    UITouch *touch = (UITouch*)[enumerator nextObject];
    5.78 +    
    5.79 +    //NSLog("Click");
    5.80 +    
    5.81 +    if (touch) {
    5.82 +        CGPoint locationInView = [touch locationInView: self];
    5.83 +            
    5.84 +        /* send moved event */
    5.85 +        SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y);
    5.86  
    5.87 -		/* send mouse down event */
    5.88 -		SDL_SendMouseButton(NULL, SDL_PRESSED, SDL_BUTTON_LEFT);
    5.89 -	}
    5.90 +        /* send mouse down event */
    5.91 +        SDL_SendMouseButton(NULL, SDL_PRESSED, SDL_BUTTON_LEFT);
    5.92 +    }
    5.93  
    5.94  #ifdef FIXED_MULTITOUCH
    5.95 -	while(touch) {
    5.96 -	  CGPoint locationInView = [touch locationInView: self];
    5.97 +    while(touch) {
    5.98 +      CGPoint locationInView = [touch locationInView: self];
    5.99  
   5.100  
   5.101  #ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
   5.102 -	  //FIXME: TODO: Using touch as the fingerId is potentially dangerous
   5.103 -	  //It is also much more efficient than storing the UITouch pointer
   5.104 -	  //and comparing it to the incoming event.
   5.105 -	  SDL_SendFingerDown(touchId,(long)touch,
   5.106 -			     SDL_TRUE,locationInView.x,locationInView.y,
   5.107 -			     1);
   5.108 +      //FIXME: TODO: Using touch as the fingerId is potentially dangerous
   5.109 +      //It is also much more efficient than storing the UITouch pointer
   5.110 +      //and comparing it to the incoming event.
   5.111 +      SDL_SendFingerDown(touchId,(long)touch,
   5.112 +                 SDL_TRUE,locationInView.x,locationInView.y,
   5.113 +                 1);
   5.114  #else
   5.115 -	  int i;
   5.116 -	  for(i = 0;i < MAX_SIMULTANEOUS_TOUCHES;i++) {
   5.117 -	    if(finger[i] == NULL) {
   5.118 -	      finger[i] = touch;
   5.119 -	      SDL_SendFingerDown(touchId,i,
   5.120 -				 SDL_TRUE,locationInView.x,locationInView.y,
   5.121 -				 1);
   5.122 -	      break;
   5.123 -	    }
   5.124 -	  }
   5.125 +      int i;
   5.126 +      for(i = 0;i < MAX_SIMULTANEOUS_TOUCHES;i++) {
   5.127 +        if(finger[i] == NULL) {
   5.128 +          finger[i] = touch;
   5.129 +          SDL_SendFingerDown(touchId,i,
   5.130 +                 SDL_TRUE,locationInView.x,locationInView.y,
   5.131 +                 1);
   5.132 +          break;
   5.133 +        }
   5.134 +      }
   5.135  #endif
   5.136 -	  
   5.137 +      
   5.138  
   5.139 -	  
   5.140 +      
   5.141  
   5.142 -	  touch = (UITouch*)[enumerator nextObject]; 
   5.143 -	}
   5.144 +      touch = (UITouch*)[enumerator nextObject]; 
   5.145 +    }
   5.146  #endif
   5.147  }
   5.148  
   5.149  - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
   5.150 -	
   5.151 -	NSEnumerator *enumerator = [touches objectEnumerator];
   5.152 -	UITouch *touch = (UITouch*)[enumerator nextObject];
   5.153 -	
   5.154 -	if (touch) {
   5.155 -		/* send mouse up */
   5.156 -		SDL_SendMouseButton(NULL, SDL_RELEASED, SDL_BUTTON_LEFT);
   5.157 -	}
   5.158 +    
   5.159 +    NSEnumerator *enumerator = [touches objectEnumerator];
   5.160 +    UITouch *touch = (UITouch*)[enumerator nextObject];
   5.161 +    
   5.162 +    if (touch) {
   5.163 +        /* send mouse up */
   5.164 +        SDL_SendMouseButton(NULL, SDL_RELEASED, SDL_BUTTON_LEFT);
   5.165 +    }
   5.166  
   5.167  #ifdef FIXED_MULTITOUCH
   5.168 -	while(touch) {
   5.169 -	  CGPoint locationInView = [touch locationInView: self];
   5.170 -	  
   5.171 +    while(touch) {
   5.172 +      CGPoint locationInView = [touch locationInView: self];
   5.173 +      
   5.174  
   5.175  #ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
   5.176 -	  SDL_SendFingerDown(touchId,(long)touch,
   5.177 -			     SDL_FALSE,locationInView.x,locationInView.y,
   5.178 -			     1);
   5.179 +      SDL_SendFingerDown(touchId,(long)touch,
   5.180 +                 SDL_FALSE,locationInView.x,locationInView.y,
   5.181 +                 1);
   5.182  #else
   5.183 -	  int i;
   5.184 -	  for(i = 0;i < MAX_SIMULTANEOUS_TOUCHES;i++) {
   5.185 -	    if(finger[i] == touch) {
   5.186 -	      SDL_SendFingerDown(touchId,i,
   5.187 -				 SDL_FALSE,locationInView.x,locationInView.y,
   5.188 -				 1);
   5.189 -	      break;
   5.190 -	    }
   5.191 -	  }
   5.192 +      int i;
   5.193 +      for(i = 0;i < MAX_SIMULTANEOUS_TOUCHES;i++) {
   5.194 +        if(finger[i] == touch) {
   5.195 +          SDL_SendFingerDown(touchId,i,
   5.196 +                 SDL_FALSE,locationInView.x,locationInView.y,
   5.197 +                 1);
   5.198 +          break;
   5.199 +        }
   5.200 +      }
   5.201  #endif
   5.202  
   5.203 -	  touch = (UITouch*)[enumerator nextObject]; 
   5.204 -	}
   5.205 +      touch = (UITouch*)[enumerator nextObject]; 
   5.206 +    }
   5.207  #endif
   5.208  }
   5.209  
   5.210  - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
   5.211 -	/*
   5.212 -		this can happen if the user puts more than 5 touches on the screen
   5.213 -		at once, or perhaps in other circumstances.  Usually (it seems)
   5.214 -		all active touches are canceled.
   5.215 -	*/
   5.216 -	[self touchesEnded: touches withEvent: event];
   5.217 +    /*
   5.218 +        this can happen if the user puts more than 5 touches on the screen
   5.219 +        at once, or perhaps in other circumstances.  Usually (it seems)
   5.220 +        all active touches are canceled.
   5.221 +    */
   5.222 +    [self touchesEnded: touches withEvent: event];
   5.223  }
   5.224  
   5.225  - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
   5.226 -	
   5.227 -	NSEnumerator *enumerator = [touches objectEnumerator];
   5.228 -	UITouch *touch = (UITouch*)[enumerator nextObject];
   5.229 -	
   5.230 -	if (touch) {
   5.231 -		CGPoint locationInView = [touch locationInView: self];
   5.232 +    
   5.233 +    NSEnumerator *enumerator = [touches objectEnumerator];
   5.234 +    UITouch *touch = (UITouch*)[enumerator nextObject];
   5.235 +    
   5.236 +    if (touch) {
   5.237 +        CGPoint locationInView = [touch locationInView: self];
   5.238  
   5.239 -		/* send moved event */
   5.240 -		SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y);
   5.241 -	}
   5.242 +        /* send moved event */
   5.243 +        SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y);
   5.244 +    }
   5.245  
   5.246  #ifdef FIXED_MULTITOUCH
   5.247 -	while(touch) {
   5.248 -	  CGPoint locationInView = [touch locationInView: self];
   5.249 -	  
   5.250 +    while(touch) {
   5.251 +      CGPoint locationInView = [touch locationInView: self];
   5.252 +      
   5.253  
   5.254  #ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
   5.255 -	  SDL_SendTouchMotion(touchId,(long)touch,
   5.256 -			      SDL_FALSE,locationInView.x,locationInView.y,
   5.257 -			      1);
   5.258 +      SDL_SendTouchMotion(touchId,(long)touch,
   5.259 +                  SDL_FALSE,locationInView.x,locationInView.y,
   5.260 +                  1);
   5.261  #else
   5.262 -	  int i;
   5.263 -	  for(i = 0;i < MAX_SIMULTANEOUS_TOUCHES;i++) {
   5.264 -	    if(finger[i] == touch) {
   5.265 -	      SDL_SendTouchMotion(touchId,i,
   5.266 -				  SDL_FALSE,locationInView.x,locationInView.y,
   5.267 -				  1);
   5.268 -	      break;
   5.269 -	    }
   5.270 -	  }
   5.271 +      int i;
   5.272 +      for(i = 0;i < MAX_SIMULTANEOUS_TOUCHES;i++) {
   5.273 +        if(finger[i] == touch) {
   5.274 +          SDL_SendTouchMotion(touchId,i,
   5.275 +                  SDL_FALSE,locationInView.x,locationInView.y,
   5.276 +                  1);
   5.277 +          break;
   5.278 +        }
   5.279 +      }
   5.280  #endif
   5.281  
   5.282 -	  touch = (UITouch*)[enumerator nextObject]; 
   5.283 -	}
   5.284 +      touch = (UITouch*)[enumerator nextObject]; 
   5.285 +    }
   5.286  #endif
   5.287  }
   5.288  
   5.289  /*
   5.290 -	---- Keyboard related functionality below this line ----
   5.291 +    ---- Keyboard related functionality below this line ----
   5.292  */
   5.293  #if SDL_IPHONE_KEYBOARD
   5.294  
   5.295  /* Is the iPhone virtual keyboard visible onscreen? */
   5.296  - (BOOL)keyboardVisible {
   5.297 -	return keyboardVisible;
   5.298 +    return keyboardVisible;
   5.299  }
   5.300  
   5.301  /* Set ourselves up as a UITextFieldDelegate */
   5.302  - (void)initializeKeyboard {
   5.303 -		
   5.304 -	textField = [[UITextField alloc] initWithFrame: CGRectZero];
   5.305 -	textField.delegate = self;
   5.306 -	/* placeholder so there is something to delete! */
   5.307 -	textField.text = @" ";	
   5.308 -	
   5.309 -	/* set UITextInputTrait properties, mostly to defaults */
   5.310 -	textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
   5.311 -	textField.autocorrectionType = UITextAutocorrectionTypeNo;
   5.312 -	textField.enablesReturnKeyAutomatically = NO;
   5.313 -	textField.keyboardAppearance = UIKeyboardAppearanceDefault;
   5.314 -	textField.keyboardType = UIKeyboardTypeDefault;
   5.315 -	textField.returnKeyType = UIReturnKeyDefault;
   5.316 -	textField.secureTextEntry = NO;	
   5.317 -	
   5.318 -	textField.hidden = YES;
   5.319 -	keyboardVisible = NO;
   5.320 -	/* add the UITextField (hidden) to our view */
   5.321 -	[self addSubview: textField];
   5.322 -	[textField release];
   5.323 +        
   5.324 +    textField = [[UITextField alloc] initWithFrame: CGRectZero];
   5.325 +    textField.delegate = self;
   5.326 +    /* placeholder so there is something to delete! */
   5.327 +    textField.text = @" ";    
   5.328 +    
   5.329 +    /* set UITextInputTrait properties, mostly to defaults */
   5.330 +    textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
   5.331 +    textField.autocorrectionType = UITextAutocorrectionTypeNo;
   5.332 +    textField.enablesReturnKeyAutomatically = NO;
   5.333 +    textField.keyboardAppearance = UIKeyboardAppearanceDefault;
   5.334 +    textField.keyboardType = UIKeyboardTypeDefault;
   5.335 +    textField.returnKeyType = UIReturnKeyDefault;
   5.336 +    textField.secureTextEntry = NO;    
   5.337 +    
   5.338 +    textField.hidden = YES;
   5.339 +    keyboardVisible = NO;
   5.340 +    /* add the UITextField (hidden) to our view */
   5.341 +    [self addSubview: textField];
   5.342 +    [textField release];
   5.343  }
   5.344  
   5.345  /* reveal onscreen virtual keyboard */
   5.346  - (void)showKeyboard {
   5.347 -	keyboardVisible = YES;
   5.348 -	[textField becomeFirstResponder];
   5.349 +    keyboardVisible = YES;
   5.350 +    [textField becomeFirstResponder];
   5.351  }
   5.352  
   5.353  /* hide onscreen virtual keyboard */
   5.354  - (void)hideKeyboard {
   5.355 -	keyboardVisible = NO;
   5.356 -	[textField resignFirstResponder];
   5.357 +    keyboardVisible = NO;
   5.358 +    [textField resignFirstResponder];
   5.359  }
   5.360  
   5.361  /* UITextFieldDelegate method.  Invoked when user types something. */
   5.362  - (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
   5.363 -	
   5.364 -	if ([string length] == 0) {
   5.365 -		/* it wants to replace text with nothing, ie a delete */
   5.366 -		SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_DELETE);
   5.367 -		SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_DELETE);
   5.368 -	}
   5.369 -	else {
   5.370 -		/* go through all the characters in the string we've been sent
   5.371 -		   and convert them to key presses */
   5.372 -		int i;
   5.373 -		for (i=0; i<[string length]; i++) {
   5.374 -			
   5.375 -			unichar c = [string characterAtIndex: i];
   5.376 -			
   5.377 -			Uint16 mod = 0;
   5.378 -			SDL_ScanCode code;
   5.379 -			
   5.380 -			if (c < 127) {
   5.381 -				/* figure out the SDL_ScanCode and SDL_keymod for this unichar */
   5.382 -				code = unicharToUIKeyInfoTable[c].code;
   5.383 -				mod  = unicharToUIKeyInfoTable[c].mod;
   5.384 -			}
   5.385 -			else {
   5.386 -				/* we only deal with ASCII right now */
   5.387 -				code = SDL_SCANCODE_UNKNOWN;
   5.388 -				mod = 0;
   5.389 -			}
   5.390 -			
   5.391 -			if (mod & KMOD_SHIFT) {
   5.392 -				/* If character uses shift, press shift down */
   5.393 -				SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT);
   5.394 -			}
   5.395 -			/* send a keydown and keyup even for the character */
   5.396 -			SDL_SendKeyboardKey(SDL_PRESSED, code);
   5.397 -			SDL_SendKeyboardKey(SDL_RELEASED, code);
   5.398 -			if (mod & KMOD_SHIFT) {
   5.399 -				/* If character uses shift, press shift back up */
   5.400 -				SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT);
   5.401 -			}			
   5.402 -		}
   5.403 -	}
   5.404 -	return NO; /* don't allow the edit! (keep placeholder text there) */
   5.405 +    
   5.406 +    if ([string length] == 0) {
   5.407 +        /* it wants to replace text with nothing, ie a delete */
   5.408 +        SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_DELETE);
   5.409 +        SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_DELETE);
   5.410 +    }
   5.411 +    else {
   5.412 +        /* go through all the characters in the string we've been sent
   5.413 +           and convert them to key presses */
   5.414 +        int i;
   5.415 +        for (i=0; i<[string length]; i++) {
   5.416 +            
   5.417 +            unichar c = [string characterAtIndex: i];
   5.418 +            
   5.419 +            Uint16 mod = 0;
   5.420 +            SDL_ScanCode code;
   5.421 +            
   5.422 +            if (c < 127) {
   5.423 +                /* figure out the SDL_ScanCode and SDL_keymod for this unichar */
   5.424 +                code = unicharToUIKeyInfoTable[c].code;
   5.425 +                mod  = unicharToUIKeyInfoTable[c].mod;
   5.426 +            }
   5.427 +            else {
   5.428 +                /* we only deal with ASCII right now */
   5.429 +                code = SDL_SCANCODE_UNKNOWN;
   5.430 +                mod = 0;
   5.431 +            }
   5.432 +            
   5.433 +            if (mod & KMOD_SHIFT) {
   5.434 +                /* If character uses shift, press shift down */
   5.435 +                SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT);
   5.436 +            }
   5.437 +            /* send a keydown and keyup even for the character */
   5.438 +            SDL_SendKeyboardKey(SDL_PRESSED, code);
   5.439 +            SDL_SendKeyboardKey(SDL_RELEASED, code);
   5.440 +            if (mod & KMOD_SHIFT) {
   5.441 +                /* If character uses shift, press shift back up */
   5.442 +                SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT);
   5.443 +            }            
   5.444 +        }
   5.445 +    }
   5.446 +    return NO; /* don't allow the edit! (keep placeholder text there) */
   5.447  }
   5.448  
   5.449  /* Terminates the editing session */
   5.450  - (BOOL)textFieldShouldReturn:(UITextField*)_textField {
   5.451 -	[self hideKeyboard];
   5.452 -	return YES;
   5.453 +    [self hideKeyboard];
   5.454 +    return YES;
   5.455  }
   5.456  
   5.457  #endif
   5.458 @@ -310,99 +310,99 @@
   5.459  #if SDL_IPHONE_KEYBOARD
   5.460  
   5.461  int SDL_iPhoneKeyboardShow(SDL_Window * window) {
   5.462 -	
   5.463 -	SDL_WindowData *data;
   5.464 -	SDL_uikitview *view;
   5.465 -	
   5.466 -	if (NULL == window) {
   5.467 -		SDL_SetError("Window does not exist");
   5.468 -		return -1;
   5.469 -	}
   5.470 -	
   5.471 -	data = (SDL_WindowData *)window->driverdata;
   5.472 -	view = data->view;
   5.473 -	
   5.474 -	if (nil == view) {
   5.475 -		SDL_SetError("Window has no view");
   5.476 -		return -1;
   5.477 -	}
   5.478 -	else {
   5.479 -		[view showKeyboard];
   5.480 -		return 0;
   5.481 -	}
   5.482 +    
   5.483 +    SDL_WindowData *data;
   5.484 +    SDL_uikitview *view;
   5.485 +    
   5.486 +    if (NULL == window) {
   5.487 +        SDL_SetError("Window does not exist");
   5.488 +        return -1;
   5.489 +    }
   5.490 +    
   5.491 +    data = (SDL_WindowData *)window->driverdata;
   5.492 +    view = data->view;
   5.493 +    
   5.494 +    if (nil == view) {
   5.495 +        SDL_SetError("Window has no view");
   5.496 +        return -1;
   5.497 +    }
   5.498 +    else {
   5.499 +        [view showKeyboard];
   5.500 +        return 0;
   5.501 +    }
   5.502  }
   5.503  
   5.504  int SDL_iPhoneKeyboardHide(SDL_Window * window) {
   5.505 -	
   5.506 -	SDL_WindowData *data;
   5.507 -	SDL_uikitview *view;
   5.508 -	
   5.509 -	if (NULL == window) {
   5.510 -		SDL_SetError("Window does not exist");
   5.511 -		return -1;
   5.512 -	}	
   5.513 -	
   5.514 -	data = (SDL_WindowData *)window->driverdata;
   5.515 -	view = data->view;
   5.516 -	
   5.517 -	if (NULL == view) {
   5.518 -		SDL_SetError("Window has no view");
   5.519 -		return -1;
   5.520 -	}
   5.521 -	else {
   5.522 -		[view hideKeyboard];
   5.523 -		return 0;
   5.524 -	}
   5.525 +    
   5.526 +    SDL_WindowData *data;
   5.527 +    SDL_uikitview *view;
   5.528 +    
   5.529 +    if (NULL == window) {
   5.530 +        SDL_SetError("Window does not exist");
   5.531 +        return -1;
   5.532 +    }    
   5.533 +    
   5.534 +    data = (SDL_WindowData *)window->driverdata;
   5.535 +    view = data->view;
   5.536 +    
   5.537 +    if (NULL == view) {
   5.538 +        SDL_SetError("Window has no view");
   5.539 +        return -1;
   5.540 +    }
   5.541 +    else {
   5.542 +        [view hideKeyboard];
   5.543 +        return 0;
   5.544 +    }
   5.545  }
   5.546  
   5.547  SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window) {
   5.548 -	
   5.549 -	SDL_WindowData *data;
   5.550 -	SDL_uikitview *view;
   5.551 -	
   5.552 -	if (NULL == window) {
   5.553 -		SDL_SetError("Window does not exist");
   5.554 -		return -1;
   5.555 -	}	
   5.556 -	
   5.557 -	data = (SDL_WindowData *)window->driverdata;
   5.558 -	view = data->view;
   5.559 -	
   5.560 -	if (NULL == view) {
   5.561 -		SDL_SetError("Window has no view");
   5.562 -		return 0;
   5.563 -	}
   5.564 -	else {
   5.565 -		return view.keyboardVisible;
   5.566 -	}
   5.567 +    
   5.568 +    SDL_WindowData *data;
   5.569 +    SDL_uikitview *view;
   5.570 +    
   5.571 +    if (NULL == window) {
   5.572 +        SDL_SetError("Window does not exist");
   5.573 +        return -1;
   5.574 +    }    
   5.575 +    
   5.576 +    data = (SDL_WindowData *)window->driverdata;
   5.577 +    view = data->view;
   5.578 +    
   5.579 +    if (NULL == view) {
   5.580 +        SDL_SetError("Window has no view");
   5.581 +        return 0;
   5.582 +    }
   5.583 +    else {
   5.584 +        return view.keyboardVisible;
   5.585 +    }
   5.586  }
   5.587  
   5.588  int SDL_iPhoneKeyboardToggle(SDL_Window * window) {
   5.589 -	
   5.590 -	SDL_WindowData *data;
   5.591 -	SDL_uikitview *view;
   5.592 -	
   5.593 -	if (NULL == window) {
   5.594 -		SDL_SetError("Window does not exist");
   5.595 -		return -1;
   5.596 -	}	
   5.597 -	
   5.598 -	data = (SDL_WindowData *)window->driverdata;
   5.599 -	view = data->view;
   5.600 -	
   5.601 -	if (NULL == view) {
   5.602 -		SDL_SetError("Window has no view");
   5.603 -		return -1;
   5.604 -	}
   5.605 -	else {
   5.606 -		if (SDL_iPhoneKeyboardIsShown(window)) {
   5.607 -			SDL_iPhoneKeyboardHide(window);
   5.608 -		}
   5.609 -		else {
   5.610 -			SDL_iPhoneKeyboardShow(window);
   5.611 -		}
   5.612 -		return 0;
   5.613 -	}
   5.614 +    
   5.615 +    SDL_WindowData *data;
   5.616 +    SDL_uikitview *view;
   5.617 +    
   5.618 +    if (NULL == window) {
   5.619 +        SDL_SetError("Window does not exist");
   5.620 +        return -1;
   5.621 +    }    
   5.622 +    
   5.623 +    data = (SDL_WindowData *)window->driverdata;
   5.624 +    view = data->view;
   5.625 +    
   5.626 +    if (NULL == view) {
   5.627 +        SDL_SetError("Window has no view");
   5.628 +        return -1;
   5.629 +    }
   5.630 +    else {
   5.631 +        if (SDL_iPhoneKeyboardIsShown(window)) {
   5.632 +            SDL_iPhoneKeyboardHide(window);
   5.633 +        }
   5.634 +        else {
   5.635 +            SDL_iPhoneKeyboardShow(window);
   5.636 +        }
   5.637 +        return 0;
   5.638 +    }
   5.639  }
   5.640  
   5.641  #else
   5.642 @@ -410,22 +410,22 @@
   5.643  /* stubs, used if compiled without keyboard support */
   5.644  
   5.645  int SDL_iPhoneKeyboardShow(SDL_Window * window) {
   5.646 -	SDL_SetError("Not compiled with keyboard support");
   5.647 -	return -1;
   5.648 +    SDL_SetError("Not compiled with keyboard support");
   5.649 +    return -1;
   5.650  }
   5.651  
   5.652  int SDL_iPhoneKeyboardHide(SDL_Window * window) {
   5.653 -	SDL_SetError("Not compiled with keyboard support");
   5.654 -	return -1;
   5.655 +    SDL_SetError("Not compiled with keyboard support");
   5.656 +    return -1;
   5.657  }
   5.658  
   5.659  SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window) {
   5.660 -	return 0;
   5.661 +    return 0;
   5.662  }
   5.663  
   5.664  int SDL_iPhoneKeyboardToggle(SDL_Window * window) {
   5.665 -	SDL_SetError("Not compiled with keyboard support");
   5.666 -	return -1;
   5.667 +    SDL_SetError("Not compiled with keyboard support");
   5.668 +    return -1;
   5.669  }
   5.670  
   5.671