annotate src/video/uikit/SDL_uikitevents.m @ 2449:4a07dc228e93 gsoc2008_iphone

comments and trivials
author Holmes Futrell <hfutrell@umail.ucsb.edu>
date Sat, 16 Aug 2008 00:14:35 +0000
parents 491958a6c881
children
rev   line source
2355
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
1 /*
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
4
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
9
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
13 Lesser General Public License for more details.
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
14
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
18
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
19 Sam Lantinga
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
20 slouken@libsdl.org
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
21 */
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
22 #include "SDL_config.h"
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
23
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
24 #include "SDL.h"
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
25 #include "../../events/SDL_sysevents.h"
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
26 #include "../../events/SDL_events_c.h"
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
27
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
28 #include "SDL_uikitvideo.h"
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
29 #include "SDL_uikitevents.h"
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
30
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
31 #import <Foundation/Foundation.h>
2449
4a07dc228e93 comments and trivials
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2425
diff changeset
32 #include "jumphack.h"
2355
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
33
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
34 void
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
35 UIKit_PumpEvents(_THIS)
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
36 {
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
37 /*
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
38 When the user presses the 'home' button on the iPod
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
39 the application exits -- immediatly.
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
40
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
41 Unlike in Mac OS X, it appears there is no way to cancel the termination.
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
42
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
43 This doesn't give the SDL user's application time to respond to an SDL_Quit event.
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
44 So what we do is that in the UIApplicationDelegate class (SDLUIApplicationDelegate),
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
45 when the delegate receives the ApplicationWillTerminate message, we execute
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
46 a longjmp statement to get back here, preventing an immediate exit.
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
47 */
2449
4a07dc228e93 comments and trivials
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2425
diff changeset
48 if (setjmp(*jump_env()) == 0) {
4a07dc228e93 comments and trivials
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2425
diff changeset
49 /* if we're setting the jump, rather than jumping back */
2355
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
50 SInt32 result;
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
51 do {
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
52 result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, TRUE);
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
53 } while(result == kCFRunLoopRunHandledSource);
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
54 }
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
55
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
56 }
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
57
eec14ed2bb18 These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
58 /* vi: set ts=4 sw=4 expandtab: */