diff src/video/uikit/SDL_uikitwindow.m @ 3400:4ec48602f1db

iPhone interruption patch / SDL 1.3 Eric Wing to Sam I've been sitting on this too long. I need to push. It's untested because of the unrelated crashing bug I've been experiencing. Also have a fix for SIZEOF_VOIDP in the config for both iPhone and Mac.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 17 Oct 2009 07:36:45 +0000
parents 99210400e8b9
children 64ce267332c6
line wrap: on
line diff
--- a/src/video/uikit/SDL_uikitwindow.m	Tue Oct 13 20:17:11 2009 +0000
+++ b/src/video/uikit/SDL_uikitwindow.m	Sat Oct 17 07:36:45 2009 +0000
@@ -82,7 +82,7 @@
 
 int UIKit_CreateWindow(_THIS, SDL_Window *window) {
 		
-	/* iPhone applications are single window only */
+	/* We currently only handle single window applications on iPhone */
 	if (nil != [SDLUIKitDelegate sharedAppDelegate].window) {
 		SDL_SetError("Window already exists, no multi-window support.");
 		return -1;
@@ -96,7 +96,10 @@
         return -1;
     }	
 	
+	// This saves the main window in the app delegate so event callbacks can do stuff on the window.
+	// This assumes a single window application design and needs to be fixed for multiple windows.
 	[SDLUIKitDelegate sharedAppDelegate].window = uiwindow;
+	[SDLUIKitDelegate sharedAppDelegate].windowID = window->id;
 	[uiwindow release]; /* release the window (the app delegate has retained it) */
 	
 	return 1;
@@ -113,6 +116,7 @@
 
 	/* this will also destroy the window */
 	[SDLUIKitDelegate sharedAppDelegate].window = nil;
+	[SDLUIKitDelegate sharedAppDelegate].windowID = 0;
 
 }