src/video/uikit/SDL_uikitappdelegate.m
author Sam Lantinga <slouken@libsdl.org>
Thu, 20 Jan 2011 16:05:59 -0800
changeset 5056 8b7988f42fcb
parent 4489 2bb1bfeee9e2
child 5131 7b7da52e8775
permissions -rw-r--r--
Added the ability to get the UIKit window through the SDL API. You can also do this through the native API: UIWindow *window = [[UIApplication sharedApplication] keyWindow]; Also needed to name the union for events and window info.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     1
/*
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     2
 SDL - Simple DirectMedia Layer
2859
99210400e8b9 Updated copyright date
Sam Lantinga <slouken@libsdl.org>
parents: 2765
diff changeset
     3
 Copyright (C) 1997-2009 Sam Lantinga
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     4
 
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     5
 This library is free software; you can redistribute it and/or
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     6
 modify it under the terms of the GNU Lesser General Public
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     7
 License as published by the Free Software Foundation; either
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     8
 version 2.1 of the License, or (at your option) any later version.
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     9
 
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    10
 This library is distributed in the hope that it will be useful,
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    13
 Lesser General Public License for more details.
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    14
 
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    15
 You should have received a copy of the GNU Lesser General Public
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    16
 License along with this library; if not, write to the Free Software
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    17
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    18
 
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    19
 Sam Lantinga
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    20
 slouken@libsdl.org
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    21
*/
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    22
4446
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
    23
#import "../SDL_sysvideo.h"
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
    24
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    25
#import "SDL_uikitappdelegate.h"
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    26
#import "SDL_uikitopenglview.h"
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    27
#import "SDL_events_c.h"
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    28
#import "jumphack.h"
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    29
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    30
#ifdef main
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    31
#undef main
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    32
#endif
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    33
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    34
extern int SDL_main(int argc, char *argv[]);
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    35
static int forward_argc;
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    36
static char **forward_argv;
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    37
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    38
int main(int argc, char **argv) {
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    39
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    40
	int i;
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    41
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    42
	
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    43
	/* store arguments */
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    44
	forward_argc = argc;
4489
2bb1bfeee9e2 The arguments to main() should be NULL terminated (SuS v3 compliant)
Sam Lantinga <slouken@libsdl.org>
parents: 4446
diff changeset
    45
	forward_argv = (char **)malloc((argc+1) * sizeof(char *));
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    46
	for (i=0; i<argc; i++) {
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    47
		forward_argv[i] = malloc( (strlen(argv[i])+1) * sizeof(char));
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    48
		strcpy(forward_argv[i], argv[i]);
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    49
	}
4489
2bb1bfeee9e2 The arguments to main() should be NULL terminated (SuS v3 compliant)
Sam Lantinga <slouken@libsdl.org>
parents: 4446
diff changeset
    50
	forward_argv[i] = NULL;
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    51
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    52
	/* Give over control to run loop, SDLUIKitDelegate will handle most things from here */
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    53
	UIApplicationMain(argc, argv, NULL, @"SDLUIKitDelegate");
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    54
	
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    55
	[pool release];
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    56
	
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    57
}
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    58
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    59
@implementation SDLUIKitDelegate
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    60
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    61
/* convenience method */
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    62
+(SDLUIKitDelegate *)sharedAppDelegate {
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    63
	/* the delegate is set in UIApplicationMain(), which is garaunteed to be called before this method */
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    64
	return (SDLUIKitDelegate *)[[UIApplication sharedApplication] delegate];
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    65
}
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    66
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    67
- (id)init {
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    68
	self = [super init];
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    69
	return self;
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    70
}
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    71
3422
ec4db979dddb Fixed bug #847
Sam Lantinga <slouken@libsdl.org>
parents: 3400
diff changeset
    72
- (void)postFinishLaunch {
ec4db979dddb Fixed bug #847
Sam Lantinga <slouken@libsdl.org>
parents: 3400
diff changeset
    73
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    74
	/* run the user's application, passing argc and argv */
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    75
	int exit_status = SDL_main(forward_argc, forward_argv);
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    76
	
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    77
	/* free the memory we used to hold copies of argc and argv */
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    78
	int i;
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    79
	for (i=0; i<forward_argc; i++) {
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    80
		free(forward_argv[i]);
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    81
	}
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    82
	free(forward_argv);	
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    83
		
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    84
	/* exit, passing the return status from the user's application */
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    85
	exit(exit_status);
3422
ec4db979dddb Fixed bug #847
Sam Lantinga <slouken@libsdl.org>
parents: 3400
diff changeset
    86
}
ec4db979dddb Fixed bug #847
Sam Lantinga <slouken@libsdl.org>
parents: 3400
diff changeset
    87
ec4db979dddb Fixed bug #847
Sam Lantinga <slouken@libsdl.org>
parents: 3400
diff changeset
    88
- (void)applicationDidFinishLaunching:(UIApplication *)application {
ec4db979dddb Fixed bug #847
Sam Lantinga <slouken@libsdl.org>
parents: 3400
diff changeset
    89
			
ec4db979dddb Fixed bug #847
Sam Lantinga <slouken@libsdl.org>
parents: 3400
diff changeset
    90
	/* Set working directory to resource path */
ec4db979dddb Fixed bug #847
Sam Lantinga <slouken@libsdl.org>
parents: 3400
diff changeset
    91
	[[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]];
ec4db979dddb Fixed bug #847
Sam Lantinga <slouken@libsdl.org>
parents: 3400
diff changeset
    92
	
ec4db979dddb Fixed bug #847
Sam Lantinga <slouken@libsdl.org>
parents: 3400
diff changeset
    93
	[self performSelector:@selector(postFinishLaunch) withObject:nil
ec4db979dddb Fixed bug #847
Sam Lantinga <slouken@libsdl.org>
parents: 3400
diff changeset
    94
afterDelay:0.0];
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    95
}
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    96
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    97
- (void)applicationWillTerminate:(UIApplication *)application {
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    98
	
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    99
	SDL_SendQuit();
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   100
	 /* hack to prevent automatic termination.  See SDL_uikitevents.m for details */
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   101
	longjmp(*(jump_env()), 1);
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   102
	
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   103
}
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   104
3400
4ec48602f1db iPhone interruption patch / SDL 1.3
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   105
- (void) applicationWillResignActive:(UIApplication*)application
4ec48602f1db iPhone interruption patch / SDL 1.3
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   106
{
4446
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   107
    //NSLog(@"%@", NSStringFromSelector(_cmd));
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   108
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   109
    // Send every window on every screen a MINIMIZED event.
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   110
    SDL_VideoDevice *_this = SDL_GetVideoDevice();
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   111
    if (!_this) {
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   112
        return;
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   113
    }
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   114
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   115
    int i;
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   116
    for (i = 0; i < _this->num_displays; i++) {
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   117
        const SDL_VideoDisplay *display = &_this->displays[i];
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   118
        SDL_Window *window;
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   119
        for (window = display->windows; window != nil; window = window->next) {
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   120
            SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   121
        }
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   122
    }
3400
4ec48602f1db iPhone interruption patch / SDL 1.3
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   123
}
4ec48602f1db iPhone interruption patch / SDL 1.3
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   124
4ec48602f1db iPhone interruption patch / SDL 1.3
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   125
- (void) applicationDidBecomeActive:(UIApplication*)application
4ec48602f1db iPhone interruption patch / SDL 1.3
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   126
{
4446
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   127
    //NSLog(@"%@", NSStringFromSelector(_cmd));
3400
4ec48602f1db iPhone interruption patch / SDL 1.3
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   128
4446
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   129
    // Send every window on every screen a RESTORED event.
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   130
    SDL_VideoDevice *_this = SDL_GetVideoDevice();
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   131
    if (!_this) {
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   132
        return;
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   133
    }
3400
4ec48602f1db iPhone interruption patch / SDL 1.3
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   134
4446
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   135
    int i;
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   136
    for (i = 0; i < _this->num_displays; i++) {
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   137
        const SDL_VideoDisplay *display = &_this->displays[i];
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   138
        SDL_Window *window;
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   139
        for (window = display->windows; window != nil; window = window->next) {
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   140
            SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   141
        }
8b03a20b320f Much improved multi-display support for iPad.
Ryan C. Gordon <icculus@icculus.org>
parents: 3685
diff changeset
   142
    }
2765
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   143
}
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   144
f55c87ae336b Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   145
@end