annotate src/video/quartz/SDL_QuartzVideo.h @ 1189:c96b326b90ba

Moved Quartz SDL_GL_LoadLibrary() to SDL_loadso interface.
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 23 Nov 2005 07:23:48 +0000
parents 49d3efec6651
children 7663bb0f52c7
rev   line source
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
1 /*
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
3 Copyright (C) 1997-2003 Sam Lantinga
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
4
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
9
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
13 Library General Public License for more details.
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
14
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
16 License along with this library; if not, write to the Free
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
18
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
19 Sam Lantinga
252
e8157fcb3114 Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents: 158
diff changeset
20 slouken@libsdl.org
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
21 */
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
22
390
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
23 /*
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
24 @file SDL_QuartzVideo.h
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
25 @author Darrell Walisser, Max Horn, et al.
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
26
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
27 @abstract SDL video driver for Mac OS X.
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
28
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
29 @discussion
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
30
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
31 TODO
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
32 - Hardware Cursor support with NSCursor instead of Carbon
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
33 - Keyboard repeat/mouse speed adjust (if needed)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
34 - Multiple monitor support (currently only main display)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
35 - Accelerated blitting support
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
36 - Fix white OpenGL window on minimize (fixed) (update: broken again on 10.2)
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
37 - Find out what events should be sent/ignored if window is minimized
390
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
38 - Find a way to deal with external resolution/depth switch while app is running
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
39 - Check accuracy of QZ_SetGamma()
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
40 Problems:
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
41 - OGL not working in full screen with software renderer
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
42 - SetColors sets palette correctly but clears framebuffer
390
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
43 - Crash in CG after several mode switches (I think this has been fixed)
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
44 - Retained windows don't draw their title bar quite right (OS Bug) (not using retained windows)
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
45 - Cursor in 8 bit modes is screwy (might just be Radeon PCI bug) (update: not just Radeon)
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
46 - Warping cursor delays mouse events for a fraction of a second,
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
47 there is a hack around this that helps a bit
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
48 */
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
49
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
50 #include <Cocoa/Cocoa.h>
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
51 #include <OpenGL/OpenGL.h>
656
864e2d2a9a55 Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents: 615
diff changeset
52 #include <OpenGL/gl.h>
864e2d2a9a55 Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents: 615
diff changeset
53 #include <OpenGL/glext.h>
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
54 #include <Carbon/Carbon.h>
390
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
55 #include <QuickTime/QuickTime.h>
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
56 #include <IOKit/IOKitLib.h> /* For powersave handling */
588
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
57 #include <pthread.h>
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
58
588
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
59 #include "SDL_thread.h"
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
60 #include "SDL_video.h"
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
61 #include "SDL_error.h"
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
62 #include "SDL_timer.h"
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
63 #include "SDL_syswm.h"
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
64 #include "SDL_sysvideo.h"
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
65 #include "SDL_pixels_c.h"
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
66 #include "SDL_events_c.h"
1189
c96b326b90ba Moved Quartz SDL_GL_LoadLibrary() to SDL_loadso interface.
Ryan C. Gordon <icculus@icculus.org>
parents: 1181
diff changeset
67 #include "SDL_loadso.h"
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
68
770
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
69 /*
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
70 This is a workaround to directly access NSOpenGLContext's CGL context
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
71 We need this to check for errors NSOpenGLContext doesn't support
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
72 */
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
73 @interface NSOpenGLContext (CGLContextAccess)
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
74 - (CGLContextObj) cglContext;
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
75 @end
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
76
ac44ddb84f6f *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 761
diff changeset
77
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
78 /* Main driver structure to store required state information */
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
79 typedef struct SDL_PrivateVideoData {
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
80
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
81 CGDirectDisplayID display; /* 0 == main display (only support single display) */
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
82 CFDictionaryRef mode; /* current mode of the display */
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
83 CFDictionaryRef save_mode; /* original mode of the display */
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
84 CFArrayRef mode_list; /* list of available fullscreen modes */
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
85 CGDirectPaletteRef palette; /* palette of an 8-bit display */
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
86 NSOpenGLContext *gl_context; /* OpenGL rendering context */
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
87 Uint32 width, height, bpp; /* frequently used data about the display */
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
88 Uint32 flags; /* flags for current mode, for teardown purposes */
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
89 Uint32 video_set; /* boolean; indicates if video was set correctly */
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
90 Uint32 warp_flag; /* boolean; notify to event loop that a warp just occured */
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
91 Uint32 warp_ticks; /* timestamp when the warp occured */
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
92 NSWindow *window; /* Cocoa window to implement the SDL window */
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
93 NSQuickDrawView *view; /* the window's view; draw 2D and OpenGL into this view */
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
94 SDL_Surface *resize_icon; /* icon for the resize badge, we have to draw it by hand */
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
95 SDL_GrabMode current_grab_mode; /* default value is SDL_GRAB_OFF */
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
96 SDL_Rect **client_mode_list; /* resolution list to pass back to client */
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
97 SDLKey keymap[256]; /* Mac OS X to SDL key mapping */
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
98 Uint32 current_mods; /* current keyboard modifiers, to track modifier state */
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
99 Uint32 last_virtual_button;/* last virtual mouse button pressed */
563
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
100 io_connect_t power_connection; /* used with IOKit to detect wake from sleep */
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
101 Uint8 expect_mouse_up; /* used to determine when to send mouse up events */
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
102 Uint8 grab_state; /* used to manage grab behavior */
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
103 NSPoint cursor_loc; /* saved cursor coords, for activate/deactivate when grabbed */
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
104 BOOL cursor_should_be_visible; /* tells if cursor is supposed to be visible (SDL_ShowCursor) */
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
105 BOOL cursor_visible; /* tells if cursor is *actually* visible or not */
588
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
106 Uint8* sw_buffers[2]; /* pointers to the two software buffers for double-buffer emulation */
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
107 SDL_Thread *thread; /* thread for async updates to the screen */
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
108 SDL_sem *sem1, *sem2; /* synchronization for async screen updates */
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
109 Uint8 *current_buffer; /* the buffer being copied to the screen */
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
110 BOOL quit_thread; /* used to quit the async blitting thread */
876
9e84d106ec19 (Said Max Horn on the SDL mailing list...)
Ryan C. Gordon <icculus@icculus.org>
parents: 779
diff changeset
111 SInt32 system_version; /* used to dis-/enable workarounds depending on the system version */
563
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
112
390
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
113 ImageDescriptionHandle yuv_idh;
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
114 MatrixRecordPtr yuv_matrix;
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
115 DecompressorComponent yuv_codec;
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
116 ImageSequence yuv_seq;
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
117 PlanarPixmapInfoYUV420 *yuv_pixmap;
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
118 Sint16 yuv_width, yuv_height;
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
119 CGrafPtr yuv_port;
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
120
1189
c96b326b90ba Moved Quartz SDL_GL_LoadLibrary() to SDL_loadso interface.
Ryan C. Gordon <icculus@icculus.org>
parents: 1181
diff changeset
121 void *opengl_library; /* dynamically loaded OpenGL library. */
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
122 } SDL_PrivateVideoData;
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
123
390
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
124 #define _THIS SDL_VideoDevice *this
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
125 #define display_id (this->hidden->display)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
126 #define mode (this->hidden->mode)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
127 #define save_mode (this->hidden->save_mode)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
128 #define mode_list (this->hidden->mode_list)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
129 #define palette (this->hidden->palette)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
130 #define gl_context (this->hidden->gl_context)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
131 #define device_width (this->hidden->width)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
132 #define device_height (this->hidden->height)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
133 #define device_bpp (this->hidden->bpp)
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
134 #define mode_flags (this->hidden->flags)
158
4382c38dfbee Date: Tue, 21 Aug 2001 03:50:01 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 155
diff changeset
135 #define qz_window (this->hidden->window)
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
136 #define window_view (this->hidden->view)
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
137 #define video_set (this->hidden->video_set)
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
138 #define warp_ticks (this->hidden->warp_ticks)
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
139 #define warp_flag (this->hidden->warp_flag)
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
140 #define resize_icon (this->hidden->resize_icon)
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
141 #define current_grab_mode (this->hidden->current_grab_mode)
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
142 #define client_mode_list (this->hidden->client_mode_list)
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
143 #define keymap (this->hidden->keymap)
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
144 #define current_mods (this->hidden->current_mods)
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
145 #define last_virtual_button (this->hidden->last_virtual_button)
563
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
146 #define power_connection (this->hidden->power_connection)
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
147 #define expect_mouse_up (this->hidden->expect_mouse_up)
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
148 #define grab_state (this->hidden->grab_state)
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
149 #define cursor_loc (this->hidden->cursor_loc)
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
150 #define cursor_should_be_visible (this->hidden->cursor_should_be_visible)
563
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
151 #define cursor_visible (this->hidden->cursor_visible)
588
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
152 #define sw_buffers (this->hidden->sw_buffers)
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
153 #define thread (this->hidden->thread)
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
154 #define sem1 (this->hidden->sem1)
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
155 #define sem2 (this->hidden->sem2)
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
156 #define current_buffer (this->hidden->current_buffer)
2c6510c0a304 Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
Sam Lantinga <slouken@libsdl.org>
parents: 563
diff changeset
157 #define quit_thread (this->hidden->quit_thread)
876
9e84d106ec19 (Said Max Horn on the SDL mailing list...)
Ryan C. Gordon <icculus@icculus.org>
parents: 779
diff changeset
158 #define system_version (this->hidden->system_version)
1189
c96b326b90ba Moved Quartz SDL_GL_LoadLibrary() to SDL_loadso interface.
Ryan C. Gordon <icculus@icculus.org>
parents: 1181
diff changeset
159 #define opengl_library (this->hidden->opengl_library)
501
74262d2647ca Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents: 498
diff changeset
160
563
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
161 /* grab states - the input is in one of these states */
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
162 enum {
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
163 QZ_UNGRABBED = 0,
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
164 QZ_VISIBLE_GRAB,
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
165 QZ_INVISIBLE_GRAB
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
166 };
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
167
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
168 /* grab actions - these can change the grabbed state */
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
169 enum {
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
170 QZ_ENABLE_GRAB = 0,
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
171 QZ_DISABLE_GRAB,
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
172 QZ_HIDECURSOR,
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
173 QZ_SHOWCURSOR
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
174 };
04dcaf3da918 Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents: 561
diff changeset
175
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
176 /* Gamma Functions */
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
177 int QZ_SetGamma (_THIS, float red, float green, float blue);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
178 int QZ_GetGamma (_THIS, float *red, float *green, float *blue);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
179 int QZ_SetGammaRamp (_THIS, Uint16 *ramp);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
180 int QZ_GetGammaRamp (_THIS, Uint16 *ramp);
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
181
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
182 /* OpenGL functions */
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
183 int QZ_SetupOpenGL (_THIS, int bpp, Uint32 flags);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
184 void QZ_TearDownOpenGL (_THIS);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
185 void* QZ_GL_GetProcAddress (_THIS, const char *proc);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
186 int QZ_GL_GetAttribute (_THIS, SDL_GLattr attrib, int* value);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
187 int QZ_GL_MakeCurrent (_THIS);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
188 void QZ_GL_SwapBuffers (_THIS);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
189 int QZ_GL_LoadLibrary (_THIS, const char *location);
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
190
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
191 /* Cursor and Mouse functions */
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
192 void QZ_FreeWMCursor (_THIS, WMcursor *cursor);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
193 WMcursor* QZ_CreateWMCursor (_THIS, Uint8 *data, Uint8 *mask,
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
194 int w, int h, int hot_x, int hot_y);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
195 int QZ_ShowWMCursor (_THIS, WMcursor *cursor);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
196 void QZ_WarpWMCursor (_THIS, Uint16 x, Uint16 y);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
197 void QZ_MoveWMCursor (_THIS, int x, int y);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
198 void QZ_CheckMouseMode (_THIS);
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
199
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
200 /* Event functions */
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
201 void QZ_InitOSKeymap (_THIS);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
202 void QZ_PumpEvents (_THIS);
47
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
203
45b1c4303f87 Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
204 /* Window Manager functions */
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
205 void QZ_SetCaption (_THIS, const char *title, const char *icon);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
206 void QZ_SetIcon (_THIS, SDL_Surface *icon, Uint8 *mask);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
207 int QZ_IconifyWindow (_THIS);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
208 SDL_GrabMode QZ_GrabInput (_THIS, SDL_GrabMode grab_mode);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
209 /*int QZ_GetWMInfo (_THIS, SDL_SysWMinfo *info);*/
272
d1447a846d80 Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
210
390
19e73568a75c Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
211 /* YUV functions */
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
212 SDL_Overlay* QZ_CreateYUVOverlay (_THIS, int width, int height,
561
4bcf7dd06c47 Date: Sat, 14 Dec 2002 13:33:05 -0500
Sam Lantinga <slouken@libsdl.org>
parents: 555
diff changeset
213 Uint32 format, SDL_Surface *display);
761
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
214
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
215
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
216 /* Private functions (used internally) */
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
217 void QZ_PrivateWarpCursor (_THIS, int x, int y);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
218 void QZ_ChangeGrabState (_THIS, int action);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
219 void QZ_RegisterForSleepNotifications (_THIS);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
220 void QZ_ShowMouse (_THIS);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
221 void QZ_HideMouse (_THIS);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
222 void QZ_PrivateGlobalToLocal (_THIS, NSPoint *p);
c5b2b6d2d1fe Date: Wed, 31 Dec 2003 21:55:30 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 679
diff changeset
223 void QZ_PrivateCocoaToSDL (_THIS, NSPoint *p);
779
68c8da837fc0 Date: Tue, 6 Jan 2004 21:54:02 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 777
diff changeset
224 BOOL QZ_IsMouseInWindow (_THIS);