From 7edbd3414ee2a0edec6cd2b2600ae38c5680647e Mon Sep 17 00:00:00 2001 From: Kees Bakker Date: Tue, 27 Sep 2011 21:02:26 +0200 Subject: [PATCH] Cleanup out trailing whitespace in src/video/uikit --- src/video/uikit/SDL_uikitappdelegate.m | 24 +++---- src/video/uikit/SDL_uikitevents.m | 8 +-- src/video/uikit/SDL_uikitopengles.m | 16 ++--- src/video/uikit/SDL_uikitopenglview.h | 8 +-- src/video/uikit/SDL_uikitopenglview.m | 28 ++++---- src/video/uikit/SDL_uikitvideo.m | 6 +- src/video/uikit/SDL_uikitview.h | 4 +- src/video/uikit/SDL_uikitview.m | 86 +++++++++++------------ src/video/uikit/SDL_uikitviewcontroller.h | 6 +- src/video/uikit/SDL_uikitviewcontroller.m | 40 +++++------ src/video/uikit/SDL_uikitwindow.m | 12 ++-- src/video/uikit/keyinfotable.h | 4 +- 12 files changed, 121 insertions(+), 121 deletions(-) diff --git a/src/video/uikit/SDL_uikitappdelegate.m b/src/video/uikit/SDL_uikitappdelegate.m index 381f9b08c..4f1af3995 100644 --- a/src/video/uikit/SDL_uikitappdelegate.m +++ b/src/video/uikit/SDL_uikitappdelegate.m @@ -41,7 +41,7 @@ int main(int argc, char **argv) { int i; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - + /* store arguments */ forward_argc = argc; forward_argv = (char **)malloc((argc+1) * sizeof(char *)); @@ -53,14 +53,14 @@ int main(int argc, char **argv) { /* Give over control to run loop, SDLUIKitDelegate will handle most things from here */ UIApplicationMain(argc, argv, NULL, [SDLUIKitDelegate getAppDelegateClassName]); - + [pool release]; return 0; } static void SDL_IdleTimerDisabledChanged(const char *name, const char *oldValue, const char *newValue) { SDL_assert(SDL_strcmp(name, SDL_HINT_IDLE_TIMER_DISABLED) == 0); - + BOOL disable = (*newValue != '0'); [UIApplication sharedApplication].idleTimerDisabled = disable; } @@ -85,37 +85,37 @@ - (id)init { } - (void)postFinishLaunch { - + /* register a callback for the idletimer hint */ SDL_SetHint(SDL_HINT_IDLE_TIMER_DISABLED, "0"); SDL_RegisterHintChangedCb(SDL_HINT_IDLE_TIMER_DISABLED, &SDL_IdleTimerDisabledChanged); /* run the user's application, passing argc and argv */ int exit_status = SDL_main(forward_argc, forward_argv); - + /* free the memory we used to hold copies of argc and argv */ int i; for (i=0; iwindows; window != nil; window = window->next) { SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); @@ -146,7 +146,7 @@ - (void) applicationDidBecomeActive:(UIApplication*)application if (!_this) { return; } - + SDL_Window *window; for (window = _this->windows; window != nil; window = window->next) { SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); diff --git a/src/video/uikit/SDL_uikitevents.m b/src/video/uikit/SDL_uikitevents.m index 3ccac79f2..fd0317bec 100644 --- a/src/video/uikit/SDL_uikitevents.m +++ b/src/video/uikit/SDL_uikitevents.m @@ -31,17 +31,17 @@ void UIKit_PumpEvents(_THIS) { - /* + /* When the user presses the 'home' button on the iPod the application exits -- immediatly. - + Unlike in Mac OS X, it appears there is no way to cancel the termination. - + This doesn't give the SDL user's application time to respond to an SDL_Quit event. So what we do is that in the UIApplicationDelegate class (SDLUIApplicationDelegate), when the delegate receives the ApplicationWillTerminate message, we execute a longjmp statement to get back here, preventing an immediate exit. - */ + */ if (setjmp(*jump_env()) == 0) { /* if we're setting the jump, rather than jumping back */ SInt32 result; diff --git a/src/video/uikit/SDL_uikitopengles.m b/src/video/uikit/SDL_uikitopengles.m index bd8bf9526..ebf826d00 100644 --- a/src/video/uikit/SDL_uikitopengles.m +++ b/src/video/uikit/SDL_uikitopengles.m @@ -34,7 +34,7 @@ void * UIKit_GL_GetProcAddress(_THIS, const char *proc) -{ +{ /* Look through all SO's for the proc symbol. Here's why: -Looking for the path to the OpenGL Library seems not to work in the iPhone Simulator. -We don't know that the path won't change in the future. @@ -47,7 +47,7 @@ */ int UIKit_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { - + if (context) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; [data->view setCurrentContext]; @@ -55,15 +55,15 @@ int UIKit_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) else { [EAGLContext setCurrentContext: nil]; } - + return 0; } int UIKit_GL_LoadLibrary(_THIS, const char *path) { - /* - shouldn't be passing a path into this function + /* + shouldn't be passing a path into this function why? Because we've already loaded the library and because the SDK forbids loading an external SO */ @@ -84,7 +84,7 @@ void UIKit_GL_SwapWindow(_THIS, SDL_Window * window) #endif SDL_WindowData *data = (SDL_WindowData *)window->driverdata; - + if (nil == data->view) { return; } @@ -95,7 +95,7 @@ void UIKit_GL_SwapWindow(_THIS, SDL_Window * window) /* we need to let the event cycle run, or the OS won't update the OpenGL view! */ SDL_PumpEvents(); - + } SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window) @@ -114,7 +114,7 @@ SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window) aBits: _this->gl_config.alpha_size \ depthBits: _this->gl_config.depth_size \ majorVersion: _this->gl_config.major_version]; - + data->view = view; view->viewcontroller = data->viewcontroller; if (view->viewcontroller != nil) { diff --git a/src/video/uikit/SDL_uikitopenglview.h b/src/video/uikit/SDL_uikitopenglview.h index d5c165e77..41c0d3fc6 100644 --- a/src/video/uikit/SDL_uikitopenglview.h +++ b/src/video/uikit/SDL_uikitopenglview.h @@ -31,17 +31,17 @@ */ /* *INDENT-OFF* */ @interface SDL_uikitopenglview : SDL_uikitview { - + @private /* The pixel dimensions of the backbuffer */ GLint backingWidth; GLint backingHeight; - + EAGLContext *context; - + /* OpenGL names for the renderbuffer and framebuffers used to render to this view */ GLuint viewRenderbuffer, viewFramebuffer; - + /* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */ GLuint depthRenderbuffer; diff --git a/src/video/uikit/SDL_uikitopenglview.m b/src/video/uikit/SDL_uikitopenglview.m index e47a8d9fb..75b54c1a8 100644 --- a/src/video/uikit/SDL_uikitopenglview.m +++ b/src/video/uikit/SDL_uikitopenglview.m @@ -50,7 +50,7 @@ - (id)initWithFrame:(CGRect)frame \ { NSString *colorFormat=nil; BOOL useDepthBuffer; - + if (rBits == 8 && gBits == 8 && bBits == 8) { /* if user specifically requests rbg888 or some color format higher than 16bpp */ colorFormat = kEAGLColorFormatRGBA8; @@ -59,7 +59,7 @@ - (id)initWithFrame:(CGRect)frame \ /* default case (faster) */ colorFormat = kEAGLColorFormatRGB565; } - + depthBufferFormat = 0; if (depthBits == 24) { @@ -71,22 +71,22 @@ - (id)initWithFrame:(CGRect)frame \ } else { /* default case when depth buffer is not disabled */ - /* + /* strange, even when we use this, we seem to get a 24 bit depth buffer on iPhone. perhaps that's the only depth format iPhone actually supports */ useDepthBuffer = YES; depthBufferFormat = GL_DEPTH_COMPONENT16_OES; } - + if ((self = [super initWithFrame:frame])) { // Get the layer CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer; - + eaglLayer.opaque = YES; eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool: retained], kEAGLDrawablePropertyRetainedBacking, colorFormat, kEAGLDrawablePropertyColorFormat, nil]; - + if (majorVersion > 1) { context = [[EAGLContext alloc] initWithAPI: kEAGLRenderingAPIOpenGLES2]; } else { @@ -96,16 +96,16 @@ - (id)initWithFrame:(CGRect)frame \ [self release]; return nil; } - + /* create the buffers */ glGenFramebuffersOES(1, &viewFramebuffer); glGenRenderbuffersOES(1, &viewRenderbuffer); - + glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer); glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer); [context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(CAEAGLLayer*)self.layer]; glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, viewRenderbuffer); - + glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth); glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight); @@ -115,7 +115,7 @@ - (id)initWithFrame:(CGRect)frame \ glRenderbufferStorageOES(GL_RENDERBUFFER_OES, depthBufferFormat, backingWidth, backingHeight); glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, depthRenderbuffer); } - + if(glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) { return NO; } @@ -140,7 +140,7 @@ - (void)updateFrame { glGenRenderbuffersOES(1, &viewRenderbuffer); glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer); [context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(CAEAGLLayer*)self.layer]; - glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, viewRenderbuffer); + glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, viewRenderbuffer); glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth); glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight); @@ -149,7 +149,7 @@ - (void)updateFrame { glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer); glRenderbufferStorageOES(GL_RENDERBUFFER_OES, depthBufferFormat, backingWidth, backingHeight); } - + // !!! FIXME: use the screen this is on! /* Use the main screen scale (for retina display support) */ if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) @@ -176,7 +176,7 @@ - (void)destroyFramebuffer { viewFramebuffer = 0; glDeleteRenderbuffersOES(1, &viewRenderbuffer); viewRenderbuffer = 0; - + if (depthRenderbuffer) { glDeleteRenderbuffersOES(1, &depthRenderbuffer); depthRenderbuffer = 0; @@ -189,7 +189,7 @@ - (void)dealloc { if ([EAGLContext currentContext] == context) { [EAGLContext setCurrentContext:nil]; } - [context release]; + [context release]; [super dealloc]; } diff --git a/src/video/uikit/SDL_uikitvideo.m b/src/video/uikit/SDL_uikitvideo.m index 4b9f24071..634aa47d5 100644 --- a/src/video/uikit/SDL_uikitvideo.m +++ b/src/video/uikit/SDL_uikitvideo.m @@ -84,8 +84,8 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device) device->CreateWindow = UIKit_CreateWindow; device->DestroyWindow = UIKit_DestroyWindow; device->GetWindowWMInfo = UIKit_GetWindowWMInfo; - - + + /* OpenGL (ES) functions */ device->GL_MakeCurrent = UIKit_GL_MakeCurrent; device->GL_SwapWindow = UIKit_GL_SwapWindow; @@ -211,7 +211,7 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device) mode.w = w; mode.h = h; mode.refresh_rate = 0; - + [uimode retain]; mode.driverdata = uimode; diff --git a/src/video/uikit/SDL_uikitview.h b/src/video/uikit/SDL_uikitview.h index 0d1af7c3c..895fb6c42 100644 --- a/src/video/uikit/SDL_uikitview.h +++ b/src/video/uikit/SDL_uikitview.h @@ -48,7 +48,7 @@ #if SDL_IPHONE_KEYBOARD UITextField *textField; BOOL keyboardVisible; -#endif +#endif @public SDL_uikitviewcontroller *viewcontroller; @@ -62,7 +62,7 @@ - (void)hideKeyboard; - (void)initializeKeyboard; @property (readonly) BOOL keyboardVisible; -#endif +#endif @end /* *INDENT-ON* */ diff --git a/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m index 2e2995285..8b427b2ae 100644 --- a/src/video/uikit/SDL_uikitview.m +++ b/src/video/uikit/SDL_uikitview.m @@ -40,10 +40,10 @@ - (void)dealloc { - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame: frame]; - + #if SDL_IPHONE_KEYBOARD [self initializeKeyboard]; -#endif +#endif #ifdef FIXED_MULTITOUCH self.multipleTouchEnabled = YES; @@ -53,7 +53,7 @@ - (id)initWithFrame:(CGRect)frame { //touch.driverdata = SDL_malloc(sizeof(EventTouchData)); //EventTouchData* data = (EventTouchData*)(touch.driverdata); - + touch.x_min = 0; touch.x_max = frame.size.width; touch.native_xres = touch.x_max - touch.x_min; @@ -79,7 +79,7 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { if (touch) { CGPoint locationInView = [touch locationInView: self]; - + /* send moved event */ SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y); @@ -112,16 +112,16 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { } #endif - touch = (UITouch*)[enumerator nextObject]; + touch = (UITouch*)[enumerator nextObject]; } #endif } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { - + NSEnumerator *enumerator = [touches objectEnumerator]; UITouch *touch = (UITouch*)[enumerator nextObject]; - + if (touch) { /* send mouse up */ SDL_SendMouseButton(NULL, SDL_RELEASED, SDL_BUTTON_LEFT); @@ -130,7 +130,7 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { #ifdef FIXED_MULTITOUCH while(touch) { CGPoint locationInView = [touch locationInView: self]; - + #ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS SDL_SendFingerDown(touchId,(long)touch, @@ -149,7 +149,7 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { } #endif - touch = (UITouch*)[enumerator nextObject]; + touch = (UITouch*)[enumerator nextObject]; } #endif } @@ -164,10 +164,10 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { - + NSEnumerator *enumerator = [touches objectEnumerator]; UITouch *touch = (UITouch*)[enumerator nextObject]; - + if (touch) { CGPoint locationInView = [touch locationInView: self]; @@ -178,7 +178,7 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { #ifdef FIXED_MULTITOUCH while(touch) { CGPoint locationInView = [touch locationInView: self]; - + #ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS SDL_SendTouchMotion(touchId,(long)touch, @@ -196,7 +196,7 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { } #endif - touch = (UITouch*)[enumerator nextObject]; + touch = (UITouch*)[enumerator nextObject]; } #endif } @@ -213,12 +213,12 @@ - (BOOL)keyboardVisible { /* Set ourselves up as a UITextFieldDelegate */ - (void)initializeKeyboard { - + textField = [[UITextField alloc] initWithFrame: CGRectZero]; textField.delegate = self; /* placeholder so there is something to delete! */ - textField.text = @" "; - + textField.text = @" "; + /* set UITextInputTrait properties, mostly to defaults */ textField.autocapitalizationType = UITextAutocapitalizationTypeNone; textField.autocorrectionType = UITextAutocorrectionTypeNo; @@ -226,8 +226,8 @@ - (void)initializeKeyboard { textField.keyboardAppearance = UIKeyboardAppearanceDefault; textField.keyboardType = UIKeyboardTypeDefault; textField.returnKeyType = UIReturnKeyDefault; - textField.secureTextEntry = NO; - + textField.secureTextEntry = NO; + textField.hidden = YES; keyboardVisible = NO; /* add the UITextField (hidden) to our view */ @@ -249,7 +249,7 @@ - (void)hideKeyboard { /* UITextFieldDelegate method. Invoked when user types something. */ - (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { - + if ([string length] == 0) { /* it wants to replace text with nothing, ie a delete */ SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_DELETE); @@ -260,12 +260,12 @@ - (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRan and convert them to key presses */ int i; for (i=0; i<[string length]; i++) { - + unichar c = [string characterAtIndex: i]; - + Uint16 mod = 0; SDL_Scancode code; - + if (c < 127) { /* figure out the SDL_Scancode and SDL_keymod for this unichar */ code = unicharToUIKeyInfoTable[c].code; @@ -276,7 +276,7 @@ - (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRan code = SDL_SCANCODE_UNKNOWN; mod = 0; } - + if (mod & KMOD_SHIFT) { /* If character uses shift, press shift down */ SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT); @@ -287,7 +287,7 @@ - (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRan if (mod & KMOD_SHIFT) { /* If character uses shift, press shift back up */ SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT); - } + } } SDL_SendKeyboardText([string UTF8String]); } @@ -309,18 +309,18 @@ - (BOOL)textFieldShouldReturn:(UITextField*)_textField { #if SDL_IPHONE_KEYBOARD int SDL_iPhoneKeyboardShow(SDL_Window * window) { - + SDL_WindowData *data; SDL_uikitview *view; - + if (NULL == window) { SDL_SetError("Window does not exist"); return -1; } - + data = (SDL_WindowData *)window->driverdata; view = data->view; - + if (nil == view) { SDL_SetError("Window has no view"); return -1; @@ -332,18 +332,18 @@ int SDL_iPhoneKeyboardShow(SDL_Window * window) { } int SDL_iPhoneKeyboardHide(SDL_Window * window) { - + SDL_WindowData *data; SDL_uikitview *view; - + if (NULL == window) { SDL_SetError("Window does not exist"); return -1; - } - + } + data = (SDL_WindowData *)window->driverdata; view = data->view; - + if (NULL == view) { SDL_SetError("Window has no view"); return -1; @@ -355,18 +355,18 @@ int SDL_iPhoneKeyboardHide(SDL_Window * window) { } SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window) { - + SDL_WindowData *data; SDL_uikitview *view; - + if (NULL == window) { SDL_SetError("Window does not exist"); return -1; - } - + } + data = (SDL_WindowData *)window->driverdata; view = data->view; - + if (NULL == view) { SDL_SetError("Window has no view"); return 0; @@ -377,18 +377,18 @@ SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window) { } int SDL_iPhoneKeyboardToggle(SDL_Window * window) { - + SDL_WindowData *data; SDL_uikitview *view; - + if (NULL == window) { SDL_SetError("Window does not exist"); return -1; - } - + } + data = (SDL_WindowData *)window->driverdata; view = data->view; - + if (NULL == view) { SDL_SetError("Window has no view"); return -1; diff --git a/src/video/uikit/SDL_uikitviewcontroller.h b/src/video/uikit/SDL_uikitviewcontroller.h index 6b2ae859d..0cf5ecd2e 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.h +++ b/src/video/uikit/SDL_uikitviewcontroller.h @@ -1,15 +1,15 @@ /* Simple DirectMedia Layer Copyright (C) 1997-2011 Sam Lantinga - + This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. - + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m index 2eeed5313..ded8387de 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.m +++ b/src/video/uikit/SDL_uikitviewcontroller.m @@ -1,15 +1,15 @@ /* Simple DirectMedia Layer Copyright (C) 1997-2011 Sam Lantinga - + This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. - + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be @@ -49,34 +49,34 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orient { encoding:NSUTF8StringEncoding]; NSArray *orientations = [orientationsNSString componentsSeparatedByCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@" "]]; - + switch (orient) { case UIInterfaceOrientationLandscapeLeft: rotate = [orientations containsObject:@"LandscapeLeft"]; break; - + case UIInterfaceOrientationLandscapeRight: rotate = [orientations containsObject:@"LandscapeRight"]; break; - + case UIInterfaceOrientationPortrait: rotate = [orientations containsObject:@"Portrait"]; break; - + case UIInterfaceOrientationPortraitUpsideDown: rotate = [orientations containsObject:@"PortraitUpsideDown"]; break; - + default: break; } - + return rotate; } - + if (self->window->flags & SDL_WINDOW_RESIZABLE) { return YES; // any orientation is okay. } - + // If not resizable, allow device to orient to other matching sizes // (that is, let the user turn the device upside down...same screen // dimensions, but it lets the user place the device where it's most @@ -85,14 +85,14 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orient { case UIInterfaceOrientationLandscapeLeft: case UIInterfaceOrientationLandscapeRight: return (self->window->w >= self->window->h); - + case UIInterfaceOrientationPortrait: case UIInterfaceOrientationPortraitUpsideDown: return (self->window->h >= self->window->w); - + default: break; } - + return NO; // Nothing else is acceptable. } @@ -105,7 +105,7 @@ - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceO if ((self->window->flags & SDL_WINDOW_RESIZABLE) == 0) { return; // don't care, we're just flipping over in this case. } - + const UIInterfaceOrientation toInterfaceOrientation = [self interfaceOrientation]; SDL_WindowData *data = self->window->driverdata; UIWindow *uiwindow = data->uiwindow; @@ -114,30 +114,30 @@ - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceO CGRect frame = noborder ? [uiscreen bounds] : [uiscreen applicationFrame]; const CGSize size = frame.size; int w, h; - + switch (toInterfaceOrientation) { case UIInterfaceOrientationPortrait: case UIInterfaceOrientationPortraitUpsideDown: w = (size.width < size.height) ? size.width : size.height; h = (size.width > size.height) ? size.width : size.height; break; - + case UIInterfaceOrientationLandscapeLeft: case UIInterfaceOrientationLandscapeRight: w = (size.width > size.height) ? size.width : size.height; h = (size.width < size.height) ? size.width : size.height; break; - + default: SDL_assert(0 && "Unexpected interface orientation!"); return; } - + frame.size.width = w; frame.size.height = h; frame.origin.x = 0; frame.origin.y = 0; - + [uiwindow setFrame:frame]; [data->view updateFrame]; SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, w, h); diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m index 1745f0033..a47f0b690 100644 --- a/src/video/uikit/SDL_uikitwindow.m +++ b/src/video/uikit/SDL_uikitwindow.m @@ -46,7 +46,7 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); UIScreen *uiscreen = (UIScreen *) display->driverdata; SDL_WindowData *data; - + /* Allocate the window data */ data = (SDL_WindowData *)SDL_malloc(sizeof(*data)); if (!data) { @@ -64,7 +64,7 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo window->w = (int)uiwindow.frame.size.width; window->h = (int)uiwindow.frame.size.height; } - + window->driverdata = data; // !!! FIXME: should we force this? Shouldn't specifying FULLSCREEN @@ -164,7 +164,7 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo uiwindow = [uiwindow initWithFrame:[uiscreen bounds]]; else uiwindow = [uiwindow initWithFrame:[uiscreen applicationFrame]]; - + // put the window on an external display if appropriate. This implicitly // does [uiwindow setframe:[uiscreen bounds]], so don't do it on the // main display, where we land by default, as that would eat the @@ -176,10 +176,10 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo if (SetupWindowData(_this, window, uiwindow, SDL_TRUE) < 0) { [uiwindow release]; return -1; - } - + } + return 1; - + } void diff --git a/src/video/uikit/keyinfotable.h b/src/video/uikit/keyinfotable.h index 7c4b3ec2e..d9d47f8c5 100644 --- a/src/video/uikit/keyinfotable.h +++ b/src/video/uikit/keyinfotable.h @@ -88,7 +88,7 @@ static UIKitKeyInfo unicharToUIKeyInfoTable[] = { /* 45 */ { SDL_SCANCODE_MINUS, 0 }, /* '-' */ /* 46 */ { SDL_SCANCODE_PERIOD, 0 }, /* '.' */ /* 47 */ { SDL_SCANCODE_SLASH, 0 }, /* '/' */ -/* 48 */ { SDL_SCANCODE_0, 0 }, +/* 48 */ { SDL_SCANCODE_0, 0 }, /* 49 */ { SDL_SCANCODE_1, 0 }, /* 50 */ { SDL_SCANCODE_2, 0 }, /* 51 */ { SDL_SCANCODE_3, 0 }, @@ -137,7 +137,7 @@ static UIKitKeyInfo unicharToUIKeyInfoTable[] = { /* 94 */ { SDL_SCANCODE_6, KMOD_SHIFT }, /* plus shift modifier '^' */ /* 95 */ { SDL_SCANCODE_MINUS, KMOD_SHIFT }, /* plus shift modifier '_' */ /* 96 */ { SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* '`' */ -/* 97 */ { SDL_SCANCODE_A, 0 }, +/* 97 */ { SDL_SCANCODE_A, 0 }, /* 98 */ { SDL_SCANCODE_B, 0 }, /* 99 */ { SDL_SCANCODE_C, 0 }, /* 100 */{ SDL_SCANCODE_D, 0 },