Mercurial > sdl-ios-xcode
annotate src/video/quartz/SDL_QuartzWindow.m @ 643:564716cfb502
Removed direct dependency on OpenGL (call current_video->glGetString() instead
of glGetString() directly)...otherwise we'd have to explicitly link to a
libGL. --ryan.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Tue, 01 Jul 2003 16:35:54 +0000 |
parents | 52864d66d168 |
children | 5d2f027b3349 |
rev | line source |
---|---|
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
1 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
2 /* |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
3 This function makes the *SDL region* of the window 100% opaque. |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
4 The genie effect uses the alpha component. Otherwise, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
5 it doesn't seem to matter what value it has. |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
6 */ |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
7 static void QZ_SetPortAlphaOpaque () { |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
8 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
9 SDL_Surface *surface = current_video->screen; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
10 int bpp; |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
11 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
12 bpp = surface->format->BitsPerPixel; |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
13 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
14 if (bpp == 32) { |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
15 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
16 Uint32 *pixels = (Uint32*) surface->pixels; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
17 Uint32 rowPixels = surface->pitch / 4; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
18 Uint32 i, j; |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
19 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
20 for (i = 0; i < surface->h; i++) |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
21 for (j = 0; j < surface->w; j++) { |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
22 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
23 pixels[ (i * rowPixels) + j ] |= 0xFF000000; |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
24 } |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
25 } |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
26 } |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
27 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
28 /* Subclass of NSWindow to fix genie effect and support resize events */ |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
29 @interface SDL_QuartzWindow : NSWindow |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
30 {} |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
31 - (void)miniaturize:(id)sender; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
32 - (void)display; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
33 - (void)setFrame:(NSRect)frameRect display:(BOOL)flag; |
631
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
34 - (void)appDidHide:(NSNotification*)note; |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
35 - (void)appDidUnhide:(NSNotification*)note; |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
36 - (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag; |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
37 @end |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
38 |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
39 @implementation SDL_QuartzWindow |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
40 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
41 /* we override these methods to fix the miniaturize animation/dock icon bug */ |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
42 - (void)miniaturize:(id)sender |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
43 { |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
44 if (SDL_VideoSurface->flags & SDL_OPENGL) { |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
45 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
46 /* |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
47 Future: Grab framebuffer and put into NSImage |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
48 [ qz_window setMiniwindowImage:image ]; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
49 */ |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
50 } |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
51 else { |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
52 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
53 /* make the alpha channel opaque so anim won't have holes in it */ |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
54 QZ_SetPortAlphaOpaque (); |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
55 } |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
56 |
631
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
57 /* window is hidden now */ |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
58 SDL_PrivateAppActive (0, SDL_APPACTIVE); |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
59 |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
60 [ super miniaturize:sender ]; |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
61 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
62 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
63 - (void)display |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
64 { |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
65 /* |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
66 This method fires just before the window deminaturizes. |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
67 So, it's just the right place to fixup the alpha channel - which |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
68 makes the deminiaturize animation look right. |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
69 */ |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
70 if ( (SDL_VideoSurface->flags & SDL_OPENGL) == 0) |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
71 QZ_SetPortAlphaOpaque (); |
631
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
72 |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
73 /* window is visible again */ |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
74 SDL_PrivateAppActive (1, SDL_APPACTIVE); |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
75 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
76 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
77 - (void)setFrame:(NSRect)frameRect display:(BOOL)flag |
56
ce9cd2cf0d0d
Date: Sun, 10 Jun 2001 17:33:44 -0500
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
78 { |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
79 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
80 /* |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
81 If the video surface is NULL, this originated from QZ_SetVideoMode, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
82 so don't send the resize event. |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
83 */ |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
84 if (SDL_VideoSurface == NULL) { |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
85 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
86 [ super setFrame:frameRect display:flag ]; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
87 } |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
88 else { |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
89 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
90 SDL_VideoDevice *this = (SDL_VideoDevice*)current_video; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
91 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
92 NSRect sdlRect = [ NSWindow contentRectForFrameRect:frameRect styleMask:[self styleMask] ]; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
93 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
94 [ super setFrame:frameRect display:flag ]; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
95 SDL_PrivateResize (sdlRect.size.width, sdlRect.size.height); |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
96 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
97 /* If not OpenGL, we have to update the pixels and pitch */ |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
98 if ( ! this->screen->flags & SDL_OPENGL ) { |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
99 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
100 LockPortBits ( [ window_view qdPort ] ); |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
101 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
102 SDL_VideoSurface->pixels = GetPixBaseAddr ( GetPortPixMap ( [ window_view qdPort ] ) ); |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
103 SDL_VideoSurface->pitch = GetPixRowBytes ( GetPortPixMap ( [ window_view qdPort ] ) ); |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
104 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
105 SDL_VideoSurface->pixels += ((int)[ self frame ].size.height - (int)sdlRect.size.height) * SDL_VideoSurface->pitch; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
106 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
107 UnlockPortBits ( [ window_view qdPort ] ); |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
108 } |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
109 } |
56
ce9cd2cf0d0d
Date: Sun, 10 Jun 2001 17:33:44 -0500
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
110 } |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
111 |
631
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
112 - (void)appDidHide:(NSNotification*)note |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
113 { |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
114 SDL_PrivateAppActive (0, SDL_APPACTIVE); |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
115 } |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
116 |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
117 - (void)appDidUnhide:(NSNotification*)note |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
118 { |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
119 SDL_PrivateAppActive (1, SDL_APPACTIVE); |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
120 } |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
121 |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
122 - (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
123 { |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
124 /* Make our window subclass receive these application notifications */ |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
125 [ [ NSNotificationCenter defaultCenter ] addObserver:self |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
126 selector:@selector(appDidHide:) name:NSApplicationDidHideNotification object:NSApp ]; |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
127 |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
128 [ [ NSNotificationCenter defaultCenter ] addObserver:self |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
129 selector:@selector(appDidUnhide:) name:NSApplicationDidUnhideNotification object:NSApp ]; |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
130 |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
131 return [ super initWithContentRect:contentRect styleMask:styleMask backing:backingType defer:flag ]; |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
132 } |
52864d66d168
Date: Mon, 5 May 2003 00:08:51 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
501
diff
changeset
|
133 |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
134 @end |
56
ce9cd2cf0d0d
Date: Sun, 10 Jun 2001 17:33:44 -0500
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
135 |
ce9cd2cf0d0d
Date: Sun, 10 Jun 2001 17:33:44 -0500
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
136 /* Delegate for our NSWindow to send SDLQuit() on close */ |
ce9cd2cf0d0d
Date: Sun, 10 Jun 2001 17:33:44 -0500
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
137 @interface SDL_QuartzWindowDelegate : NSObject |
ce9cd2cf0d0d
Date: Sun, 10 Jun 2001 17:33:44 -0500
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
138 {} |
ce9cd2cf0d0d
Date: Sun, 10 Jun 2001 17:33:44 -0500
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
139 - (BOOL)windowShouldClose:(id)sender; |
ce9cd2cf0d0d
Date: Sun, 10 Jun 2001 17:33:44 -0500
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
140 @end |
ce9cd2cf0d0d
Date: Sun, 10 Jun 2001 17:33:44 -0500
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
141 |
ce9cd2cf0d0d
Date: Sun, 10 Jun 2001 17:33:44 -0500
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
142 @implementation SDL_QuartzWindowDelegate |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
143 - (BOOL)windowShouldClose:(id)sender |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
144 { |
58
bd6b0a910a65
* Removed fullscreen menu option from the "Window" menu
Sam Lantinga <slouken@lokigames.com>
parents:
56
diff
changeset
|
145 SDL_PrivateQuit(); |
56
ce9cd2cf0d0d
Date: Sun, 10 Jun 2001 17:33:44 -0500
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
146 return NO; |
ce9cd2cf0d0d
Date: Sun, 10 Jun 2001 17:33:44 -0500
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
147 } |
58
bd6b0a910a65
* Removed fullscreen menu option from the "Window" menu
Sam Lantinga <slouken@lokigames.com>
parents:
56
diff
changeset
|
148 @end |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
149 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
150 /* Subclass of NSQuickDrawView for the window's subview */ |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
151 @interface SDL_QuartzWindowView : NSQuickDrawView |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
152 {} |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
153 @end |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
154 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
155 @implementation SDL_QuartzWindowView |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
272
diff
changeset
|
156 @end |