Mercurial > sdl-ios-xcode
annotate src/video/uikit/SDL_uikitevents.m @ 2399:d904584ea86d gsoc2008_iphone
Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
author | Holmes Futrell <hfutrell@umail.ucsb.edu> |
---|---|
date | Tue, 22 Jul 2008 22:59:59 +0000 |
parents | eec14ed2bb18 |
children | 491958a6c881 |
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 /* Being a null driver, there's no event stream. We just define stubs for |
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 most of the API. */ |
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 |
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 #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
|
28 #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
|
29 #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
|
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 #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
|
32 #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
|
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 #import <Foundation/Foundation.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
|
35 #include "jump.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
|
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 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
|
38 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
|
39 { |
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 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
|
42 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
|
43 |
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 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
|
45 |
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 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
|
47 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
|
48 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
|
49 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
|
50 |
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 */ |
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 if (setjmp(*jump_env()) != 0) { |
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 NSLog(@"Bam! We're back"); |
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 else { |
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 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
|
57 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
|
58 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
|
59 } 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
|
60 |
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
|
61 } |
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
|
62 |
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
|
63 } |
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
|
64 |
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
|
65 /* vi: set ts=4 sw=4 expandtab: */ |