2008-10-04 06:46:59 +00:00
|
|
|
/*
|
2011-04-08 13:03:26 -07:00
|
|
|
Simple DirectMedia Layer
|
2011-12-31 09:28:07 -05:00
|
|
|
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
|
2008-10-04 06:46:59 +00:00
|
|
|
|
2011-04-08 13:03:26 -07:00
|
|
|
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.
|
2008-10-04 06:46:59 +00:00
|
|
|
|
2011-04-08 13:03:26 -07:00
|
|
|
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:
|
2008-10-04 06:46:59 +00:00
|
|
|
|
2011-04-08 13:03:26 -07:00
|
|
|
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
|
|
|
|
appreciated but is not required.
|
|
|
|
2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
misrepresented as being the original software.
|
|
|
|
3. This notice may not be removed or altered from any source distribution.
|
2008-10-04 06:46:59 +00:00
|
|
|
*/
|
|
|
|
#include "SDL_config.h"
|
|
|
|
|
2011-10-31 05:56:58 -04:00
|
|
|
#if SDL_VIDEO_DRIVER_UIKIT
|
|
|
|
|
2008-10-04 06:46:59 +00:00
|
|
|
#include "../../events/SDL_events_c.h"
|
|
|
|
|
|
|
|
#include "SDL_uikitvideo.h"
|
|
|
|
#include "SDL_uikitevents.h"
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#include "jumphack.h"
|
|
|
|
|
|
|
|
void
|
|
|
|
UIKit_PumpEvents(_THIS)
|
|
|
|
{
|
2011-09-27 21:02:26 +02:00
|
|
|
/*
|
2011-02-01 08:59:22 -08:00
|
|
|
When the user presses the 'home' button on the iPod
|
|
|
|
the application exits -- immediatly.
|
2011-09-27 21:02:26 +02:00
|
|
|
|
2011-02-01 08:59:22 -08:00
|
|
|
Unlike in Mac OS X, it appears there is no way to cancel the termination.
|
2011-09-27 21:02:26 +02:00
|
|
|
|
2011-02-01 08:59:22 -08:00
|
|
|
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.
|
2011-09-27 21:02:26 +02:00
|
|
|
*/
|
2011-02-01 08:59:22 -08:00
|
|
|
if (setjmp(*jump_env()) == 0) {
|
|
|
|
/* if we're setting the jump, rather than jumping back */
|
|
|
|
SInt32 result;
|
|
|
|
do {
|
|
|
|
result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, TRUE);
|
2011-09-27 22:51:26 +02:00
|
|
|
} while (result == kCFRunLoopRunHandledSource);
|
2011-02-01 08:59:22 -08:00
|
|
|
}
|
2008-10-04 06:46:59 +00:00
|
|
|
}
|
|
|
|
|
2011-10-31 05:56:58 -04:00
|
|
|
#endif /* SDL_VIDEO_DRIVER_UIKIT */
|
|
|
|
|
2008-10-04 06:46:59 +00:00
|
|
|
/* vi: set ts=4 sw=4 expandtab: */
|