src/video/uikit/SDL_uikitwindow.m
changeset 3400 4ec48602f1db
parent 2859 99210400e8b9
child 3685 64ce267332c6
equal deleted inserted replaced
3399:f96615051c8c 3400:4ec48602f1db
    80 	
    80 	
    81 }
    81 }
    82 
    82 
    83 int UIKit_CreateWindow(_THIS, SDL_Window *window) {
    83 int UIKit_CreateWindow(_THIS, SDL_Window *window) {
    84 		
    84 		
    85 	/* iPhone applications are single window only */
    85 	/* We currently only handle single window applications on iPhone */
    86 	if (nil != [SDLUIKitDelegate sharedAppDelegate].window) {
    86 	if (nil != [SDLUIKitDelegate sharedAppDelegate].window) {
    87 		SDL_SetError("Window already exists, no multi-window support.");
    87 		SDL_SetError("Window already exists, no multi-window support.");
    88 		return -1;
    88 		return -1;
    89 	}
    89 	}
    90 	
    90 	
    94 	if (SetupWindowData(_this, window, uiwindow, SDL_TRUE) < 0) {
    94 	if (SetupWindowData(_this, window, uiwindow, SDL_TRUE) < 0) {
    95         [uiwindow release];
    95         [uiwindow release];
    96         return -1;
    96         return -1;
    97     }	
    97     }	
    98 	
    98 	
       
    99 	// This saves the main window in the app delegate so event callbacks can do stuff on the window.
       
   100 	// This assumes a single window application design and needs to be fixed for multiple windows.
    99 	[SDLUIKitDelegate sharedAppDelegate].window = uiwindow;
   101 	[SDLUIKitDelegate sharedAppDelegate].window = uiwindow;
       
   102 	[SDLUIKitDelegate sharedAppDelegate].windowID = window->id;
   100 	[uiwindow release]; /* release the window (the app delegate has retained it) */
   103 	[uiwindow release]; /* release the window (the app delegate has retained it) */
   101 	
   104 	
   102 	return 1;
   105 	return 1;
   103 	
   106 	
   104 }
   107 }
   111 		SDL_free( window->driverdata );
   114 		SDL_free( window->driverdata );
   112 	}
   115 	}
   113 
   116 
   114 	/* this will also destroy the window */
   117 	/* this will also destroy the window */
   115 	[SDLUIKitDelegate sharedAppDelegate].window = nil;
   118 	[SDLUIKitDelegate sharedAppDelegate].window = nil;
       
   119 	[SDLUIKitDelegate sharedAppDelegate].windowID = 0;
   116 
   120 
   117 }
   121 }
   118 
   122 
   119 /* vi: set ts=4 sw=4 expandtab: */
   123 /* vi: set ts=4 sw=4 expandtab: */